diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9c2b0364d..2be24a71f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --locked --verbose + args: --locked --verbose --features meta-call bully-build: name: Bully build runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 86bcf7fe6..21e681d2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,15 +8,6 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -[[package]] -name = "addr2line" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" -dependencies = [ - "gimli 0.23.0", -] - [[package]] name = "addr2line" version = "0.15.1" @@ -132,12 +123,12 @@ dependencies = [ "lazy-static-include", "libsecp256k1", "logos", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "near-primitives-core 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", + "near-crypto", + "near-primitives-core 0.4.0", "near-sdk", "near-sdk-sim", - "near-vm-logic 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-vm-runner 3.0.0", + "near-vm-logic 4.0.0-pre.1", + "near-vm-runner", "num", "primitive-types", "rand 0.7.3", @@ -163,7 +154,7 @@ version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744" dependencies = [ - "addr2line 0.15.1", + "addr2line", "cc", "cfg-if 1.0.0", "libc", @@ -551,16 +542,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "cpp_demangle" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390" -dependencies = [ - "cfg-if 1.0.0", - "glob", -] - [[package]] name = "cpufeatures" version = "0.1.1" @@ -588,15 +569,6 @@ dependencies = [ "cranelift-entity 0.68.0", ] -[[package]] -name = "cranelift-bforest" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841476ab6d3530136b5162b64a2c6969d68141843ad2fd59126e5ea84fd9b5fe" -dependencies = [ - "cranelift-entity 0.72.0", -] - [[package]] name = "cranelift-codegen" version = "0.67.0" @@ -636,26 +608,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cranelift-codegen" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5619cef8d19530298301f91e9a0390d369260799a3d8dd01e28fc88e53637a" -dependencies = [ - "byteorder", - "cranelift-bforest 0.72.0", - "cranelift-codegen-meta 0.72.0", - "cranelift-codegen-shared 0.72.0", - "cranelift-entity 0.72.0", - "gimli 0.23.0", - "log", - "regalloc 0.0.31", - "serde", - "smallvec", - "target-lexicon 0.11.2", - "thiserror", -] - [[package]] name = "cranelift-codegen-meta" version = "0.67.0" @@ -676,16 +628,6 @@ dependencies = [ "cranelift-entity 0.68.0", ] -[[package]] -name = "cranelift-codegen-meta" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a319709b8267939155924114ea83f2a5b5af65ece3ac6f703d4735f3c66bb0d" -dependencies = [ - "cranelift-codegen-shared 0.72.0", - "cranelift-entity 0.72.0", -] - [[package]] name = "cranelift-codegen-shared" version = "0.67.0" @@ -698,15 +640,6 @@ version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938" -[[package]] -name = "cranelift-codegen-shared" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15925b23cd3a448443f289d85a8f53f3cf7a80f0137aa53c8e3b01ae8aefaef7" -dependencies = [ - "serde", -] - [[package]] name = "cranelift-entity" version = "0.67.0" @@ -725,15 +658,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cranelift-entity" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "610cf464396c89af0f9f7c64b5aa90aa9e8812ac84084098f1565b40051bc415" -dependencies = [ - "serde", -] - [[package]] name = "cranelift-frontend" version = "0.67.0" @@ -758,18 +682,6 @@ dependencies = [ "target-lexicon 0.11.2", ] -[[package]] -name = "cranelift-frontend" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d20c8bd4a1c41ded051734f0e33ad1d843a0adc98b9bd975ee6657e2c70cdc9" -dependencies = [ - "cranelift-codegen 0.72.0", - "log", - "smallvec", - "target-lexicon 0.11.2", -] - [[package]] name = "cranelift-native" version = "0.67.0" @@ -781,16 +693,6 @@ dependencies = [ "target-lexicon 0.11.2", ] -[[package]] -name = "cranelift-native" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "304e100df41f34a5a15291b37bfe0fd7abd0427a2c84195cc69578b4137f9099" -dependencies = [ - "cranelift-codegen 0.72.0", - "target-lexicon 0.11.2", -] - [[package]] name = "cranelift-wasm" version = "0.67.0" @@ -806,23 +708,6 @@ dependencies = [ "wasmparser 0.59.0", ] -[[package]] -name = "cranelift-wasm" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4efd473b2917303957e0bfaea6ea9d08b8c93695bee015a611a2514ce5254abc" -dependencies = [ - "cranelift-codegen 0.72.0", - "cranelift-entity 0.72.0", - "cranelift-frontend 0.72.0", - "itertools 0.10.0", - "log", - "serde", - "smallvec", - "thiserror", - "wasmparser 0.76.0", -] - [[package]] name = "crc32fast" version = "1.2.1" @@ -1534,17 +1419,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" -dependencies = [ - "fallible-iterator", - "indexmap", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.24.0" @@ -2055,30 +1929,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" -[[package]] -name = "near-crypto" -version = "0.1.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "arrayref", - "blake2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "borsh", - "bs58", - "c2-chacha", - "curve25519-dalek", - "derive_more", - "ed25519-dalek", - "lazy_static", - "libc", - "parity-secp256k1", - "rand 0.7.3", - "rand_core 0.5.1", - "serde", - "serde_json", - "subtle 2.4.0", - "thiserror", -] - [[package]] name = "near-crypto" version = "0.1.0" @@ -2122,8 +1972,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bde79472f7cfc0675733b65f79f9e50c20bfbb9806298ab2872916869a45dccd" dependencies = [ "borsh", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "near-primitives 0.1.0-pre.1", + "near-crypto", + "near-primitives", "rand 0.7.3", ] @@ -2143,9 +1993,9 @@ dependencies = [ "hex", "jemallocator", "lazy_static", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto", "near-primitives-core 0.4.0", - "near-rpc-error-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-rpc-error-macro", "near-vm-errors 4.0.0-pre.1", "num-rational 0.3.2", "primitive-types", @@ -2159,54 +2009,6 @@ dependencies = [ "validator", ] -[[package]] -name = "near-primitives" -version = "0.1.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "base64 0.13.0", - "borsh", - "bs58", - "byteorder", - "chrono", - "derive_more", - "easy-ext", - "hex", - "jemallocator", - "lazy_static", - "near-crypto 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-primitives-core 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-rpc-error-macro 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "num-rational 0.3.2", - "primitive-types", - "rand 0.7.3", - "reed-solomon-erasure", - "regex", - "serde", - "serde_json", - "sha2 0.9.5", - "smart-default", - "validator", -] - -[[package]] -name = "near-primitives-core" -version = "0.1.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "base64 0.11.0", - "borsh", - "bs58", - "derive_more", - "hex", - "lazy_static", - "num-rational 0.3.2", - "serde", - "serde_json", - "sha2 0.9.5", -] - [[package]] name = "near-primitives-core" version = "0.1.0" @@ -2243,17 +2045,6 @@ dependencies = [ "sha2 0.9.5", ] -[[package]] -name = "near-rpc-error-core" -version = "0.1.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn", -] - [[package]] name = "near-rpc-error-core" version = "0.1.0" @@ -2267,26 +2058,13 @@ dependencies = [ "syn", ] -[[package]] -name = "near-rpc-error-macro" -version = "0.1.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "near-rpc-error-core 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", -] - [[package]] name = "near-rpc-error-macro" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6111d713e90c7c551dee937f4a06cb9ea2672243455a4454cc7566387ba2d9" dependencies = [ - "near-rpc-error-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-rpc-error-core", "proc-macro2", "quote", "serde", @@ -2306,14 +2084,14 @@ dependencies = [ "hex", "lazy_static", "log", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto", "near-metrics", - "near-primitives 0.1.0-pre.1", + "near-primitives", "near-runtime-utils 4.0.0-pre.1", "near-store", "near-vm-errors 4.0.0-pre.1", "near-vm-logic 4.0.0-pre.1", - "near-vm-runner 4.0.0-pre.1", + "near-vm-runner", "num-bigint 0.3.2", "num-rational 0.3.2", "num-traits", @@ -2322,15 +2100,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "near-runtime-utils" -version = "3.0.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "near-runtime-utils" version = "3.0.0" @@ -2359,9 +2128,9 @@ dependencies = [ "base64 0.13.0", "borsh", "bs58", - "near-primitives-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-primitives-core 0.1.0", "near-sdk-macros", - "near-vm-logic 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-vm-logic 3.0.0", "serde", "serde_json", "wee_alloc", @@ -2396,9 +2165,9 @@ source = "git+https://github.com/near/near-sdk-rs?rev=9d99077c6acfde68c06845f2a1 dependencies = [ "funty", "lazy-static-include", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto", "near-pool", - "near-primitives 0.1.0-pre.1", + "near-primitives", "near-runtime", "near-sdk", "near-store", @@ -2417,8 +2186,8 @@ dependencies = [ "derive_more", "elastic-array", "lazy_static", - "near-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "near-primitives 0.1.0-pre.1", + "near-crypto", + "near-primitives", "num_cpus", "rand 0.7.3", "rocksdb", @@ -2427,17 +2196,6 @@ dependencies = [ "strum", ] -[[package]] -name = "near-vm-errors" -version = "3.0.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "borsh", - "hex", - "near-rpc-error-macro 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "serde", -] - [[package]] name = "near-vm-errors" version = "3.0.0" @@ -2446,7 +2204,7 @@ checksum = "53a100dda565c5375ac061126167afc5c33cdba1f2e325cfae3ce08f4a5a432a" dependencies = [ "borsh", "hex", - "near-rpc-error-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-rpc-error-macro", "serde", ] @@ -2458,25 +2216,8 @@ checksum = "e281d8730ed8cb0e3e69fb689acee6b93cdb43824cd69a8ffd7e1bfcbd1177d7" dependencies = [ "borsh", "hex", - "near-rpc-error-macro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", -] - -[[package]] -name = "near-vm-logic" -version = "3.0.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "base64 0.13.0", - "borsh", - "bs58", - "byteorder", - "near-primitives-core 0.1.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-runtime-utils 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", + "near-rpc-error-macro", "serde", - "sha2 0.9.5", - "sha3 0.9.1", ] [[package]] @@ -2489,9 +2230,9 @@ dependencies = [ "borsh", "bs58", "byteorder", - "near-primitives-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "near-runtime-utils 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "near-vm-errors 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-primitives-core 0.1.0", + "near-runtime-utils 3.0.0", + "near-vm-errors 3.0.0", "serde", "sha2 0.9.5", "sha3 0.9.1", @@ -2515,33 +2256,6 @@ dependencies = [ "sha3 0.9.1", ] -[[package]] -name = "near-vm-runner" -version = "3.0.0" -source = "git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f#3744f07e13bf43a9522fb39fa8f6f128396d0e1f" -dependencies = [ - "anyhow", - "borsh", - "cached", - "near-primitives 0.1.0", - "near-vm-errors 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "near-vm-logic 3.0.0 (git+https://github.com/near/nearcore?rev=3744f07e13bf43a9522fb39fa8f6f128396d0e1f)", - "parity-wasm", - "pwasm-utils", - "serde", - "threadpool", - "tracing", - "wasmer", - "wasmer-compiler-cranelift", - "wasmer-compiler-singlepass", - "wasmer-engine-native", - "wasmer-runtime-core-near", - "wasmer-runtime-near", - "wasmer-types", - "wasmer-vm", - "wasmtime 0.25.0", -] - [[package]] name = "near-vm-runner" version = "4.0.0-pre.1" @@ -2552,7 +2266,7 @@ dependencies = [ "borsh", "cached", "log", - "near-primitives 0.1.0-pre.1", + "near-primitives", "near-vm-errors 4.0.0-pre.1", "near-vm-logic 4.0.0-pre.1", "parity-wasm", @@ -2563,7 +2277,7 @@ dependencies = [ "wasmer-runtime-core-near", "wasmer-runtime-near", "wasmer-types", - "wasmtime 0.20.0", + "wasmtime", ] [[package]] @@ -2720,16 +2434,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "object" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" -dependencies = [ - "crc32fast", - "indexmap", -] - [[package]] name = "object" version = "0.24.0" @@ -2881,12 +2585,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "paste" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -3039,15 +2737,6 @@ version = "2.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45604fc7a88158e7d514d8e22e14ac746081e7a70d7690074dd0029ee37458d6" -[[package]] -name = "psm" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abf49e5417290756acfd26501536358560c4a5cc4a0934d390939acb3e7083a" -dependencies = [ - "cc", -] - [[package]] name = "pwasm-utils" version = "0.12.0" @@ -3234,7 +2923,6 @@ checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" dependencies = [ "log", "rustc-hash", - "serde", "smallvec", ] @@ -3683,15 +3371,6 @@ dependencies = [ "syn", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.1.43" @@ -4255,12 +3934,6 @@ version = "0.65.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" -[[package]] -name = "wasmparser" -version = "0.76.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755a9a4afe3f6cccbbe6d7e965eef44cf260b001f93e547eba84255c1d0187d8" - [[package]] name = "wasmtime" version = "0.20.0" @@ -4280,38 +3953,10 @@ dependencies = [ "smallvec", "target-lexicon 0.11.2", "wasmparser 0.59.0", - "wasmtime-environ 0.20.0", - "wasmtime-jit 0.20.0", - "wasmtime-profiling 0.20.0", - "wasmtime-runtime 0.20.0", - "winapi", -] - -[[package]] -name = "wasmtime" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26ea2ad49bb047e10ca292f55cd67040bef14b676d07e7b04ed65fd312d52ece" -dependencies = [ - "anyhow", - "backtrace", - "bincode", - "cfg-if 1.0.0", - "cpp_demangle", - "indexmap", - "libc", - "log", - "paste", - "region", - "rustc-demangle", - "serde", - "smallvec", - "target-lexicon 0.11.2", - "wasmparser 0.76.0", - "wasmtime-environ 0.25.0", - "wasmtime-jit 0.25.0", - "wasmtime-profiling 0.25.0", - "wasmtime-runtime 0.25.0", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-profiling", + "wasmtime-runtime", "winapi", ] @@ -4324,22 +3969,8 @@ dependencies = [ "cranelift-codegen 0.67.0", "cranelift-entity 0.67.0", "cranelift-frontend 0.67.0", - "cranelift-wasm 0.67.0", - "wasmtime-environ 0.20.0", -] - -[[package]] -name = "wasmtime-cranelift" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e769b80abbb89255926f69ba37085f7dd6608c980134838c3c89d7bf6e776bc" -dependencies = [ - "cranelift-codegen 0.72.0", - "cranelift-entity 0.72.0", - "cranelift-frontend 0.72.0", - "cranelift-wasm 0.72.0", - "wasmparser 0.76.0", - "wasmtime-environ 0.25.0", + "cranelift-wasm", + "wasmtime-environ", ] [[package]] @@ -4355,23 +3986,7 @@ dependencies = [ "target-lexicon 0.11.2", "thiserror", "wasmparser 0.59.0", - "wasmtime-environ 0.20.0", -] - -[[package]] -name = "wasmtime-debug" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38501788c936a4932b0ddf61135963a4b7d1f549f63a6908ae56a1c86d74fc7b" -dependencies = [ - "anyhow", - "gimli 0.23.0", - "more-asserts", - "object 0.23.0", - "target-lexicon 0.11.2", - "thiserror", - "wasmparser 0.76.0", - "wasmtime-environ 0.25.0", + "wasmtime-environ", ] [[package]] @@ -4384,7 +3999,7 @@ dependencies = [ "cfg-if 0.1.10", "cranelift-codegen 0.67.0", "cranelift-entity 0.67.0", - "cranelift-wasm 0.67.0", + "cranelift-wasm", "gimli 0.21.0", "indexmap", "log", @@ -4394,27 +4009,6 @@ dependencies = [ "wasmparser 0.59.0", ] -[[package]] -name = "wasmtime-environ" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fae793ea1387b2fede277d209bb27285366df58f0a3ae9d59e58a7941dce60fa" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen 0.72.0", - "cranelift-entity 0.72.0", - "cranelift-wasm 0.72.0", - "gimli 0.23.0", - "indexmap", - "log", - "more-asserts", - "region", - "serde", - "thiserror", - "wasmparser 0.76.0", -] - [[package]] name = "wasmtime-jit" version = "0.20.0" @@ -4426,8 +4020,8 @@ dependencies = [ "cranelift-codegen 0.67.0", "cranelift-entity 0.67.0", "cranelift-frontend 0.67.0", - "cranelift-native 0.67.0", - "cranelift-wasm 0.67.0", + "cranelift-native", + "cranelift-wasm", "gimli 0.21.0", "log", "more-asserts", @@ -4437,44 +4031,12 @@ dependencies = [ "target-lexicon 0.11.2", "thiserror", "wasmparser 0.59.0", - "wasmtime-cranelift 0.20.0", - "wasmtime-debug 0.20.0", - "wasmtime-environ 0.20.0", - "wasmtime-obj 0.20.0", - "wasmtime-profiling 0.20.0", - "wasmtime-runtime 0.20.0", - "winapi", -] - -[[package]] -name = "wasmtime-jit" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3bd0fae8396473a68a1491559d61776127bb9bea75c9a6a6c038ae4a656eb2" -dependencies = [ - "addr2line 0.14.1", - "anyhow", - "cfg-if 1.0.0", - "cranelift-codegen 0.72.0", - "cranelift-entity 0.72.0", - "cranelift-frontend 0.72.0", - "cranelift-native 0.72.0", - "cranelift-wasm 0.72.0", - "gimli 0.23.0", - "log", - "more-asserts", - "object 0.23.0", - "region", - "serde", - "target-lexicon 0.11.2", - "thiserror", - "wasmparser 0.76.0", - "wasmtime-cranelift 0.25.0", - "wasmtime-debug 0.25.0", - "wasmtime-environ 0.25.0", - "wasmtime-obj 0.25.0", - "wasmtime-profiling 0.25.0", - "wasmtime-runtime 0.25.0", + "wasmtime-cranelift", + "wasmtime-debug", + "wasmtime-environ", + "wasmtime-obj", + "wasmtime-profiling", + "wasmtime-runtime", "winapi", ] @@ -4488,22 +4050,8 @@ dependencies = [ "more-asserts", "object 0.21.1", "target-lexicon 0.11.2", - "wasmtime-debug 0.20.0", - "wasmtime-environ 0.20.0", -] - -[[package]] -name = "wasmtime-obj" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a79fa098a3be8fabc50f5be60f8e47694d569afdc255de37850fc80295485012" -dependencies = [ - "anyhow", - "more-asserts", - "object 0.23.0", - "target-lexicon 0.11.2", - "wasmtime-debug 0.25.0", - "wasmtime-environ 0.25.0", + "wasmtime-debug", + "wasmtime-environ", ] [[package]] @@ -4518,24 +4066,8 @@ dependencies = [ "libc", "serde", "target-lexicon 0.11.2", - "wasmtime-environ 0.20.0", - "wasmtime-runtime 0.20.0", -] - -[[package]] -name = "wasmtime-profiling" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d81e2106efeef4c01917fd16956a91d39bb78c07cf97027abdba9ca98da3f258" -dependencies = [ - "anyhow", - "cfg-if 1.0.0", - "lazy_static", - "libc", - "serde", - "target-lexicon 0.11.2", - "wasmtime-environ 0.25.0", - "wasmtime-runtime 0.25.0", + "wasmtime-environ", + "wasmtime-runtime", ] [[package]] @@ -4555,31 +4087,7 @@ dependencies = [ "more-asserts", "region", "thiserror", - "wasmtime-environ 0.20.0", - "winapi", -] - -[[package]] -name = "wasmtime-runtime" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f747c656ca4680cad7846ae91c57d03f2dd4f4170da77a700df4e21f0d805378" -dependencies = [ - "anyhow", - "backtrace", - "cc", - "cfg-if 1.0.0", - "indexmap", - "lazy_static", - "libc", - "log", - "memoffset 0.6.3", - "more-asserts", - "psm", - "rand 0.7.3", - "region", - "thiserror", - "wasmtime-environ 0.25.0", + "wasmtime-environ", "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index 11cca8ea8..b6e075c84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,9 +65,9 @@ hex = { version = "0.4.3", default-features = false } near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" } near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" } near-crypto = "0.1.0" -near-vm-runner = { git = "https://github.com/near/nearcore", rev = "3744f07e13bf43a9522fb39fa8f6f128396d0e1f" } -near-primitives-core = { git = "https://github.com/near/nearcore", rev = "3744f07e13bf43a9522fb39fa8f6f128396d0e1f" } -near-vm-logic = { git = "https://github.com/near/nearcore", rev = "3744f07e13bf43a9522fb39fa8f6f128396d0e1f" } +near-vm-runner = "4.0.0-pre.1" +near-vm-logic = "4.0.0-pre.1" +near-primitives-core = "0.4.0" libsecp256k1 = "0.3.5" rand = "0.7.3" criterion = "0.3.4" @@ -82,7 +82,7 @@ engine = [] contract = ["engine"] evm_bully = [] log = [] -meta-call = ["contract"] +meta-call = [] integration-test = ["log"] mainnet = ["contract", "log"] testnet = ["contract", "log"] diff --git a/Makefile b/Makefile index 517d3058e..d8d9566cb 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ check-clippy: # test depends on release since `tests/test_upgrade.rs` includes `release.wasm` test: test-build - $(CARGO) test + $(CARGO) test --features meta-call format: $(CARGO) fmt diff --git a/src/precompiles/native.rs b/src/precompiles/native.rs index 9b3382eae..afe713bf0 100644 --- a/src/precompiles/native.rs +++ b/src/precompiles/native.rs @@ -329,21 +329,19 @@ impl Precompile for ExitToEthereum { } } -#[cfg(all(feature = "contract", test))] +#[cfg(test)] mod tests { use super::{ExitToEthereum, ExitToNear}; use crate::types::near_account_to_evm_address; - use super::*; - #[test] fn test_precompile_id() { assert_eq!( - ExitToEthereum::ADDRESS, + ExitToEthereum::<()>::ADDRESS, near_account_to_evm_address("exitToEthereum".as_bytes()).0 ); assert_eq!( - ExitToNear::ADDRESS, + ExitToNear::<()>::ADDRESS, near_account_to_evm_address("exitToNear".as_bytes()).0 ); } diff --git a/src/test_utils/mod.rs b/src/test_utils/mod.rs index 9f6bf6708..89ff97224 100644 --- a/src/test_utils/mod.rs +++ b/src/test_utils/mod.rs @@ -103,7 +103,8 @@ impl<'a> OneShotAuroraRunner<'a> { ); near_vm_runner::run( - &self.base.code, + self.base.code.hash.as_ref().to_vec(), + &self.base.code.code.as_slice(), method_name, &mut self.ext, self.context.clone(), @@ -168,7 +169,8 @@ impl AuroraRunner { ); let (maybe_outcome, maybe_error) = near_vm_runner::run( - &self.code, + self.code.hash.as_ref().to_vec(), + &self.code.code.as_slice(), method_name, &mut self.ext, self.context.clone(), @@ -275,7 +277,8 @@ impl AuroraRunner { address.as_bytes().to_vec(), ); let (outcome, maybe_error) = near_vm_runner::run( - &self.code, + self.code.hash.as_ref().to_vec(), + &self.code.code.as_slice(), method_name, &mut self.ext.clone(), context, diff --git a/tests/test_meta_parsing.rs b/src/tests/meta_parsing.rs similarity index 86% rename from tests/test_meta_parsing.rs rename to src/tests/meta_parsing.rs index 19f315ca8..0af48d49e 100644 --- a/tests/test_meta_parsing.rs +++ b/src/tests/meta_parsing.rs @@ -1,20 +1,13 @@ -#[cfg(feature = "meta-call")] use { - aurora_engine::meta_parsing::{near_erc712_domain, parse_meta_call, prepare_meta_call_args}, - aurora_engine::parameters::MetaCallArgs, - aurora_engine::prelude::U256, - aurora_engine::types::{u256_to_arr, InternalMetaCallArgs, Wei}, + crate::meta_parsing::{near_erc712_domain, parse_meta_call, prepare_meta_call_args}, + crate::parameters::MetaCallArgs, + crate::prelude::{Address, U256}, + crate::types::{keccak, u256_to_arr, InternalMetaCallArgs, Wei}, borsh::BorshSerialize, - near_crypto::{InMemorySigner, KeyType, Signature, Signer}, + near_crypto::{InMemorySigner, KeyType, PublicKey, Signature, Signer}, }; -use near_crypto::PublicKey; - -use aurora_engine::prelude::Address; -use aurora_engine::types::keccak; - -#[cfg(feature = "meta-call")] -pub fn encode_meta_call_function_args( +fn encode_meta_call_function_args( signer: &dyn Signer, chain_id: u64, nonce: U256, @@ -67,7 +60,7 @@ pub fn encode_meta_call_function_args( } } -pub fn public_key_to_address(public_key: PublicKey) -> Address { +fn public_key_to_address(public_key: PublicKey) -> Address { match public_key { PublicKey::ED25519(_) => panic!("Wrong PublicKey"), PublicKey::SECP256K1(pubkey) => { @@ -80,7 +73,7 @@ pub fn public_key_to_address(public_key: PublicKey) -> Address { } } -#[cfg(all(feature = "meta-call", test))] +#[test] fn test_meta_parsing() { let chain_id = 1313161555; let signer = InMemorySigner::from_seed("doesnt", KeyType::SECP256K1, "a"); diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 3705e2c25..6d11fe463 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,6 +1,9 @@ mod contract_call; mod erc20; mod erc20_connector; +#[cfg(feature = "meta-call")] +mod meta_parsing; mod sanity; mod self_destruct_state; mod standard_precompiles; +mod state_migration; diff --git a/tests/test_state_migration.rs b/src/tests/state_migration.rs similarity index 72% rename from tests/test_state_migration.rs rename to src/tests/state_migration.rs index ecbdae253..1be240a31 100644 --- a/tests/test_state_migration.rs +++ b/src/tests/state_migration.rs @@ -1,19 +1,13 @@ -use aurora_engine::parameters::NewCallArgs; -use aurora_engine::prelude::U256; -use aurora_engine::types; +use crate::parameters::NewCallArgs; +use crate::prelude::U256; +use crate::test_utils::AuroraRunner; +use crate::types; use borsh::BorshSerialize; use near_sdk_sim::{ExecutionResult, UserAccount}; use std::fs; use std::path::Path; use std::process::Command; -// TODO: it would be nice to include this under src/tests but right now this is not possible. -// The issue is a linker error (arising from multiple dependencies on near-vm-logic I think). - -near_sdk_sim::lazy_static_include::lazy_static_include_bytes! { - EVM_WASM_BYTES => "release.wasm" -} - #[test] fn test_state_migration() { let aurora = deploy_evm(); @@ -33,15 +27,15 @@ fn test_state_migration() { } fn deploy_evm() -> AuroraAccount { - let aurora_config = AuroraConfig::default(); + let aurora_runner = AuroraRunner::default(); let main_account = near_sdk_sim::init_simulator(None); let contract_account = main_account.deploy( - &aurora_config.code, - aurora_config.account_id.clone(), + &aurora_runner.code.code, + aurora_runner.aurora_account_id.clone(), 5 * near_sdk_sim::STORAGE_AMOUNT, ); let new_args = NewCallArgs { - chain_id: types::u256_to_arr(&U256::from(aurora_config.chain_id)), + chain_id: types::u256_to_arr(&U256::from(aurora_runner.chain_id)), owner_id: main_account.account_id.clone(), bridge_prover_id: "prover.near".to_string(), upgrade_delay_blocks: 1, @@ -78,22 +72,6 @@ impl AuroraAccount { } } -struct AuroraConfig { - code: Vec, - chain_id: u64, - account_id: String, -} - -impl Default for AuroraConfig { - fn default() -> Self { - Self { - code: EVM_WASM_BYTES.to_vec(), - chain_id: 1313161556, // NEAR betanet - account_id: "aurora".to_string(), - } - } -} - fn contract_bytes() -> Vec { let base_path = Path::new("etc").join("state-migration-test"); let output_path = base_path diff --git a/tests/test_upgrade.rs b/tests/test_upgrade.rs deleted file mode 100644 index 2bfff9e9d..000000000 --- a/tests/test_upgrade.rs +++ /dev/null @@ -1,55 +0,0 @@ -use near_sdk::borsh::BorshSerialize; -use near_sdk::test_utils::accounts; -use near_sdk_sim::{to_yocto, UserAccount, DEFAULT_GAS, STORAGE_AMOUNT}; - -use aurora_engine::parameters::NewCallArgs; - -near_sdk_sim::lazy_static_include::lazy_static_include_bytes! { - EVM_WASM_BYTES => "release.wasm" -} - -pub fn init() -> (UserAccount, UserAccount) { - let master_account = near_sdk_sim::init_simulator(None); - let contract_account = - master_account.deploy(*EVM_WASM_BYTES, accounts(0).to_string(), to_yocto("1000")); - contract_account - .call( - accounts(0).to_string(), - "new", - &NewCallArgs { - chain_id: [0u8; 32], - owner_id: master_account.account_id.clone(), - bridge_prover_id: accounts(0).to_string(), - upgrade_delay_blocks: 1, - } - .try_to_vec() - .unwrap(), - DEFAULT_GAS, - STORAGE_AMOUNT, - ) - .assert_success(); - (master_account, contract_account) -} - -#[test] -fn test_contract_upgrade() { - let (master_account, _contract_account) = init(); - master_account - .call( - accounts(0).to_string(), - "stage_upgrade", - &EVM_WASM_BYTES, - DEFAULT_GAS, - 0, - ) - .assert_success(); - master_account - .call( - accounts(0).to_string(), - "deploy_upgrade", - &[], - DEFAULT_GAS, - 0, - ) - .assert_success(); -}