diff --git a/Cargo.lock b/Cargo.lock index ab7e29a82d1..8c8618d4b12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3306,6 +3306,7 @@ dependencies = [ "base64 0.13.0", "clap 3.1.6", "hex", + "lazy-static-include", "near-primitives", "near-primitives-core", "near-test-contracts", diff --git a/testdata/example-config-gc.json b/nearcore/res/example-config-gc.json similarity index 100% rename from testdata/example-config-gc.json rename to nearcore/res/example-config-gc.json diff --git a/testdata/example-config-no-gc.json b/nearcore/res/example-config-no-gc.json similarity index 100% rename from testdata/example-config-no-gc.json rename to nearcore/res/example-config-no-gc.json diff --git a/nearcore/src/config.rs b/nearcore/src/config.rs index 67fb844083e..a5552991e38 100644 --- a/nearcore/src/config.rs +++ b/nearcore/src/config.rs @@ -1441,10 +1441,12 @@ fn test_init_config_localnet() { /// correctly parsed and defaults being applied correctly applied. #[test] fn test_config_from_file() { - for (has_gc, data) in [ - (true, include_bytes!("../../testdata/example-config-gc.json").as_slice()), - (false, include_bytes!("../../testdata/example-config-no-gc.json").as_slice()), - ] { + lazy_static_include::lazy_static_include_bytes! { + EXAMPLE_CONFIG_GC => "res/example-config-gc.json", + EXAMPLE_CONFIG_NO_GC => "res/example-config-no-gc.json", + }; + + for (has_gc, data) in [(true, &EXAMPLE_CONFIG_GC[..]), (false, &EXAMPLE_CONFIG_NO_GC[..])] { let tmp = tempfile::NamedTempFile::new().unwrap(); tmp.as_file().write_all(data).unwrap(); diff --git a/runtime/near-vm-runner-standalone/Cargo.toml b/runtime/near-vm-runner-standalone/Cargo.toml index aadb4376b4b..0f0d376108a 100644 --- a/runtime/near-vm-runner-standalone/Cargo.toml +++ b/runtime/near-vm-runner-standalone/Cargo.toml @@ -24,6 +24,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" clap = { version = "3.1.6", features = ["derive"] } base64 = "0.13" +lazy-static-include = "3" num-rational = "0.3" tracing-span-tree = "0.1" diff --git a/runtime/near-vm-runner-standalone/src/script.rs b/runtime/near-vm-runner-standalone/src/script.rs index 616ed067255..a43ad6561ed 100644 --- a/runtime/near-vm-runner-standalone/src/script.rs +++ b/runtime/near-vm-runner-standalone/src/script.rs @@ -250,6 +250,10 @@ fn profile_data_is_per_outcome() { #[cfg(feature = "no_cache")] #[test] fn test_evm_slow_deserialize_repro() { + lazy_static_include::lazy_static_include_bytes! { + ZOMBIE_OWNERSHIP_BIN => "../near-test-contracts/res/ZombieOwnership.bin", + }; + fn evm_slow_deserialize_repro(vm_kind: VMKind) { println!("evm_slow_deserialize_repro of {:?}", &vm_kind); tracing_span_tree::span_tree().enable(); @@ -262,10 +266,7 @@ fn test_evm_slow_deserialize_repro() { let contract = script.contract_from_file(Path::new("../near-test-contracts/res/near_evm.wasm")); - let input = - hex::decode(&include_bytes!("../../near-test-contracts/res/ZombieOwnership.bin")) - .unwrap(); - + let input = hex::decode(&ZOMBIE_OWNERSHIP_BIN[..]).unwrap(); script.step(contract, "deploy_code").input(input).repeat(3); let res = script.run(); assert_eq!(res.outcomes[0].error(), None);