diff --git a/Cargo.lock b/Cargo.lock index 16d82ed9d..8b81fa161 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,17 +71,6 @@ dependencies = [ "subtle 2.6.1", ] -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.11" @@ -419,90 +408,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" -[[package]] -name = "asset-hub-polkadot-runtime" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "assets-common", - "bp-asset-hub-kusama", - "bp-asset-hub-polkadot", - "bp-bridge-hub-kusama", - "bp-bridge-hub-polkadot", - "collectives-polkadot-runtime-constants", - "cumulus-pallet-aura-ext", - "cumulus-pallet-parachain-system", - "cumulus-pallet-session-benchmarking", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-aura", - "cumulus-primitives-core", - "cumulus-primitives-utility", - "frame-benchmarking", - "frame-executive", - "frame-metadata-hash-extension", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal", - "kusama-runtime-constants", - "log", - "pallet-asset-conversion", - "pallet-asset-conversion-tx-payment", - "pallet-assets", - "pallet-aura", - "pallet-authorship", - "pallet-balances", - "pallet-collator-selection", - "pallet-message-queue", - "pallet-multisig", - "pallet-nfts", - "pallet-nfts-runtime-api", - "pallet-proxy", - "pallet-session", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-uniques", - "pallet-utility", - "pallet-vesting", - "pallet-xcm", - "pallet-xcm-benchmarks", - "pallet-xcm-bridge-hub-router", - "parachains-common", - "parity-scale-codec", - "polkadot-core-primitives", - "polkadot-parachain-primitives", - "polkadot-runtime-common", - "polkadot-runtime-constants", - "primitive-types", - "scale-info", - "snowbridge-router-primitives", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", - "sp-core", - "sp-genesis-builder", - "sp-inherents", - "sp-io", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-version", - "sp-weights", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", - "system-parachains-constants", -] - [[package]] name = "assets-common" version = "0.14.0" @@ -1002,185 +907,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "bp-asset-hub-kusama" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "bp-xcm-bridge-hub-router", - "frame-support", - "parity-scale-codec", - "scale-info", - "sp-std", - "staging-xcm", - "system-parachains-constants", -] - -[[package]] -name = "bp-asset-hub-polkadot" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "bp-xcm-bridge-hub-router", - "frame-support", - "parity-scale-codec", - "scale-info", - "sp-std", - "staging-xcm", - "system-parachains-constants", -] - -[[package]] -name = "bp-bridge-hub-cumulus" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba00946c8a825bec15b1a6ebdf0c35f0d2f2110b529b5067de14279d6dcce8a" -dependencies = [ - "bp-messages", - "bp-polkadot-core", - "bp-runtime", - "frame-support", - "frame-system", - "polkadot-primitives", - "sp-api", - "sp-std", -] - -[[package]] -name = "bp-bridge-hub-kusama" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "bp-bridge-hub-cumulus", - "bp-messages", - "bp-runtime", - "frame-support", - "kusama-runtime-constants", - "polkadot-runtime-constants", - "snowbridge-core", - "sp-api", - "sp-runtime", - "sp-std", - "staging-xcm", - "system-parachains-constants", -] - -[[package]] -name = "bp-bridge-hub-polkadot" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "bp-bridge-hub-cumulus", - "bp-messages", - "bp-polkadot-bulletin", - "bp-runtime", - "frame-support", - "kusama-runtime-constants", - "polkadot-runtime-constants", - "snowbridge-core", - "sp-api", - "sp-runtime", - "sp-std", - "staging-xcm", - "system-parachains-constants", -] - -[[package]] -name = "bp-header-chain" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3445ca2e7a3b5e86f03f5bed0a98edcfbdada59f97b71c7dbace25b60b9d3c4a" -dependencies = [ - "bp-runtime", - "finality-grandpa", - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-consensus-grandpa", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bp-messages" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cee5c02e0cf8cfec023231ba3b40922321bab0ab2490ab1f71af5f5d9eaf63" -dependencies = [ - "bp-header-chain", - "bp-runtime", - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-std", -] - -[[package]] -name = "bp-polkadot-bulletin" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2e4c6ba687dad4303d88511eec378065d3f8a88f135d041fb4134e8306d1f1" -dependencies = [ - "bp-header-chain", - "bp-messages", - "bp-polkadot-core", - "bp-runtime", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bp-polkadot-core" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330626b279be8405c3d6e712b84af7c8f2636cbe9ca4c1ed7d42937fe933a050" -dependencies = [ - "bp-messages", - "bp-runtime", - "frame-support", - "frame-system", - "parity-scale-codec", - "parity-util-mem", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "bp-runtime" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae0eaf8669eeb086c5ce8b9a6b5f4fb3f83cd0699c63a6f42236482873c8236" -dependencies = [ - "frame-support", - "frame-system", - "hash-db", - "impl-trait-for-tuples", - "log", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "trie-db", -] - [[package]] name = "bp-xcm-bridge-hub-router" version = "0.13.0" @@ -1551,11 +1277,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "collectives-polkadot-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" - [[package]] name = "color-print" version = "0.3.6" @@ -3118,47 +2839,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "ethabi-decode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d398648d65820a727d6a81e58b962f874473396a047e4c30bafe3240953417" -dependencies = [ - "ethereum-types", - "tiny-keccak", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -4127,9 +3807,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] [[package]] name = "hashbrown" @@ -4137,7 +3814,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.11", + "ahash", ] [[package]] @@ -4146,7 +3823,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.11", + "ahash", "allocator-api2", "serde", ] @@ -4463,26 +4140,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-num-traits" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951641f13f873bff03d4bf19ae8bec531935ac0ac2cc775f84d7edfdcfed3f17" -dependencies = [ - "integer-sqrt", - "num-traits", - "uint", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - [[package]] name = "impl-serde" version = "0.4.0" @@ -4586,7 +4243,6 @@ dependencies = [ name = "integration-tests" version = "0.8.0" dependencies = [ - "asset-hub-polkadot-runtime", "assets-common", "cumulus-pallet-xcm", "cumulus-primitives-core", @@ -4631,10 +4287,10 @@ dependencies = [ "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", - "polkadot-runtime", - "polkadot-runtime-constants", "polkadot-runtime-parachains", "polkadot-service", + "rococo-runtime", + "rococo-runtime-constants", "sc-consensus-grandpa", "scale-info", "serde", @@ -4652,7 +4308,6 @@ dependencies = [ "staging-xcm-builder", "staging-xcm-executor", "substrate-wasm-builder", - "system-parachains-constants", "xcm-emulator", "xcm-fee-payment-runtime-api", ] @@ -4936,21 +4591,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33070833c9ee02266356de0c43f723152bd38bd96ddf52c82b3af10c9138b28" -[[package]] -name = "kusama-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "frame-support", - "polkadot-primitives", - "polkadot-runtime-common", - "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", - "staging-xcm-builder", -] - [[package]] name = "kvdb" version = "0.13.0" @@ -5640,15 +5280,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "lru" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" -dependencies = [ - "hashbrown 0.12.3", -] - [[package]] name = "lru" version = "0.10.1" @@ -6755,22 +6386,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-asset-conversion-tx-payment" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b413508fc0745307d01c55e686cf00d67f09b6652b7db344b69da305feaae0" -dependencies = [ - "frame-support", - "frame-system", - "pallet-asset-conversion", - "pallet-transaction-payment", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-asset-rate" version = "14.0.0" @@ -7479,37 +7094,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-nfts" -version = "29.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c68c96f03ef2dd6c23072f315d6ef3e1b4664795f29aab5962db8cc9062ad3" -dependencies = [ - "enumflags2", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "pallet-nfts-runtime-api" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c2745697dcd469b5d8f37e50b116e48198dd5df4c3a6ea7af98c20c548cc30" -dependencies = [ - "pallet-nfts", - "parity-scale-codec", - "sp-api", - "sp-std", -] - [[package]] name = "pallet-nis" version = "35.0.0" @@ -8112,22 +7696,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-uniques" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb356a869d24f826d0887f9953f296f0b1f1e3210f84beedc83d858845c5be93" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-utility" version = "35.0.0" @@ -8222,26 +7790,6 @@ dependencies = [ "staging-xcm-executor", ] -[[package]] -name = "pallet-xcm-bridge-hub-router" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806996c671acfb8640cb7a29de16c58092b81a6e15b22e3a3fffe0c2a4845b03" -dependencies = [ - "bp-xcm-bridge-hub-router", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std", - "staging-xcm", - "staging-xcm-builder", -] - [[package]] name = "parachains-common" version = "14.0.0" @@ -8285,13 +7833,7 @@ dependencies = [ "rand_core 0.6.4", "serde", "unicode-normalization", -] - -[[package]] -name = "parity-bytes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b56e3a2420138bdb970f84dfb9c774aea80fa0e7371549eedec0d80c209c67" +] [[package]] name = "parity-db" @@ -8347,35 +7889,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" -[[package]] -name = "parity-util-mem" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" -dependencies = [ - "cfg-if", - "ethereum-types", - "hashbrown 0.12.3", - "impl-trait-for-tuples", - "lru 0.8.1", - "parity-util-mem-derive", - "parking_lot 0.12.3", - "primitive-types", - "smallvec", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn 1.0.109", - "synstructure 0.12.6", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -9732,100 +9245,6 @@ dependencies = [ "substrate-state-trie-migration-rpc", ] -[[package]] -name = "polkadot-runtime" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "binary-merkle-tree", - "frame-benchmarking", - "frame-election-provider-support", - "frame-executive", - "frame-metadata-hash-extension", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "log", - "pallet-asset-rate", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", - "pallet-bags-list", - "pallet-balances", - "pallet-beefy", - "pallet-beefy-mmr", - "pallet-bounties", - "pallet-child-bounties", - "pallet-conviction-voting", - "pallet-election-provider-multi-phase", - "pallet-election-provider-support-benchmarking", - "pallet-fast-unstake", - "pallet-grandpa", - "pallet-identity", - "pallet-indices", - "pallet-message-queue", - "pallet-mmr", - "pallet-multisig", - "pallet-nomination-pools", - "pallet-nomination-pools-benchmarking", - "pallet-nomination-pools-runtime-api", - "pallet-offences", - "pallet-offences-benchmarking", - "pallet-preimage", - "pallet-proxy", - "pallet-referenda", - "pallet-scheduler", - "pallet-session", - "pallet-session-benchmarking", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-staking-reward-fn", - "pallet-staking-runtime-api", - "pallet-state-trie-migration", - "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", - "pallet-utility", - "pallet-vesting", - "pallet-whitelist", - "pallet-xcm", - "pallet-xcm-benchmarks", - "parity-scale-codec", - "polkadot-primitives", - "polkadot-runtime-common", - "polkadot-runtime-constants", - "polkadot-runtime-parachains", - "scale-info", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-core", - "sp-debug-derive", - "sp-genesis-builder", - "sp-inherents", - "sp-io", - "sp-npos-elections", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-version", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", -] - [[package]] name = "polkadot-runtime-common" version = "14.0.0" @@ -9878,21 +9297,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "polkadot-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "frame-support", - "polkadot-primitives", - "polkadot-runtime-common", - "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", - "staging-xcm-builder", -] - [[package]] name = "polkadot-runtime-metrics" version = "14.0.0" @@ -10335,8 +9739,6 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", - "impl-num-traits", - "impl-rlp", "impl-serde", "scale-info", "uint", @@ -11076,16 +10478,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rustc-hex", -] - [[package]] name = "rocksdb" version = "0.21.0" @@ -11909,7 +11301,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3380570b0c27d2c26dd16a3c73ea99e8b87c0a91b4d7e1e7332dd501d0250d95" dependencies = [ - "ahash 0.8.11", + "ahash", "array-bytes", "async-trait", "dyn-clone", @@ -12202,7 +11594,7 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17d8d4b7cc4eb58e9f1e73eb6ba84de8bb0101f14d5c688ae7bd5ff0535ed282" dependencies = [ - "ahash 0.8.11", + "ahash", "futures", "futures-timer", "libp2p", @@ -12797,7 +12189,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" dependencies = [ - "ahash 0.8.11", + "ahash", "cfg-if", "hashbrown 0.13.2", ] @@ -12981,15 +12373,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-big-array" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd31f59f6fe2b0c055371bb2f16d7f0aa7d8881676c04a55b1596d1a17cd10a4" -dependencies = [ - "serde", -] - [[package]] name = "serde-json-core" version = "0.5.1" @@ -13434,119 +12817,6 @@ dependencies = [ "subtle 2.6.1", ] -[[package]] -name = "snowbridge-amcl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" -dependencies = [ - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "snowbridge-beacon-primitives" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6534a4c0a1b5b16003977498df47eba13431c18d11315cdde16675e619d4ed2a" -dependencies = [ - "byte-slice-cast", - "frame-support", - "hex", - "parity-scale-codec", - "rlp", - "scale-info", - "serde", - "snowbridge-ethereum", - "snowbridge-milagro-bls", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "ssz_rs", - "ssz_rs_derive", -] - -[[package]] -name = "snowbridge-core" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d118d73d30ad61271306cfb9cfd2f776779508858ede35500aabccff60651f64" -dependencies = [ - "ethabi-decode", - "frame-support", - "frame-system", - "hex-literal", - "parity-scale-codec", - "polkadot-parachain-primitives", - "scale-info", - "serde", - "snowbridge-beacon-primitives", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "staging-xcm", - "staging-xcm-builder", -] - -[[package]] -name = "snowbridge-ethereum" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef1f6f60f6c8cc3cdb2a829d7452de946d8707f63f70c6f714d1c52cbc0fc17" -dependencies = [ - "ethabi-decode", - "ethbloom", - "ethereum-types", - "hex-literal", - "parity-bytes", - "parity-scale-codec", - "rlp", - "scale-info", - "serde", - "serde-big-array", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "snowbridge-milagro-bls" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "026aa8638f690a53e3f7676024b9e913b1cab0111d1b7b92669d40a188f9d7e6" -dependencies = [ - "hex", - "lazy_static", - "parity-scale-codec", - "rand 0.8.5", - "scale-info", - "snowbridge-amcl", - "zeroize", -] - -[[package]] -name = "snowbridge-router-primitives" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883ae82583071808e61981f0758d21daa3da54082dd05438eb420fdc02fa2124" -dependencies = [ - "frame-support", - "hex-literal", - "log", - "parity-scale-codec", - "scale-info", - "snowbridge-core", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "staging-xcm", - "staging-xcm-executor", -] - [[package]] name = "socket2" version = "0.4.10" @@ -14287,7 +13557,7 @@ version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d717c0f465f5371569e6fdc25b6f32d47c15d6e4c92b3b779e1c9b18b951d" dependencies = [ - "ahash 0.8.11", + "ahash", "hash-db", "lazy_static", "memory-db", @@ -14409,29 +13679,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "ssz_rs" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057291e5631f280978fa9c8009390663ca4613359fc1318e36a8c24c392f6d1f" -dependencies = [ - "bitvec", - "num-bigint", - "sha2 0.9.9", - "ssz_rs_derive", -] - -[[package]] -name = "ssz_rs_derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07d54c4d01a1713eb363b55ba51595da15f6f1211435b71466460da022aa140" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -14841,21 +14088,6 @@ dependencies = [ "libc", ] -[[package]] -name = "system-parachains-constants" -version = "1.0.0" -source = "git+https://github.com/polkadot-fellows/runtimes?rev=c5080e43321476ec82d69b710ebfaafb634f7475#c5080e43321476ec82d69b710ebfaafb634f7475" -dependencies = [ - "frame-support", - "kusama-runtime-constants", - "parachains-common", - "polkadot-core-primitives", - "polkadot-primitives", - "polkadot-runtime-constants", - "smallvec", - "sp-runtime", -] - [[package]] name = "tap" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 8ca7f440d..ed4bec031 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,13 +12,13 @@ default-members = ["nodes/*", "pallets/*"] resolver = "2" [workspace.lints.clippy] -all = { level = "warn", priority = -1} +all = { level = "warn", priority = -1 } inconsistent_digit_grouping = "allow" zero_prefixed_literal = "allow" missing_errors_doc = "allow" must_use_candidate = "allow" identity_op = "allow" -tabs_in_doc_comments= "allow" +tabs_in_doc_comments = "allow" [workspace.lints.rust] unreachable_patterns = "deny" @@ -148,7 +148,7 @@ sp-authority-discovery = { version = "33.0.0", default-features = false } sp-consensus-babe = { version = "0.39.0", default-features = false } pallet-message-queue = { version = "38.0.0", default-features = false } sp-weights = { version = "31.0.0", default-features = false } -sp-application-crypto = {version = "37.0.0", default-features = false} +sp-application-crypto = { version = "37.0.0", default-features = false } # FRAME assets-common = { version = "0.14.0", default-features = false } @@ -246,7 +246,5 @@ cumulus-pallet-session-benchmarking = { version = "16.0.0", default-features = f # Runtimes polimec-runtime = { path = "runtimes/polimec" } -asset-hub-polkadot-runtime = { git = 'https://github.com/polkadot-fellows/runtimes', default-features = false, rev = 'c5080e43321476ec82d69b710ebfaafb634f7475' } -polkadot-runtime-constants = { git = 'https://github.com/polkadot-fellows/runtimes', default-features = false, rev = 'c5080e43321476ec82d69b710ebfaafb634f7475' } -system-parachains-constants = { git = 'https://github.com/polkadot-fellows/runtimes', default-features = false, rev = 'c5080e43321476ec82d69b710ebfaafb634f7475' } -polkadot-runtime = { git = 'https://github.com/polkadot-fellows/runtimes', default-features = false, rev = 'c5080e43321476ec82d69b710ebfaafb634f7475' } +rococo-runtime-constants = { version = "14.0.0" } +rococo-runtime = { version = "14.0.0" } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index cc5d552e6..6a4847975 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -17,7 +17,7 @@ workspace = true substrate-wasm-builder.workspace = true [dependencies] -serde = { workspace = true } +serde = { workspace = true } parity-scale-codec = { workspace = true, features = ["derive"] } scale-info = { workspace = true, features = ["derive"] } @@ -62,8 +62,7 @@ polkadot-service.workspace = true sp-authority-discovery.workspace = true sp-consensus-babe.workspace = true sp-consensus-beefy.workspace = true -polkadot-runtime-constants.workspace = true -system-parachains-constants.workspace = true +rococo-runtime-constants.workspace = true pallet-staking.workspace = true pallet-membership.workspace = true orml-oracle.workspace = true @@ -86,8 +85,7 @@ hex.workspace = true assets-common.workspace = true # Runtimes -polkadot-runtime.workspace = true -asset-hub-polkadot-runtime.workspace = true +rococo-runtime.workspace = true polimec-runtime.workspace = true penpal-runtime = { path = "penpal", default-features = false } @@ -96,7 +94,6 @@ penpal-runtime = { path = "penpal", default-features = false } default = [ "development-settings", "instant-mode", "std" ] instant-mode = [ "polimec-runtime/instant-mode" ] std = [ - "asset-hub-polkadot-runtime/std", "cumulus-pallet-xcm/std", "cumulus-primitives-core/std", "frame-metadata-hash-extension/std", @@ -139,9 +136,7 @@ std = [ "polkadot-core-primitives/std", "polkadot-parachain-primitives/std", "polkadot-primitives/std", - "polkadot-runtime-constants/std", "polkadot-runtime-parachains/std", - "polkadot-runtime/std", "scale-info/std", "serde/std", "sp-arithmetic/std", @@ -153,7 +148,8 @@ std = [ "sp-io/std", "sp-runtime/std", "sp-std/std", - "system-parachains-constants/std", + "rococo-runtime-constants/std", + "rococo-runtime/std", "xcm-builder/std", "xcm-executor/std", "xcm-fee-payment-runtime-api/std", @@ -161,7 +157,6 @@ std = [ ] development-settings = [ "polimec-runtime/development-settings" ] runtime-benchmarks = [ - "asset-hub-polkadot-runtime/runtime-benchmarks", "cumulus-primitives-core/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", @@ -195,11 +190,10 @@ runtime-benchmarks = [ "polkadot-parachain-primitives/runtime-benchmarks", "polkadot-primitives/runtime-benchmarks", "polkadot-runtime-parachains/runtime-benchmarks", - "polkadot-runtime/runtime-benchmarks", "polkadot-service/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "rococo-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", "xcm-fee-payment-runtime-api/runtime-benchmarks", ] - diff --git a/integration-tests/src/constants.rs b/integration-tests/src/constants.rs index 6b054d28d..7c73efcec 100644 --- a/integration-tests/src/constants.rs +++ b/integration-tests/src/constants.rs @@ -232,8 +232,7 @@ const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; // Polkadot pub mod polkadot { use super::*; - pub const ED: Balance = polkadot_runtime_constants::currency::EXISTENTIAL_DEPOSIT; - const STASH: u128 = 100 * polkadot_runtime_constants::currency::UNITS; + pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; pub fn get_host_config() -> HostConfiguration { HostConfiguration { @@ -254,17 +253,16 @@ pub mod polkadot { para_assignment: AssignmentId, authority_discovery: AuthorityDiscoveryId, beefy: BeefyId, - ) -> polkadot_runtime::SessionKeys { - polkadot_runtime::SessionKeys { babe, grandpa, para_validator, para_assignment, authority_discovery, beefy } + ) -> rococo_runtime::SessionKeys { + rococo_runtime::SessionKeys { babe, grandpa, para_validator, para_assignment, authority_discovery, beefy } } pub fn genesis() -> Storage { - let genesis_config = polkadot_runtime::RuntimeGenesisConfig { - system: Default::default(), - balances: polkadot_runtime::BalancesConfig { + let genesis_config = rococo_runtime::RuntimeGenesisConfig { + balances: rococo_runtime::BalancesConfig { balances: accounts::init_balances().iter().cloned().map(|k| (k, INITIAL_DEPOSIT)).collect(), }, - session: polkadot_runtime::SessionConfig { + session: rococo_runtime::SessionConfig { keys: validators::initial_authorities() .iter() .map(|x| { @@ -284,24 +282,12 @@ pub mod polkadot { }) .collect::>(), }, - staking: polkadot_runtime::StakingConfig { - validator_count: validators::initial_authorities().len() as u32, - minimum_validator_count: 1, - stakers: validators::initial_authorities() - .iter() - .map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator)) - .collect(), - invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), - force_era: pallet_staking::Forcing::ForceNone, - slash_reward_fraction: Perbill::from_percent(10), - ..Default::default() - }, - babe: polkadot_runtime::BabeConfig { + babe: rococo_runtime::BabeConfig { authorities: Default::default(), - epoch_config: polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG, + epoch_config: rococo_runtime::BABE_GENESIS_EPOCH_CONFIG, ..Default::default() }, - configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, + configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, ..Default::default() }; @@ -309,74 +295,6 @@ pub mod polkadot { } } -// AssetHub -pub mod asset_hub { - use super::*; - use crate::{AssetHub, PolkadotNet}; - use xcm::v4::Parent; - - pub const PARA_ID: u32 = 1000; - pub const ED: Balance = system_parachains_constants::polkadot::currency::SYSTEM_PARA_EXISTENTIAL_DEPOSIT; - - pub fn genesis() -> Storage { - let mut funded_accounts = vec![ - ( - >::sovereign_account_id_of( - (Parent, xcm::prelude::Parachain(penpal::PARA_ID)).into(), - ), - INITIAL_DEPOSIT, - ), - ( - >::sovereign_account_id_of( - (Parent, xcm::prelude::Parachain(polimec::PARA_ID)).into(), - ), - INITIAL_DEPOSIT, - ), - ]; - funded_accounts.extend(accounts::init_balances().iter().cloned().map(|k| (k, INITIAL_DEPOSIT))); - - let genesis_config = asset_hub_polkadot_runtime::RuntimeGenesisConfig { - system: Default::default(), - balances: asset_hub_polkadot_runtime::BalancesConfig { balances: funded_accounts }, - parachain_info: asset_hub_polkadot_runtime::ParachainInfoConfig { - parachain_id: PARA_ID.into(), - ..Default::default() - }, - collator_selection: asset_hub_polkadot_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables_asset_hub().iter().cloned().map(|(acc, _)| acc).collect(), - candidacy_bond: ED * 16, - ..Default::default() - }, - session: asset_hub_polkadot_runtime::SessionConfig { - keys: collators::invulnerables_asset_hub() - .into_iter() - .map(|(acc, aura)| { - ( - acc.clone(), // account id - acc, // validator id - asset_hub_polkadot_runtime::SessionKeys { aura }, // session keys - ) - }) - .collect(), - }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), - polkadot_xcm: asset_hub_polkadot_runtime::PolkadotXcmConfig { - safe_xcm_version: Some(SAFE_XCM_VERSION), - ..Default::default() - }, - assets: Default::default(), - foreign_assets: Default::default(), - transaction_payment: Default::default(), - vesting: Default::default(), - pool_assets: Default::default(), - }; - - genesis_config.build_storage().unwrap() - } -} - // Penpal pub mod penpal { use super::*; @@ -387,9 +305,7 @@ pub mod penpal { pub fn genesis() -> Storage { let mut funded_accounts = vec![( - >::sovereign_account_id_of( - (Parent, xcm::prelude::Parachain(asset_hub::PARA_ID)).into(), - ), + >::sovereign_account_id_of((Parent, xcm::prelude::Parachain(1000)).into()), INITIAL_DEPOSIT, )]; funded_accounts.extend(accounts::init_balances().iter().cloned().map(|k| (k, INITIAL_DEPOSIT))); @@ -500,10 +416,7 @@ pub mod polimec { PolimecNet::sovereign_account_id_of((Parent, xcm::prelude::Parachain(penpal::PARA_ID)).into()), INITIAL_DEPOSIT, ), - ( - PolimecNet::sovereign_account_id_of((Parent, xcm::prelude::Parachain(asset_hub::PARA_ID)).into()), - INITIAL_DEPOSIT, - ), + (PolimecNet::sovereign_account_id_of((Parent, xcm::prelude::Parachain(1000)).into()), INITIAL_DEPOSIT), ]; let alice_account = PolimecNet::account_id_of(accounts::ALICE); let bob_account: AccountId = PolimecNet::account_id_of(accounts::BOB); diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index be3949ecd..08b1ed0ef 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -18,9 +18,8 @@ pub mod constants; #[cfg(test)] mod tests; -pub use constants::{accounts::*, asset_hub, penpal, polimec, polkadot}; +pub use constants::{accounts::*, penpal, polimec, polkadot}; pub use frame_support::{assert_noop, assert_ok, pallet_prelude::Weight, parameter_types, traits::Hooks}; -use macros::generate_accounts; pub use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber}; pub use sp_core::{sr25519, storage::Storage, Encode, Get}; pub use xcm::prelude::*; @@ -34,15 +33,17 @@ decl_test_relay_chains! { #[api_version(11)] pub struct PolkadotRelay { genesis = polkadot::genesis(), - on_init = (), - runtime = polkadot_runtime, + on_init = { + rococo_runtime::System::set_block_number(1); + }, + runtime = rococo_runtime, core = { - SovereignAccountOf: polkadot_runtime::xcm_config::SovereignAccountOf, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, }, pallets = { - System: polkadot_runtime::System, - Balances: polkadot_runtime::Balances, - XcmPallet: polkadot_runtime::XcmPallet, + System: rococo_runtime::System, + Balances: rococo_runtime::Balances, + XcmPallet: rococo_runtime::XcmPallet, } } } @@ -66,24 +67,6 @@ decl_test_parachains! { ParachainInfo: penpal_runtime::ParachainInfo, } }, - pub struct AssetHub { - genesis = asset_hub::genesis(), - on_init = asset_hub_polkadot_runtime::AuraExt::on_initialize(1), - runtime = asset_hub_polkadot_runtime, - core = { - XcmpMessageHandler: asset_hub_polkadot_runtime::XcmpQueue, - LocationToAccountId: asset_hub_polkadot_runtime::xcm_config::LocationToAccountId, - ParachainInfo: asset_hub_polkadot_runtime::ParachainInfo, - MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, - }, - pallets = { - Balances: asset_hub_polkadot_runtime::Balances, - ParachainSystem: asset_hub_polkadot_runtime::ParachainSystem, - PolkadotXcm: asset_hub_polkadot_runtime::PolkadotXcm, - ForeignAssets: asset_hub_polkadot_runtime::ForeignAssets, - LocalAssets: asset_hub_polkadot_runtime::Assets, - } - }, pub struct Polimec { genesis = polimec::genesis(), on_init = polimec_runtime::AuraExt::on_initialize(1), @@ -111,7 +94,6 @@ decl_test_networks! { relay_chain = PolkadotRelay, parachains = vec![ Penpal, - AssetHub, Polimec, ], bridge = () @@ -121,18 +103,16 @@ decl_test_networks! { /// Shortcuts to reduce boilerplate on runtime types pub mod shortcuts { use super::{ - AssetHub, AssetHubParaPallet, Chain, Penpal, PenpalParaPallet, Polimec, PolimecParaPallet, PolkadotNet, - PolkadotRelay as Polkadot, PolkadotRelayRelayPallet, + Chain, Penpal, PenpalParaPallet, Polimec, PolimecParaPallet, PolkadotNet, PolkadotRelay as Polkadot, + PolkadotRelayRelayPallet, }; pub type PolkaNet = Polkadot; pub type PolimecNet = Polimec; pub type PenNet = Penpal; - pub type AssetNet = AssetHub; pub type PolkadotRuntime = ::Runtime; pub type PenpalRuntime = ::Runtime; - pub type AssetHubRuntime = ::Runtime; pub type PolimecRuntime = ::Runtime; pub type PolimecFunding = ::Funding; @@ -141,42 +121,33 @@ pub mod shortcuts { pub type PolkadotXcmPallet = ::XcmPallet; pub type PenpalXcmPallet = ::PolkadotXcm; - pub type AssetHubXcmPallet = ::PolkadotXcm; pub type PolimecXcmPallet = ::PolkadotXcm; pub type PolkadotBalances = ::Balances; pub type PenpalBalances = ::Balances; - pub type AssetHubBalances = ::Balances; pub type PolimecBalances = ::Balances; pub type PenpalAssets = ::Assets; - pub type AssetHubAssets = ::LocalAssets; - pub type AssetHubForeignAssets = ::ForeignAssets; pub type PolimecForeignAssets = ::ForeignAssets; pub type PolkadotOrigin = ::RuntimeOrigin; pub type PenpalOrigin = ::RuntimeOrigin; - pub type AssetHubOrigin = ::RuntimeOrigin; pub type PolimecOrigin = ::RuntimeOrigin; pub type PolkadotCall = ::RuntimeCall; pub type PenpalCall = ::RuntimeCall; - pub type AssetHubCall = ::RuntimeCall; pub type PolimecCall = ::RuntimeCall; pub type PolkadotAccountId = ::AccountId; pub type PenpalAccountId = ::AccountId; - pub type AssetHubAccountId = ::AccountId; pub type PolimecAccountId = ::AccountId; pub type PolkadotEvent = ::RuntimeEvent; pub type PenpalEvent = ::RuntimeEvent; - pub type AssetHubEvent = ::RuntimeEvent; pub type PolimecEvent = ::RuntimeEvent; pub type PolkadotSystem = ::System; pub type PenpalSystem = ::System; - pub type AssetHubSystem = ::System; pub type PolimecSystem = ::System; } pub use shortcuts::*; diff --git a/integration-tests/src/tests/credentials.rs b/integration-tests/src/tests/credentials.rs index 921286120..153241fcf 100644 --- a/integration-tests/src/tests/credentials.rs +++ b/integration-tests/src/tests/credentials.rs @@ -53,7 +53,7 @@ fn test_jwt_verification() { }); } -generate_accounts!(EMPTY_ACCOUNT); +macros::generate_accounts!(EMPTY_ACCOUNT); #[test] fn dispenser_signed_extensions_pass_for_new_account() { diff --git a/integration-tests/src/tests/ethereum_support.rs b/integration-tests/src/tests/ethereum_support.rs index 37c5c838c..2fff046b4 100644 --- a/integration-tests/src/tests/ethereum_support.rs +++ b/integration-tests/src/tests/ethereum_support.rs @@ -2,7 +2,7 @@ use crate::*; use hex_literal::hex; use sp_runtime::traits::Convert; -generate_accounts!(ETH_BUYER); +macros::generate_accounts!(ETH_BUYER); #[test] fn test_hardcoded_signatures() { diff --git a/integration-tests/src/tests/mod.rs b/integration-tests/src/tests/mod.rs index fc2e2050e..83e359020 100644 --- a/integration-tests/src/tests/mod.rs +++ b/integration-tests/src/tests/mod.rs @@ -23,8 +23,6 @@ mod evaluator_slash_sideffects; mod governance; mod oracle; mod otm_edge_cases; -mod reserve_backed_transfers; mod runtime_apis; mod transaction_payment; mod vest; -mod xcm_config; diff --git a/integration-tests/src/tests/reserve_backed_transfers.rs b/integration-tests/src/tests/reserve_backed_transfers.rs index ef8856dd4..e69de29bb 100644 --- a/integration-tests/src/tests/reserve_backed_transfers.rs +++ b/integration-tests/src/tests/reserve_backed_transfers.rs @@ -1,412 +0,0 @@ -// Polimec Blockchain – https://www.polimec.org/ -// Copyright (C) Polimec 2022. All rights reserved. - -// The Polimec Blockchain is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Polimec Blockchain is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::*; -use frame_support::{ - traits::{ - fungible::{Inspect as FungibleInspect, Mutate as FMutate, Unbalanced}, - fungibles::{Inspect, Mutate}, - PalletInfoAccess, - }, - weights::WeightToFee, -}; -use polimec_common::assets::AcceptedFundingAsset; -use sp_runtime::DispatchError; -use xcm_emulator::Parachain; - -const RESERVE_TRANSFER_AMOUNT: u128 = 10_0_000_000_000; // 10 DOT -const MAX_REF_TIME: u64 = 5_000_000_000; -const MAX_PROOF_SIZE: u64 = 200_000; - -fn create_asset_on_asset_hub(asset: Location) { - let admin_account = AssetNet::account_id_of(FERDIE); - AssetNet::execute_with(|| match asset.unpack() { - (1, [Parachain(1000), PalletInstance(50), GeneralIndex(id)]) => { - assert_ok!(AssetHubAssets::force_create( - AssetHubOrigin::root(), - (*id as u32).into(), - sp_runtime::MultiAddress::Id(admin_account.clone()), - true, - 0_0_010_000_000u128 - )); - }, - weth if weth == AcceptedFundingAsset::WETH.id().unpack() => { - assert_ok!(AssetHubForeignAssets::force_create( - AssetHubOrigin::root(), - asset.try_into().unwrap(), - sp_runtime::MultiAddress::Id(admin_account.clone()), - true, - 0_000_041_000_000_000_000 - )); - }, - (1, []) => {}, - _ => unreachable!("Unexpected Asset"), - }) -} - -fn mint_asset_on_asset_hub_to(asset: Location, recipient: &AssetHubAccountId, amount: u128) { - AssetNet::execute_with(|| match asset.unpack() { - (1, [Parachain(1000), PalletInstance(50), GeneralIndex(id)]) => { - assert_ok!(AssetHubAssets::mint_into(*id as u32, recipient, amount)); - }, - weth if weth == AcceptedFundingAsset::WETH.id().unpack() => { - assert_ok!(AssetHubForeignAssets::mint_into(asset.try_into().unwrap(), recipient, amount)); - }, - (1, []) => { - assert_ok!(AssetHubBalances::mint_into(recipient, amount)); - }, - _ => unreachable!("Unexpected Asset"), - }) -} - -fn get_polimec_balances(asset: Location, user_account: AccountId) -> (u128, u128, u128, u128) { - PolimecNet::execute_with(|| { - ( - PolimecForeignAssets::balance(asset.clone(), user_account.clone()), - PolimecBalances::balance(&user_account.clone()), - PolimecForeignAssets::total_issuance(asset), - PolimecBalances::total_issuance(), - ) - }) -} - -fn get_asset_hub_balances(asset: Location, user_account: AccountId, polimec_account: AccountId) -> (u128, u128, u128) { - AssetNet::execute_with(|| match asset.unpack() { - (1, [Parachain(1000), PalletInstance(50), GeneralIndex(id)]) => { - let id = *id as u32; - ( - AssetHubAssets::balance(id, user_account.clone()), - AssetHubAssets::balance(id, polimec_account.clone()), - AssetHubAssets::total_issuance(id), - ) - }, - weth if weth == AcceptedFundingAsset::WETH.id().unpack() => { - let multilocation = asset.try_into().unwrap(); - ( - AssetHubForeignAssets::balance(multilocation, user_account.clone()), - AssetHubForeignAssets::balance(multilocation, polimec_account.clone()), - AssetHubForeignAssets::total_issuance(multilocation), - ) - }, - (1, []) => ( - AssetHubBalances::balance(&user_account), - AssetHubBalances::balance(&polimec_account), - AssetHubBalances::total_issuance(), - ), - _ => unreachable!("Asset unsupported"), - }) -} - -/// Test the reserve based transfer from asset_hub to Polimec. Depending of the asset_id we -/// transfer either USDT, USDC and DOT. -fn test_reserve_to_polimec(asset: Location) { - create_asset_on_asset_hub(asset.clone()); - - let alice_account = PolimecNet::account_id_of(ALICE); - let polimec_sibling_account = - AssetNet::sovereign_account_id_of((Parent, Parachain(PolimecNet::para_id().into())).into()); - let max_weight = Weight::from_parts(MAX_REF_TIME, MAX_PROOF_SIZE); - - mint_asset_on_asset_hub_to(asset.clone(), &alice_account, 100_0_000_000_000); - - let ( - polimec_prev_alice_asset_balance, - polimec_prev_alice_plmc_balance, - polimec_prev_asset_issuance, - polimec_prev_plmc_issuance, - ) = get_polimec_balances(asset.clone(), alice_account.clone()); - - // check AssetHub's pre transfer balances and issuance - let (asset_hub_prev_alice_asset_balance, asset_hub_prev_polimec_asset_balance, asset_hub_prev_asset_issuance) = - get_asset_hub_balances(asset.clone(), alice_account.clone(), polimec_sibling_account.clone()); - - AssetNet::execute_with(|| { - let mut local_asset = asset.clone(); - - local_asset = asset - .clone() - .reanchored(&(Parent, Parachain(1000)).into(), &[GlobalConsensus(NetworkId::Polkadot)].into()) - .unwrap(); - let asset_transfer: Asset = (local_asset.clone(), RESERVE_TRANSFER_AMOUNT).into(); - let origin = AssetHubOrigin::signed(alice_account.clone()); - let dest: VersionedLocation = ParentThen(Parachain(PolimecNet::para_id().into()).into()).into(); - let beneficiary: VersionedLocation = AccountId32 { network: None, id: alice_account.clone().into() }.into(); - let assets: VersionedAssets = asset_transfer.into(); - let fee_asset_item = 0; - let weight_limit = Unlimited; - - let call = AssetHubXcmPallet::limited_reserve_transfer_assets( - origin, - bx!(dest), - bx!(beneficiary), - bx!(assets), - fee_asset_item, - weight_limit, - ); - assert_ok!(call); - }); - - // check the transfer was not blocked by our our xcm configured - PolimecNet::execute_with(|| { - assert_expected_events!( - PolimecNet, - vec![ - PolimecEvent::MessageQueue(pallet_message_queue::Event::Processed {success: true, ..}) => {}, - ] - ); - }); - - let ( - polimec_post_alice_asset_balance, - polimec_post_alice_plmc_balance, - polimec_post_asset_issuance, - polimec_post_plmc_issuance, - ) = get_polimec_balances(asset.clone(), alice_account.clone()); - - let (asset_hub_post_alice_asset_balance, asset_hub_post_polimec_asset_balance, asset_hub_post_asset_issuance) = - get_asset_hub_balances(asset, alice_account.clone(), polimec_sibling_account.clone()); - - let polimec_delta_alice_asset_balance = polimec_post_alice_asset_balance.abs_diff(polimec_prev_alice_asset_balance); - let polimec_delta_alice_plmc_balance = polimec_post_alice_plmc_balance.abs_diff(polimec_prev_alice_plmc_balance); - let polimec_delta_asset_issuance = polimec_post_asset_issuance.abs_diff(polimec_prev_asset_issuance); - let polimec_delta_plmc_issuance = polimec_post_plmc_issuance.abs_diff(polimec_prev_plmc_issuance); - let asset_hub_delta_alice_asset_balance = - asset_hub_post_alice_asset_balance.abs_diff(asset_hub_prev_alice_asset_balance); - let asset_hub_delta_polimec_asset_balance = - asset_hub_post_polimec_asset_balance.abs_diff(asset_hub_prev_polimec_asset_balance); - let asset_hub_delta_asset_issuance = asset_hub_post_asset_issuance.abs_diff(asset_hub_prev_asset_issuance); - - assert!( - polimec_delta_alice_asset_balance >= RESERVE_TRANSFER_AMOUNT - polimec_runtime::WeightToFee::weight_to_fee(&max_weight) && - polimec_delta_alice_asset_balance <= RESERVE_TRANSFER_AMOUNT, - "Polimec alice_account.clone() Asset balance should have increased by at least the transfer amount minus the XCM execution fee" - ); - - assert!( - polimec_delta_asset_issuance >= - RESERVE_TRANSFER_AMOUNT - polimec_runtime::WeightToFee::weight_to_fee(&max_weight) && - polimec_delta_asset_issuance <= RESERVE_TRANSFER_AMOUNT, - "Polimec Asset issuance should have increased by at least the transfer amount minus the XCM execution fee" - ); - - // We overapproximate the fee for delivering the assets to polimec. The actual fee is - // probably lower. - let fee = system_parachains_constants::polkadot::fee::WeightToFee::weight_to_fee(&max_weight); - assert!( - asset_hub_delta_alice_asset_balance <= RESERVE_TRANSFER_AMOUNT + fee && - asset_hub_delta_alice_asset_balance >= RESERVE_TRANSFER_AMOUNT, - "AssetHub alice_account.clone() Asset balance should have decreased by the transfer amount" - ); - - assert!( - asset_hub_delta_polimec_asset_balance == RESERVE_TRANSFER_AMOUNT, - "The USDT balance of Polimec's sovereign account on AssetHub should receive the transfer amount" - ); - - assert!( - asset_hub_delta_asset_issuance == 0u128, - "AssetHub's USDT issuance should not change, since it acts as a reserve for that asset" - ); - - assert_eq!( - polimec_delta_alice_plmc_balance, 0, - "Polimec alice_account.clone() PLMC balance should not have changed" - ); - - assert_eq!(polimec_delta_plmc_issuance, 0, "Polimec PLMC issuance should not have changed"); -} - -fn test_polimec_to_reserve(asset: Location) { - create_asset_on_asset_hub(asset.clone()); - - let alice_account = PolimecNet::account_id_of(ALICE); - let polimec_sibling_account = - AssetNet::sovereign_account_id_of((Parent, Parachain(PolimecNet::para_id().into())).into()); - let max_weight = Weight::from_parts(MAX_REF_TIME, MAX_PROOF_SIZE); - - mint_asset_on_asset_hub_to(asset.clone(), &polimec_sibling_account, RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000); - - PolimecNet::execute_with(|| { - assert_ok!(PolimecForeignAssets::mint_into( - asset.clone(), - &alice_account, - RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000 - )); - }); - - let ( - polimec_prev_alice_asset_balance, - polimec_prev_alice_plmc_balance, - polimec_prev_asset_issuance, - polimec_prev_plmc_issuance, - ) = get_polimec_balances(asset.clone(), alice_account.clone()); - - // check AssetHub's pre transfer balances and issuance - let (asset_hub_prev_alice_asset_balance, asset_hub_prev_polimec_asset_balance, asset_hub_prev_asset_issuance) = - get_asset_hub_balances(asset.clone(), alice_account.clone(), polimec_sibling_account.clone()); - - PolimecNet::execute_with(|| { - let asset_transfer: Asset = (asset.clone(), RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000).into(); - let origin = PolimecOrigin::signed(alice_account.clone()); - let dest: VersionedLocation = ParentThen((Parachain(AssetNet::para_id().into())).into()).into(); - - let beneficiary: VersionedLocation = AccountId32 { network: None, id: alice_account.clone().into() }.into(); - let assets: VersionedAssets = asset_transfer.into(); - let fee_asset_item = 0; - let weight_limit = Unlimited; - - let call = PolimecXcmPallet::limited_reserve_transfer_assets( - origin, - bx!(dest), - bx!(beneficiary), - bx!(assets), - fee_asset_item, - weight_limit, - ); - assert_ok!(call); - }); - - // check that the xcm was not blocked - AssetNet::execute_with(|| { - assert_expected_events!( - AssetNet, - vec![ - AssetHubEvent::MessageQueue(pallet_message_queue::Event::Processed {success: true, ..}) => {}, - ] - ); - }); - - let ( - polimec_post_alice_asset_balance, - polimec_post_alice_plmc_balance, - polimec_post_asset_issuance, - polimec_post_plmc_issuance, - ) = get_polimec_balances(asset.clone(), alice_account.clone()); - - let (asset_hub_post_alice_asset_balance, asset_hub_post_polimec_asset_balance, asset_hub_post_asset_issuance) = - get_asset_hub_balances(asset, alice_account.clone(), polimec_sibling_account.clone()); - - let polimec_delta_alice_asset_balance = polimec_post_alice_asset_balance.abs_diff(polimec_prev_alice_asset_balance); - let polimec_delta_alice_plmc_balance = polimec_post_alice_plmc_balance.abs_diff(polimec_prev_alice_plmc_balance); - let polimec_delta_asset_issuance = polimec_post_asset_issuance.abs_diff(polimec_prev_asset_issuance); - let polimec_delta_plmc_issuance = polimec_post_plmc_issuance.abs_diff(polimec_prev_plmc_issuance); - let asset_hub_delta_alice_asset_balance = - asset_hub_post_alice_asset_balance.abs_diff(asset_hub_prev_alice_asset_balance); - let asset_hub_delta_polimec_asset_balance = - asset_hub_post_polimec_asset_balance.abs_diff(asset_hub_prev_polimec_asset_balance); - let asset_hub_delta_asset_issuance = asset_hub_post_asset_issuance.abs_diff(asset_hub_prev_asset_issuance); - - assert_eq!( - polimec_delta_alice_asset_balance, - RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000, - "Polimec's alice_account Asset balance should decrease by the transfer amount" - ); - - assert_eq!( - polimec_delta_asset_issuance, - RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000, - "Polimec's Asset issuance should decrease by transfer amount due to burn" - ); - - assert_eq!(polimec_delta_plmc_issuance, 0, "Polimec's PLMC issuance should not change, since all xcm token transfer are done in Asset, and no fees are burnt since no extrinsics are dispatched"); - assert_eq!(polimec_delta_alice_plmc_balance, 0, "Polimec's Alice PLMC should not change"); - - assert!( - asset_hub_delta_alice_asset_balance >= - RESERVE_TRANSFER_AMOUNT && - asset_hub_delta_alice_asset_balance <= RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000, - "AssetHub's alice_account Asset balance should increase by at least the transfer amount minus the max allowed fees" - ); - - assert!( - asset_hub_delta_polimec_asset_balance >= RESERVE_TRANSFER_AMOUNT && - asset_hub_delta_polimec_asset_balance <= RESERVE_TRANSFER_AMOUNT + 1_0_000_000_000, - "Polimecs sovereign account on asset hub should have transferred Asset amount to Alice" - ); - - assert!( - asset_hub_delta_asset_issuance <= system_parachains_constants::polkadot::fee::WeightToFee::weight_to_fee(&max_weight), - "AssetHub's Asset issuance should not change, since it acts as a reserve for that asset (except for fees which are burnt)" - ); -} - -/// Test reserve based transfer of USDT from AssetHub to Polimec. -#[test] -fn reserve_usdt_to_polimec() { - let asset = AcceptedFundingAsset::USDT.id(); - test_reserve_to_polimec(asset); -} - -/// Test reserve based transfer of USDC from AssetHub to Polimec. -#[test] -fn reserve_usdc_to_polimec() { - let asset = AcceptedFundingAsset::USDC.id(); - test_reserve_to_polimec(asset); -} - -/// Test reserve based transfer of DOT from AssetHub to Polimec. -#[test] -fn reserve_dot_to_polimec() { - let asset = AcceptedFundingAsset::DOT.id(); - test_reserve_to_polimec(asset); -} - -/// Test that reserve based transfer of random asset from AssetHub to Polimec fails. -#[test] -#[should_panic] -fn reserve_random_asset_to_polimec() { - let asset: Location = (Parent, Parachain(1000), PalletInstance(50), GeneralIndex(420)).into(); - test_reserve_to_polimec(asset); -} - -/// Test transfer of reserve-based DOT from Polimec back to AssetHub. -#[test] -fn polimec_usdt_to_reserve() { - let asset = AcceptedFundingAsset::USDT.id(); - test_polimec_to_reserve(asset); -} - -/// Test transfer of reserve-based DOT from Polimec back to AssetHub. -#[test] -fn polimec_usdc_to_reserve() { - let asset = AcceptedFundingAsset::USDC.id(); - test_polimec_to_reserve(asset); -} - -/// Test transfer of reserve-based DOT from Polimec back to AssetHub. -#[test] -fn polimec_dot_to_reserve() { - let asset = AcceptedFundingAsset::DOT.id(); - test_polimec_to_reserve(asset); -} - -#[test] -fn test_user_cannot_create_foreign_asset_on_polimec() { - let asset: Location = (Parent, Parachain(1000), PalletInstance(50), GeneralIndex(420)).into(); - - PolimecNet::execute_with(|| { - let admin = AssetNet::account_id_of(ALICE); - assert_noop!( - PolimecForeignAssets::create( - PolimecOrigin::signed(admin.clone()), - asset.into(), - sp_runtime::MultiAddress::Id(admin), - 0_0_010_000_000u128, - ), - DispatchError::BadOrigin - ); - }); -} diff --git a/integration-tests/src/tests/runtime_apis.rs b/integration-tests/src/tests/runtime_apis.rs index e293de066..8a0f733c6 100644 --- a/integration-tests/src/tests/runtime_apis.rs +++ b/integration-tests/src/tests/runtime_apis.rs @@ -1,10 +1,14 @@ use crate::{constants::*, *}; use assets_common::runtime_api::runtime_decl_for_fungibles_api::FungiblesApiV2; -use frame_support::traits::{fungible::Inspect, fungibles::Mutate}; +use frame_support::traits::{ + fungible::{Inspect, Mutate as FMutate}, + fungibles::Mutate, +}; use polimec_common::assets::AcceptedFundingAsset; use sp_arithmetic::FixedU128; use xcm::v4::Junctions::X3; use xcm_fee_payment_runtime_api::fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1; + mod xcm_payment_api { use super::*; use itertools::Itertools; @@ -76,21 +80,29 @@ mod fungibles_api { PolimecNet::execute_with(|| { let alice_account = PolimecNet::account_id_of(accounts::ALICE); - assert_ok!(PolimecForeignAssets::mint_into( - AcceptedFundingAsset::DOT.id(), - &alice_account, - 100_0_000_000_000 - )); - assert_ok!(PolimecForeignAssets::mint_into(AcceptedFundingAsset::USDT.id(), &alice_account, 100_000)); - assert_ok!(PolimecForeignAssets::mint_into(AcceptedFundingAsset::USDC.id(), &alice_account, 100_000)); - assert_ok!(PolimecForeignAssets::mint_into( + PolimecBalances::set_balance(&alice_account, 150_0_000_000_000_u128); + PolimecForeignAssets::set_balance(AcceptedFundingAsset::DOT.id(), &alice_account, 100_0_000_000_000_u128); + PolimecForeignAssets::set_balance(AcceptedFundingAsset::USDT.id(), &alice_account, 100_000_u128); + PolimecForeignAssets::set_balance(AcceptedFundingAsset::USDC.id(), &alice_account, 100_000_u128); + PolimecForeignAssets::set_balance( AcceptedFundingAsset::WETH.id(), &alice_account, - 100_000_000_000_000 - )); + 100_000_000_000_000_u128, + ); + + let alice_assets = PolimecRuntime::query_account_balances(alice_account).unwrap(); - let alice_assets = PolimecRuntime::query_account_balances(alice_account); - dbg!(alice_assets).unwrap(); + let expected_assets = VersionedAssets::V4( + vec![ + Asset::from((Location::here(), 150_0_000_000_000_u128)), + Asset::from((AcceptedFundingAsset::DOT.id(), 100_0_000_000_000_u128)), + Asset::from((AcceptedFundingAsset::USDC.id(), 100_000_u128)), + Asset::from((AcceptedFundingAsset::USDT.id(), 100_000_u128)), + Asset::from((AcceptedFundingAsset::WETH.id(), 100_000_000_000_000_u128)), + ] + .into(), + ); + assert_eq!(alice_assets, expected_assets); }); } } diff --git a/integration-tests/src/tests/xcm_config.rs b/integration-tests/src/tests/xcm_config.rs index a45aa860a..e69de29bb 100644 --- a/integration-tests/src/tests/xcm_config.rs +++ b/integration-tests/src/tests/xcm_config.rs @@ -1,107 +0,0 @@ -use crate::{PolimecAccountId, PolimecBalances, PolimecCall, PolimecForeignAssets, PolimecNet, PolimecRuntime, ALICE}; -use parity_scale_codec::Encode; -use polimec_runtime::{xcm_config::SupportedAssets, TreasuryAccount}; -use sp_runtime::traits::MaybeEquivalence; -use xcm::prelude::*; -use xcm_emulator::{Chain, TestExt}; -pub fn fake_message_hash(message: &Xcm) -> XcmHash { - message.using_encoded(sp_io::hashing::blake2_256) -} - -#[test] -fn execution_fees_go_to_treasury() { - let dot_amount = Asset { id: AssetId(Location::parent()), fun: Fungible(100_0_000_000_000) }; - let usdt_amount = Asset { - id: AssetId(Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)])), - fun: Fungible(100_000_000), - }; - let usdc_amount = Asset { - id: AssetId(Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1337)])), - fun: Fungible(100_000_000), - }; - - let beneficiary: PolimecAccountId = [0u8; 32].into(); - - let assert_reserve_asset_fee_goes_to_treasury = |asset: Asset| { - let asset_id = asset.id.0.clone(); - let asset_amount = if let Fungible(amount) = asset.fun { amount } else { unreachable!() }; - - let xcm = Xcm::(vec![ - ReserveAssetDeposited(vec![asset.clone()].into()), - ClearOrigin, - BuyExecution { fees: asset, weight_limit: Unlimited }, - DepositAsset { - assets: WildAsset::All.into(), - beneficiary: Location::new(0, [AccountId32 { network: None, id: beneficiary.clone().into() }]), - }, - ]); - PolimecNet::execute_with(|| { - let prev_treasury_balance = PolimecForeignAssets::balance(asset_id.clone(), TreasuryAccount::get()); - let prev_beneficiary_balance = PolimecForeignAssets::balance(asset_id.clone(), beneficiary.clone()); - - let outcome = ::XcmExecutor::prepare_and_execute( - Location::new(1, [Parachain(1000)]), - xcm.clone(), - &mut fake_message_hash(&xcm), - Weight::MAX, - Weight::zero(), - ); - assert!(outcome.ensure_complete().is_ok()); - - let post_treasury_balance = PolimecForeignAssets::balance(asset_id.clone(), TreasuryAccount::get()); - let post_beneficiary_balance = PolimecForeignAssets::balance(asset_id, beneficiary.clone()); - - let net_treasury_balance = post_treasury_balance - prev_treasury_balance; - let net_beneficiary_balance = post_beneficiary_balance - prev_beneficiary_balance; - - let net_total = net_treasury_balance + net_beneficiary_balance; - - assert_eq!(net_total, asset_amount); - assert!(net_treasury_balance > 0); - }); - }; - - let assert_plmc_fee_goes_to_treasury = || { - let asset_amount = 100_0_000_000_000; - let asset = Asset { id: AssetId(Location::here()), fun: Fungible(asset_amount) }; - - let xcm = Xcm::(vec![ - WithdrawAsset(vec![asset.clone()].into()), - BuyExecution { fees: asset, weight_limit: Unlimited }, - DepositAsset { - assets: WildAsset::All.into(), - beneficiary: Location::new(0, [AccountId32 { network: None, id: beneficiary.clone().into() }]), - }, - ]); - - PolimecNet::execute_with(|| { - let prev_treasury_balance = PolimecBalances::free_balance(TreasuryAccount::get()); - let prev_beneficiary_balance = PolimecBalances::free_balance(beneficiary.clone()); - - let outcome = ::XcmExecutor::prepare_and_execute( - Location::new(0, [AccountId32 { network: None, id: PolimecNet::account_id_of(ALICE).into() }]), - xcm.clone(), - &mut fake_message_hash(&xcm), - Weight::MAX, - Weight::zero(), - ); - assert!(outcome.ensure_complete().is_ok()); - - let post_treasury_balance = PolimecBalances::free_balance(TreasuryAccount::get()); - let post_beneficiary_balance = PolimecBalances::free_balance(beneficiary.clone()); - - let net_treasury_balance = post_treasury_balance - prev_treasury_balance; - let net_beneficiary_balance = post_beneficiary_balance - prev_beneficiary_balance; - - let net_total = net_treasury_balance + net_beneficiary_balance; - - assert_eq!(net_total, asset_amount); - assert!(net_treasury_balance > 0); - }); - }; - - assert_reserve_asset_fee_goes_to_treasury(dot_amount); - assert_reserve_asset_fee_goes_to_treasury(usdt_amount); - assert_reserve_asset_fee_goes_to_treasury(usdc_amount); - assert_plmc_fee_goes_to_treasury(); -} diff --git a/pallets/funding/src/mock.rs b/pallets/funding/src/mock.rs index 05b9c8098..72d9a0054 100644 --- a/pallets/funding/src/mock.rs +++ b/pallets/funding/src/mock.rs @@ -210,7 +210,9 @@ impl pallet_assets::Config for TestRuntime { type WeightInfo = (); } +#[cfg(feature = "runtime-benchmarks")] pub struct PalletAssetsBenchmarkHelper; +#[cfg(feature = "runtime-benchmarks")] impl pallet_assets::BenchmarkHelper for PalletAssetsBenchmarkHelper { fn create_asset_id_parameter(id: u32) -> Location { (Parent, Parachain(id)).into() diff --git a/pallets/proxy-bonding/src/mock.rs b/pallets/proxy-bonding/src/mock.rs index 8e74c70f6..f858c6af7 100644 --- a/pallets/proxy-bonding/src/mock.rs +++ b/pallets/proxy-bonding/src/mock.rs @@ -78,7 +78,9 @@ impl pallet_balances::Config for TestRuntime { type RuntimeHoldReason = MockRuntimeHoldReason; } +#[cfg(feature = "runtime-benchmarks")] pub struct PalletAssetsBenchmarkHelper; +#[cfg(feature = "runtime-benchmarks")] impl pallet_assets::BenchmarkHelper for PalletAssetsBenchmarkHelper { fn create_asset_id_parameter(id: u32) -> Location { (Parent, Parachain(id)).into() @@ -89,6 +91,7 @@ impl pallet_assets::Config for TestRuntime { type AssetId = Location; type AssetIdParameter = Location; type Balance = ::Balance; + #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = PalletAssetsBenchmarkHelper; type CreateOrigin = AsEnsureOriginWithArg>; type Currency = Balances; diff --git a/runtimes/polimec/src/lib.rs b/runtimes/polimec/src/lib.rs index faf546097..8cf6ef3bd 100644 --- a/runtimes/polimec/src/lib.rs +++ b/runtimes/polimec/src/lib.rs @@ -17,11 +17,11 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] - // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); extern crate alloc; +use assets_common::fungible_conversion::{convert, convert_balance}; use core::ops::RangeInclusive; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; @@ -98,10 +98,7 @@ use alloc::string::String; use sp_core::crypto::Ss58Codec; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -use xcm::{ - v4::{Location}, - VersionedAssetId, -}; +use xcm::{v4::Location, VersionedAssetId}; #[cfg(feature = "runtime-benchmarks")] mod benchmark_helpers; @@ -1316,30 +1313,29 @@ mod benches { impl_runtime_apis! { impl assets_common::runtime_api::FungiblesApi for Runtime{ fn query_account_balances(account: AccountId) -> Result { - // Ok([ - // // collect pallet_balance - // { - // let balance = Balances::balance(&account); - // if balance > 0 { - // vec![convert_balance::(balance)?] - // } else { - // vec![] - // } - // }, - // // collect pallet_assets (ContributionTokens) - // convert::<_, _, _, _, xcm_config::ContributionTokensConvertedConcreteId>( - // ContributionTokens::account_balances(account.clone()) - // .iter() - // .filter(|(_, balance)| balance > &0) - // )?, - // // collect pallet_assets (ForeignAssets) - // convert::<_, _, _, _, xcm_config::ForeignAssetsConvertedConcreteId>( - // ForeignAssets::account_balances(account) - // .iter() - // .filter(|(_, balance)| balance > &0) - // )?, - // ].concat().into()) - Ok(vec![].into()) + Ok([ + // collect pallet_balance + { + let balance = Balances::balance(&account); + if balance > 0 { + vec![convert_balance::(balance)?] + } else { + vec![] + } + }, + // collect pallet_assets (ContributionTokens) + convert::<_, _, _, _, xcm_config::ContributionTokensConvertedConcreteId>( + ContributionTokens::account_balances(account.clone()) + .iter() + .filter(|(_, balance)| balance > &0) + )?, + // collect pallet_assets (ForeignAssets) + convert::<_, _, _, _, xcm_config::ForeignAssetsConvertedConcreteId>( + ForeignAssets::account_balances(account) + .iter() + .filter(|(_, balance)| balance > &0) + )?, + ].concat().into()) } } diff --git a/runtimes/polimec/src/xcm_config.rs b/runtimes/polimec/src/xcm_config.rs index b14d8dcef..a82957f56 100644 --- a/runtimes/polimec/src/xcm_config.rs +++ b/runtimes/polimec/src/xcm_config.rs @@ -42,7 +42,8 @@ use xcm_builder::{ FixedRateOfFungible, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, MatchXcm, MatchedConvertedConcreteId, MintLocation, NoChecking, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, + SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit, TrailingSetTopicAsId, + UsingComponents, WithComputedOrigin, }; use xcm_executor::{ traits::{JustTry, Properties, ShouldExecute}, @@ -69,6 +70,7 @@ parameter_types! { GlobalConsensus(Polkadot), Parachain(ParachainInfo::parachain_id().into()), ).into(); + pub UniversalLocationNetworkId: NetworkId = UniversalLocation::get().global_consensus().unwrap(); pub const HereLocation: Location = Location::here(); pub AssetHubLocation: Location = (Parent, Parachain(1000)).into(); pub CheckAccount: AccountId = PolkadotXcm::check_account(); @@ -113,8 +115,21 @@ pub type FungibleTransactor = FungibleAdapter< >; /// `AssetId`/`Balance` converter for `ForeignAssets`. -pub type ForeignAssetsConvertedConcreteId = - assets_common::TrustBackedAssetsConvertedConcreteId; +/// `AssetId`/`Balance` converter for `ForeignAssets` +pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConvertedConcreteId< + ( + // Ignore `TrustBackedAssets` explicitly + StartsWith, + // Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means: + // - foreign assets from our consensus should be: `Location {parents: 1, X*(Parachain(xyz), + // ..)}` + // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't + // be accepted here + StartsWithExplicitGlobalConsensus, + ), + Balance, + xcm::v4::Location, +>; /// `AssetId`/`Balance` converter for `ContributionTokens`. pub type ContributionTokensConvertedConcreteId =