diff --git a/.gitignore b/.gitignore index a0116955..03a62d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ **/*.rs.bk # Zombienet binaries **/scripts/zombienet/bin/* +**/bin/* .DS_Store # The cache for docker container dependency @@ -13,8 +14,13 @@ # The cache for chain data in container .local -# chopsticks DB -db.sqlite +# These are copies chopsticks db files +**/scripts/chopsticks/db/* +**db* + +# Node modules for EVM tools scripts +**/scripts/evm-tools/node_modules/ +**/scripts/evm-tools/package-lock.json # subalfred subalfred diff --git a/Cargo.lock b/Cargo.lock index 86a29434..1a9cab52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -536,7 +536,7 @@ dependencies = [ "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-lite 2.3.0", "slab", ] @@ -585,7 +585,7 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.5.0", + "polling 3.6.0", "rustix 0.38.32", "slab", "tracing", @@ -648,7 +648,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -677,13 +677,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -745,20 +745,20 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95d8e92cac0961e91dbd517496b00f7e9b92363dbe6d42c3198268323798860c" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line 0.21.0", "cc", @@ -860,13 +860,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.16", + "prettyplease 0.2.17", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1037,7 +1037,7 @@ dependencies = [ "async-channel 2.2.0", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", "futures-lite 2.3.0", "piper", @@ -1142,9 +1142,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2-sys" @@ -1313,9 +1313,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.3" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949626d00e063efc93b6dca932419ceb5432f99769911c0b995f7e884c778813" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -1335,14 +1335,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.3" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90239a040c80f5e14809ca132ddc4176ab33d5e17e49691793296e3fcb34d72f" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2117,7 +2117,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2455,7 +2455,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2473,9 +2473,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "635179be18797d7e10edb9cd06c859580237750c7351f39ed9b298bfc17544ad" +checksum = "ff4dc7287237dd438b926a81a1a5605dad33d286870e5eee2db17bf2bcd9e92a" dependencies = [ "cc", "cxxbridge-flags", @@ -2485,9 +2485,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9324397d262f63ef77eb795d900c0d682a34a43ac0932bec049ed73055d52f63" +checksum = "f47c6c8ad7c1a10d3ef0fe3ff6733f4db0d78f08ef0b13121543163ef327058b" dependencies = [ "cc", "codespan-reporting", @@ -2495,24 +2495,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "cxxbridge-flags" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a87ff7342ffaa54b7c61618e0ce2bbcf827eba6d55b923b83d82551acbbecfe5" +checksum = "701a1ac7a697e249cdd8dc026d7a7dafbfd0dbcd8bd24ec55889f2bc13dd6287" [[package]] name = "cxxbridge-macro" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b5b86cf65fa0626d85720619d80b288013477a91a0389fa8bc716bf4903ad1" +checksum = "b404f596046b0bb2d903a9c786b875a126261b52b7c3a64bbb66382c41c771df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2694,7 +2694,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2735,7 +2735,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.53", + "syn 2.0.55", "termcolor", "toml 0.8.2", "walkdir", @@ -2914,7 +2914,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2925,7 +2925,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3196,7 +3196,7 @@ dependencies = [ "prettier-please", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3222,9 +3222,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fatality" @@ -3738,7 +3738,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3865,7 +3865,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3877,7 +3877,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3887,7 +3887,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4062,7 +4062,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -4077,7 +4077,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4269,7 +4269,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -4678,9 +4678,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -5746,7 +5746,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5760,7 +5760,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5771,7 +5771,7 @@ checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5782,7 +5782,7 @@ checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -6694,7 +6694,7 @@ dependencies = [ "proc-macro-crate 2.0.2", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -6801,7 +6801,7 @@ dependencies = [ [[package]] name = "orml-benchmarking" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6821,7 +6821,7 @@ dependencies = [ [[package]] name = "orml-currencies" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6838,7 +6838,7 @@ dependencies = [ [[package]] name = "orml-nft" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6852,7 +6852,7 @@ dependencies = [ [[package]] name = "orml-oracle" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6870,7 +6870,7 @@ dependencies = [ [[package]] name = "orml-rewards" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6887,7 +6887,7 @@ dependencies = [ [[package]] name = "orml-tokens" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6904,7 +6904,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6924,7 +6924,7 @@ dependencies = [ [[package]] name = "orml-unknown-tokens" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6939,7 +6939,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "parity-scale-codec", @@ -6954,7 +6954,7 @@ dependencies = [ [[package]] name = "orml-xcm" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "frame-system", @@ -6968,7 +6968,7 @@ dependencies = [ [[package]] name = "orml-xcm-support" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "frame-support", "orml-traits", @@ -6982,7 +6982,7 @@ dependencies = [ [[package]] name = "orml-xtokens" version = "0.4.1-dev" -source = "git+https://github.com/chexware/open-runtime-module-library?branch=v-1.1.0#502c3272d0387f4b42ab6268b86f793c908af79f" +source = "git+https://github.com/bit-country/open-runtime-module-library?branch=v-1.1.0#77353e05d9c4f7012b9a89040e8c2253977c5e5a" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7357,7 +7357,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -7636,6 +7636,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "hex-literal", "libsecp256k1", "orml-currencies", "orml-tokens", @@ -8368,7 +8369,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -8879,7 +8880,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -8900,7 +8901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.5", + "indexmap 2.2.6", ] [[package]] @@ -8920,7 +8921,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -9046,7 +9047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -10278,12 +10279,13 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi 0.3.9", "pin-project-lite 0.2.13", "rustix 0.38.32", "tracing", @@ -10403,7 +10405,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" dependencies = [ "proc-macro2", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -10418,12 +10420,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -10508,7 +10510,7 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -10554,7 +10556,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -10780,9 +10782,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -10869,7 +10871,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -10886,9 +10888,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -11478,7 +11480,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -12438,7 +12440,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -12500,9 +12502,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef2175c2907e7c8bc0a9c3f86aeb5ec1f3b275300ad58a44d0c3ae379a5e52e" +checksum = "788745a868b0e751750388f4e6546eb921ef714a4317fa6954f7cde114eb2eb7" dependencies = [ "bitvec", "cfg-if", @@ -12514,9 +12516,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b8eb8fd61c5cdd3390d9b2132300a7e7618955b98b8416f118c1b4e144f" +checksum = "7dc2f4e8bc344b9fc3d5f74f72c2e55bfc38d28dc2ebc69c194a3df424e4d9ac" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -12731,7 +12733,7 @@ checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -13152,7 +13154,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -13391,7 +13393,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -13410,7 +13412,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -13627,7 +13629,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -13819,7 +13821,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14147,7 +14149,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14306,9 +14308,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -14367,7 +14369,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", + "fastrand 2.0.2", "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -14413,7 +14415,7 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14424,7 +14426,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14597,7 +14599,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14696,7 +14698,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -14709,7 +14711,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -14777,7 +14779,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -14821,7 +14823,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -15210,7 +15212,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -15244,7 +15246,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -16083,7 +16085,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -16135,7 +16137,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -16155,7 +16157,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e8644a61..db431f4a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -200,17 +200,17 @@ polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } # ORML -orml-currencies = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-rewards = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-tokens = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-traits = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-nft = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-unknown-tokens = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-xtokens = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-xcm = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-xcm-support = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-oracle = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } -orml-benchmarking = { git = "https://github.com/chexware/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-currencies = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-rewards = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-traits = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-nft = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-unknown-tokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-xtokens = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-xcm = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-xcm-support = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-oracle = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } +orml-benchmarking = { git = "https://github.com/bit-country/open-runtime-module-library", branch = "v-1.1.0", default-features = false } # EVM pallet-dynamic-fee = { git = "https://github.com/justinphamnz/frontier", branch = "polkadot-v1.1.0" } diff --git a/Makefile b/Makefile index 898fbe91..68144f7d 100644 --- a/Makefile +++ b/Makefile @@ -79,8 +79,8 @@ spawn-zombienet-basic: spawn-zombienet-metaverse: ./scripts/zombienet/zombienet.sh spawn_metaverse -.PHONY: spawn-zombienet-pioneeer -spawn-zombienet-meatverse: +.PHONY: spawn-zombienet-pioneer +spawn-zombienet-pioneer: ./scripts/zombienet/zombienet.sh spawn_pioneer .PHONY: install-chopsticks @@ -95,6 +95,10 @@ run-chopsticks-pioneer: run-chopsticks-pioneer-xcm: npx @acala-network/chopsticks xcm -r kusama -p statemine -p scripts/chopsticks/chopsticks_pioneer.yml +.PHONY: get-default-substrate-address +get-default-substrate-address: + cd ./scripts/evm-tools && npm i && node get_default_substrate_address.js $(EVM_ADDRESS) $(PREFIX) + .PHONY: check-missing-std-dependencies check-missing-std-dependencies: cargo install subalfred && ./scripts/subalfred-check.sh "benchmarking|frame-try-runtime|frame-std" diff --git a/modules/bridge/src/lib.rs b/modules/bridge/src/lib.rs index 7be8894e..e5fb94de 100644 --- a/modules/bridge/src/lib.rs +++ b/modules/bridge/src/lib.rs @@ -29,7 +29,7 @@ pub mod pallet { use frame_support::traits::{Currency, ExistenceRequirement, LockableCurrency, ReservableCurrency}; use frame_support::PalletId; use orml_traits::MultiCurrency; - use sp_arithmetic::traits::{Saturating, Zero}; + use sp_arithmetic::traits::Saturating; use sp_runtime::traits::AccountIdConversion; use sp_runtime::ModuleError; @@ -192,7 +192,7 @@ pub mod pallet { let bridge_id = T::PalletId::get().into_account_truncating(); ensure!(BridgeFee::::contains_key(&chain_id), Error::::FeeOptionsMissing); - let (min_fee, fee_scale) = Self::bridge_fee(chain_id); + let (min_fee, _fee_scale) = Self::bridge_fee(chain_id); let fee_estimated = currency_id.1 * amount; let fee = if fee_estimated > min_fee { @@ -201,7 +201,7 @@ pub mod pallet { min_fee }; - let mut actual_fee = fee; + let actual_fee = fee; if currency_id.0 == FungibleTokenId::NativeToken(0) { T::Currency::transfer( &source, diff --git a/node/src/chain_spec/continuum.rs b/node/src/chain_spec/continuum.rs index 525077ff..f898a7fb 100644 --- a/node/src/chain_spec/continuum.rs +++ b/node/src/chain_spec/continuum.rs @@ -246,6 +246,7 @@ fn continuum_genesis( phantom: Default::default(), }, treasury: Default::default(), + asset_manager: Default::default(), } } @@ -306,6 +307,7 @@ fn testnet_genesis( phantom: Default::default(), }, treasury: Default::default(), + asset_manager: Default::default(), } } diff --git a/node/src/chain_spec/metaverse.rs b/node/src/chain_spec/metaverse.rs index 79aa4015..af1f5001 100644 --- a/node/src/chain_spec/metaverse.rs +++ b/node/src/chain_spec/metaverse.rs @@ -1,3 +1,5 @@ +use cumulus_client_consensus_common::LevelLimit::Default as LevelLimitDefault; +use std::default; use std::str::FromStr; use hex_literal::hex; @@ -6,16 +8,19 @@ use sc_consensus_grandpa::AuthorityId as GrandpaId; use sc_service::{ChainType, Properties}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::crypto::UncheckedInto; -use sp_core::{sr25519, Pair, Public, H160, U256}; +use sp_core::{sp_std, sr25519, Pair, Public, H160, U256}; use sp_runtime::traits::{IdentifyAccount, Verify}; +use sp_std::default::Default; +use xcm::latest::Junctions; +use xcm::v3::{Junction, MultiLocation}; use metaverse_runtime::{ - constants::currency::*, opaque::SessionKeys, wasm_binary_unwrap, AccountId, AuraConfig, BalancesConfig, - BaseFeeConfig, CollatorSelectionConfig, DemocracyConfig, EVMConfig, EstateConfig, EthereumConfig, EvmChainIdConfig, - GenesisAccount, GenesisConfig, GrandpaConfig, MintingRateInfo, OracleMembershipConfig, SessionConfig, Signature, - SudoConfig, SystemConfig, + constants::currency::*, opaque::SessionKeys, wasm_binary_unwrap, AccountId, AssetManagerConfig, AuraConfig, + BalancesConfig, BaseFeeConfig, CollatorSelectionConfig, DemocracyConfig, EVMConfig, EstateConfig, EvmChainIdConfig, + EvmMappingConfig, GenesisAccount, GenesisConfig, GrandpaConfig, MintingRateInfo, OracleMembershipConfig, + SessionConfig, Signature, SudoConfig, SystemConfig, }; -use primitives::Balance; +use primitives::{AssetMetadata, Balance}; // The URL for the telemetry server. // const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; @@ -317,6 +322,59 @@ fn testnet_genesis( _marker: Default::default(), chain_id: 0x7fa, }, + evm_mapping: EvmMappingConfig { + _marker: Default::default(), + is_testnet_genesis: true, + }, + asset_manager: AssetManagerConfig { + _config: Default::default(), + assets_info: vec![ + ( + MultiLocation { + parents: 1u8, + interior: Junctions::Here, + }, + AssetMetadata { + name: "ROC".as_bytes().to_vec(), + symbol: "ROC".as_bytes().to_vec(), + decimals: 12, + minimal_balance: Default::default(), + }, + ), + ( + MultiLocation { + parents: 1u8, + interior: Junctions::X3( + Junction::Parachain(1000), + Junction::PalletInstance(58), + Junction::GeneralIndex(30), + ), + }, + AssetMetadata { + name: "DED".as_bytes().to_vec(), + symbol: "DED".as_bytes().to_vec(), + decimals: 10, + minimal_balance: Default::default(), + }, + ), + ( + MultiLocation { + parents: 1u8, + interior: Junctions::X3( + Junction::Parachain(1000), + Junction::PalletInstance(58), + Junction::GeneralIndex(23), + ), + }, + AssetMetadata { + name: "PINK".as_bytes().to_vec(), + symbol: "PINK".as_bytes().to_vec(), + decimals: 10, + minimal_balance: Default::default(), + }, + ), + ], + }, } } diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 331840ae..d9ca84ac 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -1,8 +1,6 @@ use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use serde::{Deserialize, Serialize}; -#[cfg(feature = "with-metaverse-runtime")] -pub use metaverse::*; #[cfg(feature = "with-pioneer-runtime")] pub use pioneer::*; diff --git a/node/src/chain_spec/pioneer.rs b/node/src/chain_spec/pioneer.rs index a512beae..995c5268 100644 --- a/node/src/chain_spec/pioneer.rs +++ b/node/src/chain_spec/pioneer.rs @@ -13,13 +13,14 @@ use sp_runtime::{ traits::{IdentifyAccount, Verify}, Perbill, }; +use xcm::latest::{Junction, Junctions, MultiLocation}; use metaverse_runtime::MintingRateInfo; use pioneer_runtime::{ - constants::currency::*, AccountId, AuraConfig, BalancesConfig, EstateConfig, GenesisConfig, OracleMembershipConfig, - SessionKeys, Signature, SudoConfig, SystemConfig, EXISTENTIAL_DEPOSIT, WASM_BINARY, + constants::currency::*, AccountId, AssetManagerConfig, AuraConfig, BalancesConfig, EstateConfig, GenesisConfig, + OracleMembershipConfig, SessionKeys, Signature, SudoConfig, SystemConfig, EXISTENTIAL_DEPOSIT, WASM_BINARY, }; -use primitives::Balance; +use primitives::{AssetMetadata, Balance}; use crate::chain_spec::Extensions; @@ -248,6 +249,7 @@ fn pioneer_genesis( phantom: Default::default(), }, treasury: Default::default(), + asset_manager: Default::default(), } } @@ -307,6 +309,55 @@ fn testnet_genesis( phantom: Default::default(), }, treasury: Default::default(), + asset_manager: AssetManagerConfig { + _config: Default::default(), + assets_info: vec![ + ( + MultiLocation { + parents: 1u8, + interior: Junctions::Here, + }, + AssetMetadata { + name: "KSM".as_bytes().to_vec(), + symbol: "KSM".as_bytes().to_vec(), + decimals: 12, + minimal_balance: Default::default(), + }, + ), + ( + MultiLocation { + parents: 1u8, + interior: Junctions::X3( + Junction::Parachain(1000), + Junction::PalletInstance(58), + Junction::GeneralIndex(30), + ), + }, + AssetMetadata { + name: "DED".as_bytes().to_vec(), + symbol: "DED".as_bytes().to_vec(), + decimals: 10, + minimal_balance: Default::default(), + }, + ), + ( + MultiLocation { + parents: 1u8, + interior: Junctions::X3( + Junction::Parachain(1000), + Junction::PalletInstance(58), + Junction::GeneralIndex(23), + ), + }, + AssetMetadata { + name: "PINK".as_bytes().to_vec(), + symbol: "PINK".as_bytes().to_vec(), + decimals: 10, + minimal_balance: Default::default(), + }, + ), + ], + }, } } diff --git a/node/src/command.rs b/node/src/command.rs index 801ee225..69564368 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -19,7 +19,7 @@ use std::{io::Write, net::SocketAddr}; use codec::Encode; use cumulus_client_cli::generate_genesis_block; -use cumulus_primitives_core::ParaId; + use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; use sc_cli::{ @@ -29,8 +29,10 @@ use sc_cli::{ use sc_service::config::{BasePath, PrometheusConfig}; use sc_service::PartialComponents; use sp_core::hexdisplay::HexDisplay; -use sp_runtime::traits::AccountIdConversion; -use sp_runtime::traits::Block as BlockT; + +use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; + +use cumulus_primitives_core::ParaId; use frame_benchmarking::benchmarking::HostFunctions; diff --git a/node/src/rpc/rpc_metaverse.rs b/node/src/rpc/rpc_metaverse.rs index cc813be2..7f90f718 100644 --- a/node/src/rpc/rpc_metaverse.rs +++ b/node/src/rpc/rpc_metaverse.rs @@ -1,15 +1,11 @@ //! RPCs implementation. use cumulus_primitives_parachain_inherent::ParachainInherentData; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; -use std::collections::BTreeMap; + use std::sync::Arc; -use fc_rpc::{ - pending::ConsensusDataProvider, EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, - SchemaV2Override, SchemaV3Override, StorageOverride, -}; +use fc_rpc::{pending::ConsensusDataProvider, EthBlockDataCacheTask, OverrideHandle}; use fc_rpc_core::types::{FeeHistoryCache, FilterPool}; -use fp_storage::EthereumStorageSchema; use jsonrpsee::RpcModule; use pallet_transaction_payment_rpc; @@ -145,7 +141,7 @@ where fee_history_limit, overrides, block_data_cache, - enable_evm_rpc, + enable_evm_rpc: _, } = deps; io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())?; diff --git a/node/src/service.rs b/node/src/service.rs index 3ab7752e..6f187504 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -10,7 +10,7 @@ pub use continuum::{ ParachainRuntimeExecutor as ContinuumParachainRuntimeExecutor, }; #[cfg(feature = "with-metaverse-runtime")] -pub use metaverse::{new_full, new_partial, ExecutorDispatch}; +pub use metaverse::{new_full, new_partial}; #[cfg(feature = "with-pioneer-runtime")] pub use pioneer::{ // new_full as pioneer_full, new_light as pioneer_light, diff --git a/node/src/service/metaverse.rs b/node/src/service/metaverse.rs index 1e8bfb6e..7fb26add 100644 --- a/node/src/service/metaverse.rs +++ b/node/src/service/metaverse.rs @@ -176,13 +176,13 @@ fn remote_keystore(_url: &String) -> Result, &'static str> { } /// Builds a new service for a full client. -pub fn new_full(mut config: Configuration, cli: &Cli) -> Result { +pub fn new_full(config: Configuration, cli: &Cli) -> Result { let sc_service::PartialComponents { client, backend, mut task_manager, import_queue, - mut keystore_container, + keystore_container, select_chain, transaction_pool, other: (block_import, grandpa_link, mut telemetry, frontier_backend), @@ -193,7 +193,7 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result = <::Currency as Currency< = StorageMap<_, Twox64Concat, AssetIds, AssetMetadata>, OptionQuery>; + #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + pub assets_info: Vec<(MultiLocation, AssetMetadata>)>, + pub _config: PhantomData, + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + for asset_info in self.assets_info.iter() { + Pallet::::do_register_foreign_asset(&asset_info.0, &asset_info.1); + } + } + } #[pallet::pallet] #[pallet::without_storage_info] pub struct Pallet(_); diff --git a/pallets/auction/src/lib.rs b/pallets/auction/src/lib.rs index e8d31b61..c49d9b7a 100644 --- a/pallets/auction/src/lib.rs +++ b/pallets/auction/src/lib.rs @@ -41,7 +41,7 @@ use auction_manager::{ }; use core_primitives::UndeployedLandBlocksTrait; pub use pallet::*; -use pallet_nft::Pallet as NFTModule; + use primitives::{continuum::MapTrait, estate::Estate, AuctionId, ItemId, NftOffer}; pub use weights::WeightInfo; @@ -1199,7 +1199,7 @@ pub mod pallet { } >::try_mutate_exists(id, |auction| -> DispatchResult { - let mut auction = auction.as_mut().ok_or(Error::::AuctionDoesNotExist)?; + let auction = auction.as_mut().ok_or(Error::::AuctionDoesNotExist)?; let block_number = >::block_number(); @@ -1276,7 +1276,7 @@ pub mod pallet { ensure!(!new_bid_price.is_zero(), Error::::InvalidBidPrice); >::try_mutate_exists(id, |auction_item| -> DispatchResult { - let mut auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; + let auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; let last_bid_price = last_bid.clone().map_or(Zero::zero(), |(_, price)| price); // get last bid price let last_bidder = last_bid.as_ref().map(|(who, _)| who); @@ -1885,7 +1885,7 @@ pub mod pallet { ensure!(!new_bid_price.is_zero(), Error::::InvalidBidPrice); >::try_mutate_exists(id, |auction_item| -> DispatchResult { - let mut auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; + let auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; let last_bid_price = last_bid.clone().map_or(Zero::zero(), |(_, price)| price); // get last bid price let last_bidder = last_bid.as_ref().map(|(who, _)| who); @@ -1939,7 +1939,7 @@ pub mod pallet { fn extend_auction_end_time(id: AuctionId, new_end_block: BlockNumberFor) -> DispatchResult { >::try_mutate_exists(id, |auction_item| -> DispatchResult { - let mut auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; + let auction_item = auction_item.as_mut().ok_or(Error::::AuctionDoesNotExist)?; auction_item.end_time = new_end_block; Ok(()) }) diff --git a/pallets/auction/src/mock.rs b/pallets/auction/src/mock.rs index c9a1cca1..1964d3da 100644 --- a/pallets/auction/src/mock.rs +++ b/pallets/auction/src/mock.rs @@ -8,7 +8,7 @@ use orml_traits::parameter_type_with_key; use sp_core::crypto::AccountId32; use sp_core::{ConstU128, H256}; use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, IdentifyAccount, Verify}; -use sp_runtime::{testing::Header, traits::IdentityLookup, MultiSignature, Perbill}; +use sp_runtime::{traits::IdentityLookup, MultiSignature, Perbill}; use auction_manager::{CheckAuctionItemHandler, ListingLevel}; use core_primitives::{MetaverseInfo, MetaverseMetadata, MetaverseTrait, NftAssetData, NftClassData}; diff --git a/pallets/auction/src/tests.rs b/pallets/auction/src/tests.rs index 9a0616e6..774e3c6e 100644 --- a/pallets/auction/src/tests.rs +++ b/pallets/auction/src/tests.rs @@ -19,13 +19,9 @@ pub const GENERAL_METAVERSE_FUND: AccountId = AccountId32::new([102; 32]); fn init_test_nft(owner: RuntimeOrigin) { //Create group collection before class - assert_ok!(NFTModule::::create_group( - RuntimeOrigin::root(), - vec![1], - vec![1] - )); + assert_ok!(NFTModule::create_group(RuntimeOrigin::root(), vec![1], vec![1])); - assert_ok!(NFTModule::::create_class( + assert_ok!(NFTModule::create_class( owner.clone(), vec![1], test_attributes(1), @@ -36,24 +32,14 @@ fn init_test_nft(owner: RuntimeOrigin) { None )); - assert_ok!(NFTModule::::mint( - owner.clone(), - CLASS_ID, - vec![1], - test_attributes(1), - 1 - )); + assert_ok!(NFTModule::mint(owner.clone(), CLASS_ID, vec![1], test_attributes(1), 1)); } fn init_test_stackable_nft(owner: RuntimeOrigin) { //Create group collection before class - assert_ok!(NFTModule::::create_group( - RuntimeOrigin::root(), - vec![1], - vec![1] - )); + assert_ok!(NFTModule::create_group(RuntimeOrigin::root(), vec![1], vec![1])); - assert_ok!(NFTModule::::create_class( + assert_ok!(NFTModule::create_class( owner.clone(), vec![1], test_attributes(1), @@ -64,7 +50,7 @@ fn init_test_stackable_nft(owner: RuntimeOrigin) { None )); - assert_ok!(NFTModule::::mint_stackable_nft( + assert_ok!(NFTModule::mint_stackable_nft( owner.clone(), CLASS_ID, vec![1], @@ -229,10 +215,7 @@ fn create_new_stackable_nft_auction_work() { let origin = RuntimeOrigin::signed(ALICE); init_test_stackable_nft(origin.clone()); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&ALICE, &(0, 0)), - 100u128 - ); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&ALICE, &(0, 0)), 100u128); assert_ok!(AuctionModule::create_auction( AuctionType::Auction, @@ -259,11 +242,8 @@ fn create_new_stackable_nft_auction_work() { Some(true) ); assert_eq!(Balances::free_balance(ALICE), 99995); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&ALICE, &(0, 0)), - 50u128 - ); - let is_transferable = NFTModule::::is_transferable(&(0, 0)); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&ALICE, &(0, 0)), 50u128); + let is_transferable = NFTModule::is_transferable(&(0, 0)); assert_eq!(is_transferable, Ok(false)); }); } @@ -400,10 +380,7 @@ fn create_new_stackable_nft_buy_now_work() { let origin = RuntimeOrigin::signed(ALICE); init_test_stackable_nft(origin.clone()); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&ALICE, &(0, 0)), - 100u128 - ); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&ALICE, &(0, 0)), 100u128); assert_ok!(AuctionModule::create_auction( AuctionType::BuyNow, @@ -431,11 +408,8 @@ fn create_new_stackable_nft_buy_now_work() { Some(true) ); assert_eq!(Balances::free_balance(ALICE), 99995); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&ALICE, &(0, 0)), - 70u128 - ); - let is_transferable = NFTModule::::is_transferable(&(0, 0)); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&ALICE, &(0, 0)), 70u128); + let is_transferable = NFTModule::is_transferable(&(0, 0)); assert_eq!(is_transferable, Ok(false)); }); } @@ -446,13 +420,9 @@ fn create_auction_fail() { ExtBuilder::default().build().execute_with(|| { let owner = RuntimeOrigin::signed(ALICE); - assert_ok!(NFTModule::::create_group( - RuntimeOrigin::root(), - vec![1], - vec![1] - )); + assert_ok!(NFTModule::create_group(RuntimeOrigin::root(), vec![1], vec![1])); - assert_ok!(NFTModule::::create_class( + assert_ok!(NFTModule::create_class( owner.clone(), vec![1], Default::default(), @@ -463,13 +433,7 @@ fn create_auction_fail() { None )); - assert_ok!(NFTModule::::mint( - owner.clone(), - CLASS_ID, - vec![1], - Default::default(), - 1 - )); + assert_ok!(NFTModule::mint(owner.clone(), CLASS_ID, vec![1], Default::default(), 1)); //account does not have permission to create auction assert_noop!( AuctionModule::create_auction( @@ -486,7 +450,7 @@ fn create_auction_fail() { Error::::NoPermissionToCreateAuction ); - assert_ok!(NFTModule::::create_class( + assert_ok!(NFTModule::create_class( owner.clone(), vec![1], Default::default(), @@ -497,13 +461,7 @@ fn create_auction_fail() { None )); - assert_ok!(NFTModule::::mint( - owner.clone(), - 1, - vec![1], - Default::default(), - 1 - )); + assert_ok!(NFTModule::mint(owner.clone(), 1, vec![1], Default::default(), 1)); //Class is BoundToAddress assert_noop!( @@ -1025,7 +983,7 @@ fn asset_transfers_after_auction() { // Setup NFT and verify that BOB has ownership init_test_nft(owner.clone()); - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(true)); assert_ok!(AuctionModule::create_auction( AuctionType::Auction, @@ -1062,8 +1020,8 @@ fn asset_transfers_after_auction() { assert_eq!(Balances::free_balance(ALICE), 99799); // Verify Alice has the NFT and Bob doesn't - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(false)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(false)); }); } @@ -1079,7 +1037,7 @@ fn asset_transfers_after_multicurrency_auction() { // Setup NFT and verify that BOB has ownership init_test_nft(owner.clone()); - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(true)); assert_ok!(AuctionModule::create_auction( AuctionType::Auction, @@ -1114,8 +1072,8 @@ fn asset_transfers_after_multicurrency_auction() { assert_eq!(Tokens::accounts(ALICE, FungibleTokenId::MiningResource(0)).free, 9800); // Verify Alice has the NFT and Bob doesn't - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(false)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(false)); }); } @@ -1173,13 +1131,7 @@ fn buy_now_work() { // buy now successful assert_ok!(AuctionModule::buy_now(buyer.clone(), 0, 200)); - assert_ok!(NFTModule::::mint( - owner.clone(), - CLASS_ID, - vec![1], - Default::default(), - 1 - )); + assert_ok!(NFTModule::mint(owner.clone(), CLASS_ID, vec![1], Default::default(), 1)); assert_ok!(AuctionModule::create_auction( AuctionType::BuyNow, @@ -1197,8 +1149,8 @@ fn buy_now_work() { assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 1)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 1)), Ok(true)); // check balances were transferred assert_eq!(Balances::free_balance(ALICE), 99600); @@ -1247,7 +1199,7 @@ fn multicurrency_buy_now_work() { assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); // check balances were transferred assert_eq!(Tokens::accounts(BOB, FungibleTokenId::MiningResource(0)).free, 5196); @@ -1300,9 +1252,9 @@ fn buy_now_with_bundle_should_work() { assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 1)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 2)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 1)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 2)), Ok(true)); // check balances were transferred assert_eq!(Balances::free_balance(ALICE), 99800); @@ -1358,9 +1310,9 @@ fn multicurrency_buy_now_with_bundle_should_work() { assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 1)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 2)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 1)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 2)), Ok(true)); // check balances were transferred assert_eq!(Tokens::accounts(BOB, FungibleTokenId::MiningResource(0)).free, 5195); @@ -1387,10 +1339,7 @@ fn buy_now_stackable_nft_work() { init_test_stackable_nft(owner.clone()); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&BOB, &(0, 0)), - 100u128 - ); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&BOB, &(0, 0)), 100u128); // call create_auction assert_ok!(AuctionModule::create_auction( @@ -1404,22 +1353,13 @@ fn buy_now_stackable_nft_work() { Perbill::from_percent(0u32), FungibleTokenId::NativeToken(0) )); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&BOB, &(0, 0)), - 70u128 - ); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&BOB, &(0, 0)), 70u128); assert_ok!(AuctionModule::buy_now(buyer.clone(), 0, 200)); //assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&ALICE, &(0, 0)), - 30u128 - ); - assert_eq!( - NFTModule::::get_free_stackable_nft_balance(&BOB, &(0, 0)), - 70u128 - ); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&ALICE, &(0, 0)), 30u128); + assert_eq!(NFTModule::get_free_stackable_nft_balance(&BOB, &(0, 0)), 70u128); // check balances were transferred assert_eq!(Balances::free_balance(ALICE), 99800); @@ -1440,7 +1380,7 @@ fn buy_now_stackable_nft_work() { AuctionModule::buy_now(buyer.clone(), 1, 150), Error::::AuctionDoesNotExist ); - let is_transferable = NFTModule::::is_transferable(&(0, 0)); + let is_transferable = NFTModule::is_transferable(&(0, 0)); assert_eq!(is_transferable, Ok(false)); }); } @@ -1599,7 +1539,7 @@ fn on_finalize_should_work() { run_to_block(102); assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&ALICE, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&ALICE, &(0, 0)), Ok(true)); // check balances were transferred assert_eq!(Balances::free_balance(ALICE), 99899); // BOB's initial balance is 500 @@ -1643,7 +1583,7 @@ fn on_finalize_with_listing_fee_should_work() { run_to_block(102); assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(true)); // check balances were transferred // Bob bid 100 for item, his new balance will be 500 - 100 - 1 assert_eq!(Balances::free_balance(BOB), 399); @@ -1742,8 +1682,8 @@ fn on_finalize_with_bundle_with_listing_fee_should_work() { run_to_block(102); assert_eq!(AuctionModule::auctions(0), None); // check account received asset - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 0)), Ok(true)); - assert_eq!(NFTModule::::check_ownership(&BOB, &(0, 1)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 0)), Ok(true)); + assert_eq!(NFTModule::check_ownership(&BOB, &(0, 1)), Ok(true)); // check balances were transferred // Bob bid 400 for item, his new balance will be 500 - 400 assert_eq!(Balances::free_balance(BOB), 99); diff --git a/pallets/continuum/src/lib.rs b/pallets/continuum/src/lib.rs index 7f73bbdc..023aa5e1 100644 --- a/pallets/continuum/src/lib.rs +++ b/pallets/continuum/src/lib.rs @@ -46,7 +46,6 @@ use codec::{Decode, Encode}; use frame_support::{ - dispatch::DispatchResult, ensure, traits::ExistenceRequirement, traits::{Currency, Get, LockableCurrency, ReservableCurrency}, @@ -528,7 +527,7 @@ impl MapTrait for Pallet { let treasury = Self::account_id(); ensure!(from == treasury, Error::::NoPermission); - let mut spot = maybe_spot.as_mut().ok_or(Error::::MapSpotNotFound)?; + let spot = maybe_spot.as_mut().ok_or(Error::::MapSpotNotFound)?; spot.owner = to.clone().0; spot.metaverse_id = Some(to.1); diff --git a/pallets/continuum/src/mock.rs b/pallets/continuum/src/mock.rs index 6d3b4288..e211281e 100644 --- a/pallets/continuum/src/mock.rs +++ b/pallets/continuum/src/mock.rs @@ -17,11 +17,11 @@ #![cfg(test)] -use frame_support::pallet_prelude::{BuildGenesisConfig, Hooks}; +use frame_support::pallet_prelude::{DispatchResult, Hooks}; use frame_support::{construct_runtime, ord_parameter_types, parameter_types, PalletId}; use frame_system::EnsureSignedBy; use sp_core::H256; -use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill}; +use sp_runtime::{traits::IdentityLookup, Perbill}; use auction_manager::{Auction, AuctionInfo, AuctionItem, CheckAuctionItemHandler, ListingLevel}; use core_primitives::{MetaverseInfo, MetaverseMetadata, MetaverseTrait}; diff --git a/pallets/economy/src/lib.rs b/pallets/economy/src/lib.rs index 626e7389..d16226a9 100644 --- a/pallets/economy/src/lib.rs +++ b/pallets/economy/src/lib.rs @@ -18,7 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Encode, HasCompact}; -use frame_support::traits::ExistenceRequirement; + use frame_support::{ ensure, pallet_prelude::*, @@ -33,16 +33,16 @@ use sp_runtime::traits::{ }; use sp_runtime::{ traits::{AccountIdConversion, One, Zero}, - ArithmeticError, DispatchError, FixedPointNumber, Perbill, SaturatedConversion, + ArithmeticError, DispatchError, Perbill, SaturatedConversion, }; use sp_std::{collections::btree_map::BTreeMap, prelude::*, vec::Vec}; use core_primitives::NFTTrait; use core_primitives::*; pub use pallet::*; -use primitives::bounded::Rate; -use primitives::{estate::Estate, EraIndex, EstateId, PoolId, StakingRound}; -use primitives::{Balance, ClassId, DomainId, FungibleTokenId, PowerAmount, RoundIndex}; + +use primitives::{estate::Estate, EraIndex, EstateId}; +use primitives::{Balance, DomainId, FungibleTokenId, PowerAmount, RoundIndex}; pub use weights::WeightInfo; /// The Reward Pool Info. @@ -81,8 +81,7 @@ pub mod pallet { use sp_runtime::traits::{CheckedAdd, CheckedSub, Saturating}; use sp_runtime::ArithmeticError; - use primitives::bounded::{FractionalRate, Rate}; - use primitives::{staking::Bond, ClassId, CurrencyId, NftId, PoolId}; + use primitives::{staking::Bond, ClassId, NftId}; use super::*; @@ -1073,7 +1072,7 @@ impl Pallet { ) } - fn do_burn(who: &T::AccountId, amount: Balance) -> DispatchResult { + fn do_burn(_who: &T::AccountId, amount: Balance) -> DispatchResult { if amount.is_zero() { return Ok(()); } diff --git a/pallets/economy/src/mock.rs b/pallets/economy/src/mock.rs index ad25c1fa..7205c487 100644 --- a/pallets/economy/src/mock.rs +++ b/pallets/economy/src/mock.rs @@ -8,12 +8,13 @@ use orml_traits::parameter_type_with_key; use sp_core::crypto::AccountId32; use sp_core::{ConstU128, H256}; use sp_runtime::traits::{BlakeTwo256, IdentifyAccount, Verify}; -use sp_runtime::{testing::Header, traits::IdentityLookup, MultiSignature, Perbill}; +use sp_runtime::{traits::IdentityLookup, MultiSignature, Perbill}; use auction_manager::*; use core_primitives::NftAssetData; use primitives::estate::Estate; use primitives::staking::MetaverseStakingTrait; +use primitives::ClassId; use primitives::{Amount, AuctionId, EstateId, FungibleTokenId, ItemId, UndeployedLandBlockId}; use sp_runtime::BuildStorage; diff --git a/pallets/economy/src/tests.rs b/pallets/economy/src/tests.rs index 9100d852..28a7ea71 100644 --- a/pallets/economy/src/tests.rs +++ b/pallets/economy/src/tests.rs @@ -19,12 +19,13 @@ use frame_support::{assert_noop, assert_ok}; -use sp_runtime::traits::{AccountIdConversion, BadOrigin}; +use sp_runtime::traits::AccountIdConversion; use sp_std::default::Default; use core_primitives::{Attributes, CollectionType, TokenType}; use mock::{RuntimeEvent, *}; use primitives::staking::Bond; +use primitives::ClassId; use primitives::GroupCollectionId; use super::*; diff --git a/pallets/evm-mapping/Cargo.toml b/pallets/evm-mapping/Cargo.toml index cf2d0cbd..53839644 100644 --- a/pallets/evm-mapping/Cargo.toml +++ b/pallets/evm-mapping/Cargo.toml @@ -9,6 +9,7 @@ serde = { workspace = true, optional = true } codec = { workspace = true, package = "parity-scale-codec" } libsecp256k1 = { workspace = true, optional = true } scale-info = { workspace = true } +hex-literal = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } diff --git a/pallets/evm-mapping/src/lib.rs b/pallets/evm-mapping/src/lib.rs index 673206e1..a9810c00 100644 --- a/pallets/evm-mapping/src/lib.rs +++ b/pallets/evm-mapping/src/lib.rs @@ -35,6 +35,7 @@ use frame_support::{ transactional, }; use frame_system::{ensure_signed, pallet_prelude::*}; +use hex_literal::hex; use orml_traits::currency::TransferAll; pub use pallet::*; use primitives::{AccountIndex, EvmAddress}; @@ -107,6 +108,7 @@ pub trait AddressMapping { #[frame_support::pallet] pub mod pallet { use super::*; + use sp_core::H160; pub(crate) type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; @@ -180,6 +182,44 @@ pub mod pallet { #[pallet::getter(fn evm_addresses)] pub type EvmAddresses = StorageMap<_, Twox64Concat, T::AccountId, EvmAddress, OptionQuery>; + #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + pub is_testnet_genesis: bool, + pub _marker: PhantomData, + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + if (self.is_testnet_genesis) { + // Add EVM address mapping for 5EMjsd14hMBsWVvC7bBaSC7FZQYxw1jQcZHA3Vho3pwtcbfM + let alice_evm = H160::from_slice(&hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558")); + let alice_substrate = T::AddressMapping::get_account_id(&alice_evm); + + >::insert(alice_evm, &alice_substrate); + >::insert(&alice_substrate, alice_evm); + + >::deposit_event(Event::ClaimAccount { + account_id: alice_substrate, + evm_address: alice_evm, + }); + + // Add EVM address for metamask test account 5EMjsczhnpcwi7AcfreSB9vdvHzbcF4EBHNYjFNwooaQ9U2W + let test_account_evm = H160::from_slice(&hex_literal::hex!("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b")); + let test_account_substrate = T::AddressMapping::get_account_id(&test_account_evm); + + >::insert(test_account_evm, &test_account_substrate); + >::insert(&test_account_substrate, test_account_evm); + + >::deposit_event(Event::ClaimAccount { + account_id: test_account_substrate, + evm_address: test_account_evm, + }); + } + } + } + #[pallet::pallet] pub struct Pallet(_); diff --git a/pallets/evm-mapping/src/mock.rs b/pallets/evm-mapping/src/mock.rs index dbc84cfd..48bb2d06 100644 --- a/pallets/evm-mapping/src/mock.rs +++ b/pallets/evm-mapping/src/mock.rs @@ -19,23 +19,17 @@ #![cfg(test)] -use codec::Encode; -use frame_support::traits::{ConstU32, EqualPrivilegeOnly, Everything, Nothing}; -use frame_support::{construct_runtime, ord_parameter_types, parameter_types}; -use frame_support::{pallet_prelude::Hooks, weights::Weight, PalletId}; -use frame_system::{EnsureRoot, EnsureSignedBy}; +use frame_support::traits::Nothing; +use frame_support::PalletId; +use frame_support::{construct_runtime, parameter_types}; + use orml_traits::parameter_type_with_key; -use scale_info::TypeInfo; + use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{AccountIdConversion, BlakeTwo256, Hash, IdentityLookup}, - DispatchError, -}; +use sp_runtime::traits::{AccountIdConversion, IdentityLookup}; use primitives::{Amount, Balance, FungibleTokenId}; -use crate as evm_account; use crate::mock::secp_utils::eth; use sp_runtime::BuildStorage; diff --git a/pallets/evm-mapping/src/tests.rs b/pallets/evm-mapping/src/tests.rs index 8f2e06a1..816d34cf 100644 --- a/pallets/evm-mapping/src/tests.rs +++ b/pallets/evm-mapping/src/tests.rs @@ -19,13 +19,9 @@ #![cfg(test)] -use std::str::FromStr; +use frame_support::assert_ok; -use frame_support::{assert_noop, assert_ok}; - -use mock::{ - alice, bob, secp_utils::*, EVMMapping, ExtBuilder, Runtime, RuntimeEvent, RuntimeOrigin, System, ALICE, BOB, -}; +use mock::{alice, secp_utils::*, EVMMapping, ExtBuilder, Runtime, RuntimeEvent, RuntimeOrigin, System, ALICE}; use super::*; diff --git a/pallets/governance/src/mock.rs b/pallets/governance/src/mock.rs index c291c3c8..0aa998f7 100644 --- a/pallets/governance/src/mock.rs +++ b/pallets/governance/src/mock.rs @@ -9,7 +9,6 @@ use orml_traits::parameter_type_with_key; use scale_info::TypeInfo; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{AccountIdConversion, BlakeTwo256, Hash, IdentityLookup}, DispatchError, Perbill, }; diff --git a/pallets/mining/src/lib.rs b/pallets/mining/src/lib.rs index 428927a9..73fb7034 100644 --- a/pallets/mining/src/lib.rs +++ b/pallets/mining/src/lib.rs @@ -31,10 +31,7 @@ use frame_system::pallet_prelude::*; use frame_system::{self as system, ensure_signed}; use orml_traits::{BasicCurrency, LockIdentifier, MultiCurrency, MultiCurrencyExtended}; use scale_info::TypeInfo; -use sp_runtime::{ - traits::{AccountIdConversion, Zero}, - DispatchError, -}; +use sp_runtime::traits::{AccountIdConversion, Zero}; use sp_std::vec::Vec; use core_primitives::*; diff --git a/pallets/mining/src/mock.rs b/pallets/mining/src/mock.rs index 576ff876..a27be887 100644 --- a/pallets/mining/src/mock.rs +++ b/pallets/mining/src/mock.rs @@ -1,5 +1,3 @@ -use frame_support::pallet_prelude::BuildGenesisConfig; - use frame_support::traits::Nothing; use frame_support::{construct_runtime, ord_parameter_types, parameter_types}; use frame_system::EnsureSignedBy; @@ -7,7 +5,6 @@ use orml_traits::parameter_type_with_key; use sp_core::H256; use sp_runtime::BuildStorage; use sp_runtime::{ - testing::Header, traits::{AccountIdConversion, IdentityLookup}, Perbill, }; diff --git a/pallets/reward/src/lib.rs b/pallets/reward/src/lib.rs index c5382800..dcf9aa66 100644 --- a/pallets/reward/src/lib.rs +++ b/pallets/reward/src/lib.rs @@ -30,7 +30,7 @@ use frame_system::{ensure_signed, pallet_prelude::*}; use orml_traits::{DataProvider, MultiCurrency, MultiReservableCurrency}; use sp_core::Encode as SPEncode; use sp_io::hashing::keccak_256; -use sp_runtime::traits::{Hash as Hasher, Saturating}; +use sp_runtime::traits::Hash as Hasher; use sp_runtime::{ traits::{AccountIdConversion, Zero}, DispatchError, Perbill, SaturatedConversion, @@ -476,7 +476,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!(campaign.end < now, Error::::CampaignStillActive); @@ -527,7 +527,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!(campaign.end < now, Error::::CampaignStillActive); @@ -586,7 +586,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!(campaign.end < now, Error::::CampaignStillActive); @@ -650,7 +650,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!(campaign.end < now, Error::::CampaignStillActive); @@ -724,7 +724,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!( campaign.end.saturating_add(campaign.cooling_off_duration) >= now, @@ -778,7 +778,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!( campaign.end.saturating_add(campaign.cooling_off_duration) >= now, @@ -840,7 +840,7 @@ pub mod pallet { let now = frame_system::Pallet::::block_number(); >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!( campaign.end.saturating_add(campaign.cooling_off_duration) >= now, @@ -905,7 +905,7 @@ pub mod pallet { )?; >::try_mutate_exists(id, |campaign| -> DispatchResult { - let mut campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; + let campaign = campaign.as_mut().ok_or(Error::::CampaignIsNotFound)?; ensure!( campaign.end.saturating_add(campaign.cooling_off_duration) >= now, diff --git a/pallets/reward/src/mock.rs b/pallets/reward/src/mock.rs index d78caa52..d0fed1dd 100644 --- a/pallets/reward/src/mock.rs +++ b/pallets/reward/src/mock.rs @@ -8,7 +8,7 @@ use orml_traits::parameter_type_with_key; use sp_core::crypto::AccountId32; use sp_core::{ConstU128, H256}; use sp_runtime::traits::{BlakeTwo256, IdentifyAccount, Verify}; -use sp_runtime::{testing::Header, traits::IdentityLookup, MultiSignature, Perbill}; +use sp_runtime::{traits::IdentityLookup, MultiSignature, Perbill}; use auction_manager::*; use core_primitives::NftAssetData; diff --git a/primitives/metaverse/src/lib.rs b/primitives/metaverse/src/lib.rs index 9df7a248..f07cc639 100644 --- a/primitives/metaverse/src/lib.rs +++ b/primitives/metaverse/src/lib.rs @@ -19,7 +19,6 @@ use codec::{Decode, Encode, HasCompact, MaxEncodedLen}; use scale_info::TypeInfo; -//#[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_runtime::traits::AtLeast32Bit; use sp_runtime::RuntimeDebug; @@ -393,7 +392,7 @@ impl Default for TokenSymbol { } } -#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, TypeInfo)] +#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, TypeInfo, Serialize, Deserialize)] pub struct AssetMetadata { pub name: Vec, pub symbol: Vec, diff --git a/runtime/common/src/currencies.rs b/runtime/common/src/currencies.rs index 3db4b6dc..35a345c7 100644 --- a/runtime/common/src/currencies.rs +++ b/runtime/common/src/currencies.rs @@ -113,7 +113,7 @@ where })) } - fn is_precompile(&self, _address: H160, remaining_gas: u64) -> IsPrecompileResult { + fn is_precompile(&self, _address: H160, _remaining_gas: u64) -> IsPrecompileResult { todo!() } } diff --git a/runtime/common/src/nft.rs b/runtime/common/src/nft.rs index 191b03c7..bd00c16b 100644 --- a/runtime/common/src/nft.rs +++ b/runtime/common/src/nft.rs @@ -118,7 +118,7 @@ where Some(result) } - fn is_precompile(&self, _address: H160, remaining_gas: u64) -> IsPrecompileResult { + fn is_precompile(&self, _address: H160, _remaining_gas: u64) -> IsPrecompileResult { todo!() } } diff --git a/runtime/continuum/src/constants.rs b/runtime/continuum/src/constants.rs index 7a903b84..0cb4e296 100644 --- a/runtime/continuum/src/constants.rs +++ b/runtime/continuum/src/constants.rs @@ -19,11 +19,11 @@ pub mod currency { /// Time. pub mod time { - use frame_support::weights::constants::{ExtrinsicBaseWeight, WEIGHT_REF_TIME_PER_SECOND}; + use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; use sp_weights::Weight; use polkadot_primitives::MAX_POV_SIZE; - use primitives::{BlockNumber, Moment}; + use primitives::BlockNumber; use crate::{Balance, Perbill, CENTS}; @@ -68,7 +68,7 @@ pub mod xcm_fees { use primitives::{Balance, FungibleTokenId}; - use crate::{CENTS, MILLICENTS}; + use crate::CENTS; pub fn base_tx(currency: FungibleTokenId) -> Balance { cent(currency) / 10 diff --git a/runtime/continuum/src/lib.rs b/runtime/continuum/src/lib.rs index 898cdeed..a2d49e06 100644 --- a/runtime/continuum/src/lib.rs +++ b/runtime/continuum/src/lib.rs @@ -20,7 +20,7 @@ #![recursion_limit = "256"] use codec::{Decode, Encode, MaxEncodedLen}; -use cumulus_primitives_core::ParaId; + use frame_support::traits::{ Contains, Currency, EitherOfDiverse, EnsureOneOf, EnsureOrigin, EqualPrivilegeOnly, Get, InstanceFilter, Nothing, OnUnbalanced, @@ -31,18 +31,17 @@ use frame_support::{ parameter_types, traits::{Everything, Imbalance, WithdrawReasons}, weights::{ - constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND}, - ConstantMultiplier, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, - BoundedVec, PalletId, WeakBoundedVec, + BoundedVec, PalletId, }; use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, EnsureSigned, RawOrigin, }; -use orml_traits::location::{AbsoluteReserveProvider, RelativeReserveProvider, Reserve}; -use orml_traits::{arithmetic::Zero, parameter_type_with_key, MultiCurrency}; +use orml_traits::location::AbsoluteReserveProvider; +use orml_traits::{parameter_type_with_key, MultiCurrency}; pub use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; // XCM Imports use orml_xcm_support::DepositToAlternative; @@ -50,7 +49,7 @@ use orml_xcm_support::DepositToAlternative; use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; -use scale_info::prelude::vec; + use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; @@ -72,13 +71,11 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, IsConcrete, - NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, - TakeRevenue, TakeWeightCredit, UsingComponents, + AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeRevenue, TakeWeightCredit, }; -use xcm_executor::{traits::WithOriginFilter, Config, XcmExecutor}; +use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; use asset_manager::{BuyWeightRateOfForeignAsset, ForeignAssetMapping}; pub use constants::{currency::*, time::*}; @@ -86,7 +83,7 @@ use core_primitives::{NftAssetData, NftClassData}; // External imports use currencies::BasicCurrencyAdapter; use metaverse_runtime_common::{CurrencyHooks, FixedRateOfAsset}; -use primitives::{Amount, ClassId, ForeignAssetIdMapping, FungibleTokenId, Moment, NftId, RoundIndex, TokenSymbol}; +use primitives::{Amount, ClassId, ForeignAssetIdMapping, FungibleTokenId, Moment, NftId, RoundIndex}; // XCM Imports use crate::constants::parachains; @@ -737,7 +734,7 @@ impl Convert for AccountIdToMultiLocation { pub struct MultiLocationsFilter; impl Contains for MultiLocationsFilter { - fn contains(m: &MultiLocation) -> bool { + fn contains(_m: &MultiLocation) -> bool { true } } @@ -985,6 +982,11 @@ pub type XcmOriginToTransactDispatchOrigin = ( ); parameter_types! { + pub AssetHubLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(1000))); + pub const NuumNative: MultiAssetFilter = + Wild(AllOf { fun: WildFungible, id: Concrete(MultiLocation::here()) }); + pub AssetHubTrustedTeleporter: (MultiAssetFilter, MultiLocation) + = (NuumNative::get(), AssetHubLocation::get()); // One XCM operation is 100_000_000 weight - almost certainly a conservative estimate. pub UnitWeightCost: Weight = Weight::from_parts(100_000_000, 0); pub const MaxInstructions: u32 = 100; @@ -1014,7 +1016,7 @@ pub struct FungibleTokenIdConvert; impl Convert> for FungibleTokenIdConvert { fn convert(id: FungibleTokenId) -> Option { - use FungibleTokenId::{FungibleToken, MiningResource, NativeToken, Stable}; + use FungibleTokenId::{FungibleToken, NativeToken, Stable}; match id { // KSM NativeToken(1) => Some(MultiLocation::parent()), @@ -1041,7 +1043,7 @@ impl Convert> for FungibleTokenIdConvert impl Convert> for FungibleTokenIdConvert { fn convert(location: MultiLocation) -> Option { - use FungibleTokenId::{FungibleToken, MiningResource, NativeToken, Stable}; + use FungibleTokenId::{MiningResource, NativeToken}; // NativeToken // 0 => NUUM @@ -1065,7 +1067,7 @@ impl Convert> for FungibleTokenIdConvert match location.clone() { MultiLocation { parents: 1, - interior: X2(Parachain(para_id), GeneralKey { length, data }), + interior: X2(Parachain(para_id), GeneralKey { length: _, data }), } => match para_id { // Local testing para chain id 3446 | 4446 => match FungibleTokenId::decode(&mut &data[..]) { @@ -1077,7 +1079,7 @@ impl Convert> for FungibleTokenIdConvert _ => None, }, MultiLocation { parents, interior } if parents == 0 => match interior { - X1(GeneralKey { length, data }) => { + X1(GeneralKey { length: _, data }) => { // decode the general key if let Ok(currency_id) = FungibleTokenId::decode(&mut &data[..]) { match currency_id { @@ -1153,6 +1155,7 @@ impl Contains for SafeCallFilter { Self::allow_base_call(call) } } +pub type TrustedTeleporters = (xcm_builder::Case,); pub struct XcmConfig; @@ -1166,7 +1169,7 @@ impl xcm_executor::Config for XcmConfig { type XcmSender = XcmRouter; type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = MultiNativeAsset; - type IsTeleporter = (); + type IsTeleporter = TrustedTeleporters; // Should be enough to allow teleportation of ROC type UniversalLocation = UniversalLocation; type Weigher = FixedWeightBounds; @@ -1863,7 +1866,7 @@ construct_runtime!( Continuum: continuum::{Call, Pallet, Storage, Event} = 63, Estate: estate::{Call, Pallet, Storage, Event, Config} = 64, Economy: economy::{Pallet, Call, Storage, Event} = 65, - AssetManager: asset_manager::{Pallet, Call, Storage, Event} = 66, + AssetManager: asset_manager::{Pallet, Call, Storage, Event, Config} = 66, // Proxy Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 67, // Reward mechanism diff --git a/runtime/metaverse/src/lib.rs b/runtime/metaverse/src/lib.rs index 3f23746e..452e0601 100644 --- a/runtime/metaverse/src/lib.rs +++ b/runtime/metaverse/src/lib.rs @@ -24,7 +24,7 @@ extern crate orml_benchmarking; use codec::{Decode, Encode, MaxEncodedLen}; -use cumulus_pallet_parachain_system::RelaychainBlockNumberProvider; + // pub use this so we can import it in the chain spec. #[cfg(feature = "std")] pub use fp_evm::GenesisAccount; @@ -46,12 +46,10 @@ pub use frame_support::{ }; use frame_support::{BoundedVec, ConsensusEngineId}; // A few exports that help ease life for downstream crates. -use frame_support::traits::{ - Contains, EitherOfDiverse, EnsureOneOf, EqualPrivilegeOnly, Everything, FindAuthor, InstanceFilter, Nothing, -}; +use frame_support::traits::{Contains, EitherOfDiverse, EqualPrivilegeOnly, FindAuthor, InstanceFilter, Nothing}; use frame_system::{ limits::{BlockLength, BlockWeights}, - Config, EnsureRoot, EnsureSigned, RawOrigin, + EnsureRoot, EnsureSigned, RawOrigin, }; use orml_traits::parameter_type_with_key; pub use pallet_balances::Call as BalancesCall; @@ -59,10 +57,7 @@ use pallet_contracts::weights::WeightInfo; use pallet_ethereum::PostLogContent; use pallet_ethereum::{Call::transact, EthereumBlockHashMapping, Transaction as EthereumTransaction}; use pallet_evm::GasWeightMapping; -use pallet_evm::{ - Account as EVMAccount, EnsureAddressNever, EnsureAddressRoot, FeeCalculator, HashedAddressMapping, Runner, - SubstrateBlockHashMapping, -}; +use pallet_evm::{EnsureAddressNever, EnsureAddressRoot, FeeCalculator, HashedAddressMapping, Runner}; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier, TargetedFeeAdjustment}; use polkadot_primitives::MAX_POV_SIZE; @@ -71,11 +66,7 @@ use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; #[cfg(not(feature = "runtime-benchmarks"))] use sp_core::Get; -use sp_core::{ - crypto::{KeyTypeId, Public}, - sp_std::marker::PhantomData, - ConstBool, OpaqueMetadata, H160, H256, U256, -}; +use sp_core::{crypto::KeyTypeId, sp_std::marker::PhantomData, ConstBool, OpaqueMetadata, H160, H256, U256}; use sp_runtime::traits::{BlockNumberProvider, DispatchInfoOf}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -85,8 +76,8 @@ use sp_runtime::{ AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, Dispatchable, IdentifyAccount, NumberFor, OpaqueKeys, PostDispatchInfoOf, UniqueSaturatedInto, Verify, Zero, }, - transaction_validity::{InvalidTransaction, TransactionSource, TransactionValidity, TransactionValidityError}, - ApplyExtrinsicResult, FixedPointNumber, MultiSignature, Perbill, Percent, Permill, Perquintill, RuntimeDebug, + transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError}, + ApplyExtrinsicResult, FixedPointNumber, MultiSignature, Perbill, Permill, Perquintill, RuntimeDebug, }; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -103,8 +94,8 @@ pub use estate::{MintingRateInfo, Range as MintingRange}; use evm_mapping::EvmAddressMapping; use metaverse_runtime_common::{precompiles::MetaverseNetworkPrecompiles, CurrencyHooks}; use primitives::evm::{ - CurrencyIdType, Erc20Mapping, EvmAddress, H160_POSITION_CURRENCY_ID_TYPE, H160_POSITION_FUNGIBLE_TOKEN, - H160_POSITION_MINING_RESOURCE, H160_POSITION_TOKEN, H160_POSITION_TOKEN_NFT, H160_POSITION_TOKEN_NFT_CLASS_ID_END, + CurrencyIdType, Erc20Mapping, EvmAddress, H160_POSITION_CURRENCY_ID_TYPE, H160_POSITION_TOKEN, + H160_POSITION_TOKEN_NFT, H160_POSITION_TOKEN_NFT_CLASS_ID_END, }; use primitives::{Amount, Balance, BlockNumber, ClassId, FungibleTokenId, Moment, NftId, PoolId, RoundIndex, TokenId}; @@ -871,7 +862,7 @@ impl pallet_preimage::Config for Runtime { pub struct FindAuthorTruncated(PhantomData); impl> FindAuthor for FindAuthorTruncated { - fn find_author<'a, I>(digests: I) -> Option + fn find_author<'a, I>(_digests: I) -> Option where I: 'a + IntoIterator, { @@ -1574,7 +1565,7 @@ construct_runtime!( EVM: pallet_evm::{Pallet, Call, Storage, Config, Event}, Ethereum: pallet_ethereum::{Pallet, Call, Storage, Event, Config, Origin}, BaseFee: pallet_base_fee::{Pallet, Call, Storage, Config, Event}, - EvmMapping: evm_mapping::{Pallet, Call, Storage, Event}, + EvmMapping: evm_mapping::{Pallet, Call, Storage, Config, Event}, EvmChainId: pallet_evm_chain_id::{Pallet, Storage, Config}, // ink! Smart Contracts. @@ -1585,7 +1576,7 @@ construct_runtime!( Treasury: pallet_treasury::{Pallet, Storage, Config, Event, Call}, // Asset manager - AssetManager: asset_manager::{Pallet, Call, Storage, Event}, + AssetManager: asset_manager::{Pallet, Call, Storage, Event, Config}, // Proxy Proxy: pallet_proxy::{Pallet, Call, Storage, Event}, diff --git a/runtime/pioneer/src/constants.rs b/runtime/pioneer/src/constants.rs index 7a903b84..0cb4e296 100644 --- a/runtime/pioneer/src/constants.rs +++ b/runtime/pioneer/src/constants.rs @@ -19,11 +19,11 @@ pub mod currency { /// Time. pub mod time { - use frame_support::weights::constants::{ExtrinsicBaseWeight, WEIGHT_REF_TIME_PER_SECOND}; + use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND; use sp_weights::Weight; use polkadot_primitives::MAX_POV_SIZE; - use primitives::{BlockNumber, Moment}; + use primitives::BlockNumber; use crate::{Balance, Perbill, CENTS}; @@ -68,7 +68,7 @@ pub mod xcm_fees { use primitives::{Balance, FungibleTokenId}; - use crate::{CENTS, MILLICENTS}; + use crate::CENTS; pub fn base_tx(currency: FungibleTokenId) -> Balance { cent(currency) / 10 diff --git a/runtime/pioneer/src/lib.rs b/runtime/pioneer/src/lib.rs index 5b0c5378..73c81027 100644 --- a/runtime/pioneer/src/lib.rs +++ b/runtime/pioneer/src/lib.rs @@ -20,7 +20,7 @@ #![recursion_limit = "256"] use codec::{Decode, Encode, MaxEncodedLen}; -use cumulus_primitives_core::ParaId; + use frame_support::traits::{ Contains, Currency, EitherOfDiverse, EnsureOneOf, EnsureOrigin, EqualPrivilegeOnly, Get, InstanceFilter, Nothing, OnUnbalanced, @@ -31,18 +31,17 @@ use frame_support::{ parameter_types, traits::{Everything, Imbalance, WithdrawReasons}, weights::{ - constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND}, - ConstantMultiplier, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}, + ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, - BoundedVec, PalletId, WeakBoundedVec, + BoundedVec, PalletId, }; use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, EnsureSigned, RawOrigin, }; -use orml_traits::location::{AbsoluteReserveProvider, RelativeReserveProvider, Reserve}; -use orml_traits::{arithmetic::Zero, parameter_type_with_key, MultiCurrency}; +use orml_traits::location::AbsoluteReserveProvider; +use orml_traits::{parameter_type_with_key, MultiCurrency}; pub use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; // XCM Imports use orml_xcm_support::DepositToAlternative; @@ -50,7 +49,7 @@ use orml_xcm_support::DepositToAlternative; use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; -use scale_info::prelude::vec; + use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; @@ -72,13 +71,11 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, IsConcrete, - NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, - TakeRevenue, TakeWeightCredit, UsingComponents, + AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, + ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeRevenue, TakeWeightCredit, }; -use xcm_executor::{traits::WithOriginFilter, Config, XcmExecutor}; +use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; use asset_manager::{BuyWeightRateOfForeignAsset, ForeignAssetMapping}; pub use constants::{currency::*, time::*}; @@ -86,7 +83,7 @@ use core_primitives::{NftAssetData, NftClassData}; // External imports use currencies::BasicCurrencyAdapter; use metaverse_runtime_common::{CurrencyHooks, FixedRateOfAsset}; -use primitives::{Amount, ClassId, ForeignAssetIdMapping, FungibleTokenId, Moment, NftId, RoundIndex, TokenSymbol}; +use primitives::{Amount, ClassId, ForeignAssetIdMapping, FungibleTokenId, Moment, NftId, RoundIndex}; // XCM Imports use crate::constants::parachains; @@ -737,7 +734,7 @@ impl Convert for AccountIdToMultiLocation { pub struct MultiLocationsFilter; impl Contains for MultiLocationsFilter { - fn contains(m: &MultiLocation) -> bool { + fn contains(_m: &MultiLocation) -> bool { true } } @@ -985,6 +982,11 @@ pub type XcmOriginToTransactDispatchOrigin = ( ); parameter_types! { + pub AssetHubLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(1000))); + pub const NeerNative: MultiAssetFilter = + Wild(AllOf { fun: WildFungible, id: Concrete(MultiLocation::here()) }); + pub AssetHubTrustedTeleporter: (MultiAssetFilter, MultiLocation) + = (NeerNative::get(), AssetHubLocation::get()); // One XCM operation is 100_000_000 weight - almost certainly a conservative estimate. pub UnitWeightCost: Weight = Weight::from_parts(100_000_000, 0); pub const MaxInstructions: u32 = 100; @@ -1014,7 +1016,7 @@ pub struct FungibleTokenIdConvert; impl Convert> for FungibleTokenIdConvert { fn convert(id: FungibleTokenId) -> Option { - use FungibleTokenId::{FungibleToken, MiningResource, NativeToken, Stable}; + use FungibleTokenId::{FungibleToken, NativeToken, Stable}; match id { // KSM NativeToken(1) => Some(MultiLocation::parent()), @@ -1041,7 +1043,7 @@ impl Convert> for FungibleTokenIdConvert impl Convert> for FungibleTokenIdConvert { fn convert(location: MultiLocation) -> Option { - use FungibleTokenId::{FungibleToken, MiningResource, NativeToken, Stable}; + use FungibleTokenId::{MiningResource, NativeToken}; // NativeToken // 0 => NEER @@ -1066,7 +1068,7 @@ impl Convert> for FungibleTokenIdConvert match location.clone() { MultiLocation { parents: 1, - interior: X2(Parachain(para_id), GeneralKey { length, data }), + interior: X2(Parachain(para_id), GeneralKey { length: _, data }), } => match para_id { // Local testing para chain id 2096 | 3096 => match FungibleTokenId::decode(&mut &data[..]) { @@ -1084,7 +1086,7 @@ impl Convert> for FungibleTokenIdConvert _ => None, }, MultiLocation { parents, interior } if parents == 0 => match interior { - X1(GeneralKey { length, data }) => { + X1(GeneralKey { length: _, data }) => { // decode the general key if let Ok(currency_id) = FungibleTokenId::decode(&mut &data[..]) { match currency_id { @@ -1160,6 +1162,8 @@ impl Contains for SafeCallFilter { Self::allow_base_call(call) } } +//pub type Reserves = (NativeAsset, ReserveAssetsFrom); +pub type TrustedTeleporters = (xcm_builder::Case,); pub struct XcmConfig; @@ -1173,7 +1177,7 @@ impl xcm_executor::Config for XcmConfig { type XcmSender = XcmRouter; type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = MultiNativeAsset; - type IsTeleporter = (); + type IsTeleporter = TrustedTeleporters; // Should be enough to allow teleportation of ROC type UniversalLocation = UniversalLocation; type Weigher = FixedWeightBounds; @@ -1870,7 +1874,7 @@ construct_runtime!( Continuum: continuum::{Call, Pallet, Storage, Event} = 63, Estate: estate::{Call, Pallet, Storage, Event, Config} = 64, Economy: economy::{Pallet, Call, Storage, Event} = 65, - AssetManager: asset_manager::{Pallet, Call, Storage, Event} = 66, + AssetManager: asset_manager::{Pallet, Call, Storage, Event, Config} = 66, // Proxy Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 67, // Reward mechanism diff --git a/scripts/evm-tools/get_default_substrate_address.js b/scripts/evm-tools/get_default_substrate_address.js new file mode 100644 index 00000000..7f297b47 --- /dev/null +++ b/scripts/evm-tools/get_default_substrate_address.js @@ -0,0 +1,11 @@ +import { encodeAddress, blake2AsHex } from '@polkadot/util-crypto'; + +function getDefaultSubstrateAddress(evmAddress, prefix) { + const addressBytes = Buffer.from(evmAddress.slice(2), 'hex'); + const prefixBytes = Buffer.from('evm:'); + const convertBytes = Uint8Array.from(Buffer.concat([ prefixBytes, addressBytes ])); + const finalAddressHex = blake2AsHex(convertBytes, 256); + return encodeAddress(finalAddressHex, prefix) +} + +console.log("The default Substrate address for " + process.argv[2] + " is: " + getDefaultSubstrateAddress(process.argv[2], process.argv[3])); \ No newline at end of file diff --git a/scripts/evm-tools/package.json b/scripts/evm-tools/package.json new file mode 100644 index 00000000..2e1199ad --- /dev/null +++ b/scripts/evm-tools/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "dependencies": { + "@polkadot/util-crypto": "^10.4.2" + } +} \ No newline at end of file diff --git a/scripts/zombienet/basic-config.toml b/scripts/zombienet/basic-config.toml index 980867db..83cf6eb2 100644 --- a/scripts/zombienet/basic-config.toml +++ b/scripts/zombienet/basic-config.toml @@ -1,6 +1,9 @@ +[settings] +timeout = 1000 + [relaychain] default_command = "./bin/polkadot" -chain = "kusama-local" +chain = "rococo-local" [[relaychain.nodes]] name = "alice" @@ -16,13 +19,18 @@ chain = "kusama-local" id = 1000 add_to_genesis = true cumulus_based = true -chain = "statemine-local" +chain = "asset-hub-westend-local" [[parachains.collators]] - name = "statemine-collator" + name = "asset-hub-collator-1" command = "./bin/asset-hub" ws_port = 9946 + [[parachains.collators]] + name = "asset-hub-collator-2" + command = "./bin/asset-hub" + ws_port = 9947 + [types.Header] number = "u64" weight = "u64" diff --git a/scripts/zombienet/mnet-metaverse.toml b/scripts/zombienet/mnet-metaverse.toml index 70c03d62..da0bd92b 100644 --- a/scripts/zombienet/mnet-metaverse.toml +++ b/scripts/zombienet/mnet-metaverse.toml @@ -1,6 +1,9 @@ +[settings] +timeout = 1000 + [relaychain] default_command = "./bin/polkadot" -chain = "kusama-local" +chain = "rococo-local" [[relaychain.nodes]] name = "alice" @@ -29,6 +32,7 @@ chain = "kusama-local" [[parachains]] id = 2096 +chain = "metaverse-testnet" add_to_genesis = true cumulus_based = true @@ -42,14 +46,15 @@ cumulus_based = true id = 1000 add_to_genesis = true cumulus_based = true -chain = "statemine-local" +chain = "asset-hub-westend-local" [[parachains.collators]] - name = "statemine-collator" + name = "asset-hub-collator-1" command = "./bin/asset-hub" ws_port = 9910 args = ["-lparachain=debug"] + [[hrmp_channels]] sender = 1000 recipient = 2096 diff --git a/scripts/zombienet/mnet-pioneer.toml b/scripts/zombienet/mnet-pioneer.toml index 58e15d56..b7c3c09d 100644 --- a/scripts/zombienet/mnet-pioneer.toml +++ b/scripts/zombienet/mnet-pioneer.toml @@ -1,6 +1,9 @@ +[settings] +timeout = 1000 + [relaychain] default_command = "./bin/polkadot" -chain = "kusama-local" +chain = "rococo-local" [[relaychain.nodes]] name = "alice" @@ -29,7 +32,7 @@ chain = "kusama-local" [[parachains]] id = 2096 -chain = "local" +chain = "pioneer-roc" add_to_genesis = true cumulus_based = true @@ -43,10 +46,10 @@ cumulus_based = true id = 1000 add_to_genesis = true cumulus_based = true -chain = "statemine-local" +chain = "asset-hub-kusama-local" [[parachains.collators]] - name = "statemine-collator" + name = "asset-hub-collator-1" command = "./bin/asset-hub" ws_port = 9910 args = ["-lparachain=debug"] diff --git a/scripts/zombienet/tests/xcm-pioneer.zndsl b/scripts/zombienet/tests/xcm-pioneer.zndsl new file mode 100644 index 00000000..7a24218c --- /dev/null +++ b/scripts/zombienet/tests/xcm-pioneer.zndsl @@ -0,0 +1,18 @@ +Description: Pioneer XCM Tests +Network: ../mnet-pioneer.toml +Creds: config + +alice: is up +bob: is up +asset-hub-collator: is up +pioneer-node: is up + +# AssetHub +alice: parachain 1000 is registered within 225 seconds +alice: parachain 1000 block height is at least 10 within 250 seconds +# MNET - Pioneer +alice: parachain 2096 is registered within 225 seconds +alice: parachain 2096 block height is at least 10 within 250 seconds + +# pioneer-node: ts-script ./transfer_ROC_from_AssetHub_to_Pioneer.ts return is greater than 0 within 500 seconds +# pioneer-node: ts-script ./transfer_NEER_from_Pioneer_to_AssetHub.ts return is greater than 0 within 500 seconds \ No newline at end of file diff --git a/scripts/zombienet/zombienet.sh b/scripts/zombienet/zombienet.sh old mode 100644 new mode 100755 index 258e77da..28fc990c --- a/scripts/zombienet/zombienet.sh +++ b/scripts/zombienet/zombienet.sh @@ -7,9 +7,9 @@ bin_dir="$root_dir/bin" working_dir="$(pwd)" provider=native -zombienet_version=v1.3.91 -pdot_branch=release-polkadot-v1.1.0 -asset_hub_branch=release-polkadot-v1.1.0 +zombienet_version=v1.3.100 +pdot_branch=release-polkadot-v1.6.0 +asset_hub_branch=mergebase-cumulus-v1.0.0 polkadot_tmp_dir=/tmp/polkadot asset_hub_tmp_dir=/tmp/asset_hub @@ -60,18 +60,24 @@ build_polkadot() { return fi - if [ ! -f "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot" ]; then + if [ ! -f "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot" ] || [ ! -f "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-prepare-worker" ] || [ ! -f "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-execute-worker" ]; then echo "::group::Install polkadot." - echo "Cloning polkadot into $polkadot_tmp_dir" - mkdir -p "$polkadot_tmp_dir" - git clone --branch "$pdot_branch" --depth 1 https://github.com/paritytech/polkadot-sdk "$polkadot_tmp_dir/$pdot_branch" || true + if [ ! -f "$polkadot_tmp_dir/$pdot_branch" ]; then + echo "Cloning polkadot into $polkadot_tmp_dir" + mkdir -p "$polkadot_tmp_dir" + git clone --branch "$pdot_branch" --depth 1 https://github.com/paritytech/polkadot-sdk "$polkadot_tmp_dir/$pdot_branch" || true + fi echo "Building polkadot..." - cargo build --manifest-path "$polkadot_tmp_dir/$pdot_branch/Cargo.toml" --features fast-runtime --release --locked + cargo build --manifest-path "$polkadot_tmp_dir/$pdot_branch/Cargo.toml" --locked --release --features fast-runtime --bin polkadot --bin polkadot-prepare-worker --bin polkadot-execute-worker cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot" "$bin_dir/polkadot" + cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-prepare-worker" "$bin_dir/polkadot-prepare-worker" + cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-execute-worker" "$bin_dir/polkadot-execute-worker" echo "::endgroup::" echo "✅ polkadot-$pdot_branch" else cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot" "$bin_dir/polkadot" + cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-prepare-worker" "$bin_dir/polkadot-prepare-worker" + cp "$polkadot_tmp_dir/$pdot_branch/target/release/polkadot-execute-worker" "$bin_dir/polkadot-execute-worker" echo "✅ polkadot-$pdot_branch" fi } @@ -82,18 +88,18 @@ build_asset_hub() { return fi - if [ ! -f "$asset_hub_tmp_dir/$asset_hub_branch/target/release/polkadot-parachain" ]; then + if [ ! -f "$asset_hub_tmp_dir/$asset_hub_branch/cumulus/target/release/polkadot-parachain" ]; then echo "::group::Install AssetHub." echo "Cloning AssetHub into $asset_hub_tmp_dir" mkdir -p "$asset_hub_tmp_dir" git clone --branch "$asset_hub_branch" --depth 1 https://github.com/paritytech/polkadot-sdk "$asset_hub_tmp_dir/$asset_hub_branch" || true echo "Building AssetHub..." - cargo build --manifest-path "$asset_hub_tmp_dir/$asset_hub_branch/Cargo.toml" --release --locked --bin polkadot-parachain - cp "$asset_hub_tmp_dir/$asset_hub_branch/target/release/polkadot-parachain" "$bin_dir/asset-hub" + cargo build --manifest-path "$asset_hub_tmp_dir/$asset_hub_branch/cumulus/Cargo.toml" --release --locked --bin polkadot-parachain + cp "$asset_hub_tmp_dir/$asset_hub_branch/cumulus/target/release/polkadot-parachain" "$bin_dir/asset-hub" echo "::endgroup::" echo "✅ asset-hub-$asset_hub_branch" else - cp "$asset_hub_tmp_dir/$asset_hub_branch/target/release/polkadot-parachain" "$bin_dir/asset-hub" + cp "$asset_hub_tmp_dir/$asset_hub_branch/cumulus/target/release/polkadot-parachain" "$bin_dir/asset-hub" echo "✅ asset-hub-$asset_hub_branch" fi }