From 7973ce3eaaf329cceadee09791a6dd3f6f70a394 Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 15 Apr 2024 15:57:45 +0800 Subject: [PATCH 01/11] Fix validate in xcm-bridge-hub-router --- bridges/modules/xcm-bridge-hub-router/src/lib.rs | 4 ++-- .../tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bridges/modules/xcm-bridge-hub-router/src/lib.rs b/bridges/modules/xcm-bridge-hub-router/src/lib.rs index 5d0be41b1b55..85d7b0a66179 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/lib.rs @@ -341,8 +341,8 @@ impl, I: 'static> SendXcm for Pallet { // versioned message to the sibling bridge hub. However, the local bridge hub may have a // higher XCM version than the remote `dest`. Once again, it is better to discard such // messages here than at the bridge hub (e.g., to avoid losing funds). - let destination_version = T::DestinationVersion::get_version_for(dest_ref) - .ok_or(SendError::DestinationUnsupported)?; + let destination_version = + T::DestinationVersion::get_version_for(dest_ref).ok_or(SendError::NotApplicable)?; let _ = VersionedXcm::from(xcm_ref.clone()) .into_version(destination_version) .map_err(|()| SendError::DestinationUnsupported)?; diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs index 3ce3bc94c700..d529927028ee 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs @@ -388,10 +388,6 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { AssetHubRococo::force_default_xcm_version(Some(XCM_VERSION)); BridgeHubRococo::force_default_xcm_version(Some(XCM_VERSION)); - AssetHubRococo::force_xcm_version( - Location::new(2, [GlobalConsensus(Ethereum { chain_id: CHAIN_ID })]), - XCM_VERSION, - ); BridgeHubRococo::fund_accounts(vec![(assethub_sovereign.clone(), INITIAL_FUND)]); AssetHubRococo::fund_accounts(vec![(AssetHubRococoReceiver::get(), INITIAL_FUND)]); From 76faf205736474f50077a0985787cba13653e32a Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 15 Apr 2024 21:08:36 +0800 Subject: [PATCH 02/11] Take send cost into consideration --- Cargo.lock | 16 + bridges/snowbridge/Cargo.lock | 1636 +++++------------ bridges/snowbridge/Cargo.toml | 1 + .../inbound-queue/runtime-api/Cargo.toml | 38 + .../inbound-queue/runtime-api/src/lib.rs | 14 + .../pallets/inbound-queue/src/api.rs | 44 + .../pallets/inbound-queue/src/lib.rs | 41 +- .../pallets/inbound-queue/src/mock.rs | 23 + .../snowbridge/primitives/core/src/inbound.rs | 9 + .../bridges/bridge-hub-rococo/Cargo.toml | 1 + .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 + .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 33 +- 12 files changed, 670 insertions(+), 1188 deletions(-) create mode 100644 bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml create mode 100644 bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs create mode 100644 bridges/snowbridge/pallets/inbound-queue/src/api.rs diff --git a/Cargo.lock b/Cargo.lock index c17b59c6af28..546c2ef4a2d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2036,6 +2036,7 @@ dependencies = [ "rococo-westend-system-emulated-network", "scale-info", "snowbridge-core", + "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", @@ -2113,6 +2114,7 @@ dependencies = [ "serde", "snowbridge-beacon-primitives", "snowbridge-core", + "snowbridge-inbound-queue-runtime-api", "snowbridge-outbound-queue-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-inbound-queue", @@ -18659,6 +18661,20 @@ dependencies = [ "wasm-bindgen-test", ] +[[package]] +name = "snowbridge-inbound-queue-runtime-api" +version = "0.2.0" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "snowbridge-core", + "snowbridge-router-primitives", + "sp-api", + "sp-std 14.0.0", + "staging-xcm", +] + [[package]] name = "snowbridge-milagro-bls" version = "1.5.4" diff --git a/bridges/snowbridge/Cargo.lock b/bridges/snowbridge/Cargo.lock index f090b5a0395d..b44ee684ab38 100644 --- a/bridges/snowbridge/Cargo.lock +++ b/bridges/snowbridge/Cargo.lock @@ -43,7 +43,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -105,22 +105,10 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" dependencies = [ - "alloy-rlp-derive", - "arrayvec 0.7.4", + "arrayvec", "bytes", ] -[[package]] -name = "alloy-rlp-derive" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.50", -] - [[package]] name = "alloy-sol-macro" version = "0.4.2" @@ -133,7 +121,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", "syn-solidity", "tiny-keccak", ] @@ -174,6 +162,54 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.80" @@ -200,7 +236,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -568,89 +604,21 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "asset-test-utils" -version = "7.0.0" -dependencies = [ - "cumulus-pallet-parachain-system", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "frame-support", - "frame-system", - "pallet-assets", - "pallet-balances", - "pallet-collator-selection", - "pallet-session", - "pallet-timestamp", - "pallet-xcm", - "pallet-xcm-bridge-hub-router", - "parachains-common", - "parachains-runtimes-test-utils", - "parity-scale-codec", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", -] - -[[package]] -name = "assets-common" -version = "0.7.0" -dependencies = [ - "cumulus-primitives-core", - "frame-support", - "impl-trait-for-tuples", - "log", - "pallet-asset-conversion", - "pallet-xcm", - "parachains-common", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-runtime", - "sp-std 14.0.0", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", -] - [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "syn 2.0.59", ] [[package]] @@ -661,7 +629,7 @@ checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -698,7 +666,7 @@ dependencies = [ "ark-std 0.4.0", "dleq_vrf", "fflonk", - "merlin 3.0.0", + "merlin", "rand_chacha 0.3.1", "rand_core 0.6.4", "ring", @@ -735,19 +703,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bip39" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" -dependencies = [ - "bitcoin_hashes", - "rand", - "rand_core 0.6.4", - "serde", - "unicode-normalization", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -763,11 +718,21 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + [[package]] name = "bitcoin_hashes" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] [[package]] name = "bitflags" @@ -810,29 +775,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", - "arrayvec 0.7.4", + "arrayvec", "constant_time_eq", ] -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -841,16 +794,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -865,130 +809,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bp-header-chain" -version = "0.7.0" -dependencies = [ - "bp-runtime", - "finality-grandpa", - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-consensus-grandpa", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "bp-messages" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-runtime", - "frame-support", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-std 14.0.0", -] - -[[package]] -name = "bp-parachains" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-polkadot-core", - "bp-runtime", - "frame-support", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "bp-polkadot-core" -version = "0.7.0" -dependencies = [ - "bp-messages", - "bp-runtime", - "frame-support", - "frame-system", - "parity-scale-codec", - "parity-util-mem", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "bp-relayers" -version = "0.7.0" -dependencies = [ - "bp-messages", - "bp-runtime", - "frame-support", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "bp-runtime" -version = "0.7.0" -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 14.0.0", - "sp-trie", - "trie-db", -] - -[[package]] -name = "bp-test-utils" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-parachains", - "bp-polkadot-core", - "bp-runtime", - "ed25519-dalek", - "finality-grandpa", - "parity-scale-codec", - "sp-application-crypto", - "sp-consensus-grandpa", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", - "sp-trie", -] - -[[package]] -name = "bp-xcm-bridge-hub" -version = "0.2.0" -dependencies = [ - "sp-std 14.0.0", -] - [[package]] name = "bp-xcm-bridge-hub-router" version = "0.6.0" @@ -1001,7 +821,7 @@ dependencies = [ [[package]] name = "bridge-hub-common" -version = "0.0.0" +version = "0.1.0" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1015,80 +835,6 @@ dependencies = [ "staging-xcm", ] -[[package]] -name = "bridge-hub-test-utils" -version = "0.7.0" -dependencies = [ - "asset-test-utils", - "bp-header-chain", - "bp-messages", - "bp-polkadot-core", - "bp-relayers", - "bp-runtime", - "bp-test-utils", - "bridge-runtime-common", - "cumulus-pallet-parachain-system", - "cumulus-pallet-xcmp-queue", - "frame-support", - "frame-system", - "impl-trait-for-tuples", - "log", - "pallet-balances", - "pallet-bridge-grandpa", - "pallet-bridge-messages", - "pallet-bridge-parachains", - "pallet-bridge-relayers", - "pallet-timestamp", - "pallet-utility", - "parachains-common", - "parachains-runtimes-test-utils", - "parity-scale-codec", - "sp-core", - "sp-io", - "sp-keyring", - "sp-runtime", - "sp-std 14.0.0", - "sp-tracing 16.0.0", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", -] - -[[package]] -name = "bridge-runtime-common" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-messages", - "bp-parachains", - "bp-polkadot-core", - "bp-relayers", - "bp-runtime", - "bp-xcm-bridge-hub", - "bp-xcm-bridge-hub-router", - "frame-support", - "frame-system", - "hash-db", - "log", - "pallet-bridge-grandpa", - "pallet-bridge-messages", - "pallet-bridge-parachains", - "pallet-bridge-relayers", - "pallet-transaction-payment", - "pallet-utility", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "sp-trie", - "staging-xcm", - "staging-xcm-builder", - "static_assertions", -] - [[package]] name = "bs58" version = "0.5.0" @@ -1119,12 +865,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "bytemuck" version = "1.14.3" @@ -1221,6 +961,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "common" version = "0.1.0" @@ -1233,7 +979,7 @@ dependencies = [ "ark-std 0.4.0", "fflonk", "getrandom_or_panic", - "merlin 3.0.0", + "merlin", "rand_chacha 0.3.1", ] @@ -1402,7 +1148,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core 0.6.4", "subtle", "zeroize", @@ -1414,7 +1160,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", + "generic-array", "rand_core 0.6.4", "typenum", ] @@ -1425,37 +1171,10 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "generic-array 0.14.7", + "generic-array", "subtle", ] -[[package]] -name = "crypto-mac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fab6889090c8133f3deb8f73ba3c65a7f456f66436fc012a1b1e272b1e103e" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "cumulus-pallet-aura-ext" -version = "0.7.0" -dependencies = [ - "cumulus-pallet-parachain-system", - "frame-support", - "frame-system", - "pallet-aura", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-application-crypto", - "sp-consensus-aura", - "sp-runtime", - "sp-std 14.0.0", -] - [[package]] name = "cumulus-pallet-parachain-system" version = "0.7.0" @@ -1474,6 +1193,7 @@ dependencies = [ "pallet-message-queue", "parity-scale-codec", "polkadot-parachain-primitives", + "polkadot-runtime-common", "polkadot-runtime-parachains", "scale-info", "sp-core", @@ -1496,35 +1216,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", -] - -[[package]] -name = "cumulus-pallet-session-benchmarking" -version = "9.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-session", - "parity-scale-codec", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "cumulus-pallet-xcm" -version = "0.7.0" -dependencies = [ - "cumulus-primitives-core", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "staging-xcm", + "syn 2.0.59", ] [[package]] @@ -1576,38 +1268,18 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-inherents", - "sp-std 14.0.0", - "sp-trie", -] - -[[package]] -name = "cumulus-primitives-proof-size-hostfunction" -version = "0.2.0" -dependencies = [ - "sp-externalities 0.25.0", - "sp-runtime-interface 24.0.0", - "sp-trie", -] - -[[package]] -name = "cumulus-primitives-utility" -version = "0.7.0" -dependencies = [ - "cumulus-primitives-core", - "frame-support", - "log", - "pallet-asset-conversion", - "pallet-xcm-benchmarks", - "parity-scale-codec", - "polkadot-runtime-common", - "polkadot-runtime-parachains", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", + "sp-inherents", + "sp-std 14.0.0", + "sp-trie", +] + +[[package]] +name = "cumulus-primitives-proof-size-hostfunction" +version = "0.2.0" +dependencies = [ + "sp-externalities 0.25.0", + "sp-runtime-interface 24.0.0", + "sp-trie", ] [[package]] @@ -1623,19 +1295,6 @@ dependencies = [ "sp-trie", ] -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -1674,7 +1333,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -1701,7 +1360,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -1718,7 +1377,7 @@ checksum = "5d914fcc6452d133236ee067a9538be25ba6a644a450e1a6c617da84bf029854" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -1753,6 +1412,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-syn-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.59", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1766,22 +1436,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -1808,32 +1469,32 @@ dependencies = [ "ark-serialize 0.4.2", "ark-std 0.4.0", "ark-transcript", - "arrayvec 0.7.4", + "arrayvec", "zeroize", ] [[package]] name = "docify" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc4fd38aaa9fb98ac70794c82a00360d1e165a87fbf96a8a91f9dfc602aaee2" +checksum = "43a2f138ad521dc4a2ced1a4576148a6a610b4c5923933b062a263130a6802ce" dependencies = [ "docify_macros", ] [[package]] name = "docify_macros" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63fa215f3a0d40fb2a221b3aa90d8e1fbb8379785a990cb60d62ac71ebdc6460" +checksum = "1a081e51fb188742f5a7a1164ad752121abcb22874b21e2c3b0dd040c515fdad" dependencies = [ "common-path", - "derive-syn-parse", + "derive-syn-parse 0.2.0", "once_cell", "proc-macro2", "quote", "regex", - "syn 2.0.50", + "syn 2.0.59", "termcolor", "toml", "walkdir", @@ -1882,6 +1543,7 @@ dependencies = [ "digest 0.10.7", "elliptic-curve", "rfc6979", + "serdect", "signature", "spki", ] @@ -1940,11 +1602,12 @@ dependencies = [ "crypto-bigint", "digest 0.10.7", "ff", - "generic-array 0.14.7", + "generic-array", "group", "pkcs8", "rand_core 0.6.4", "sec1", + "serdect", "subtle", "zeroize", ] @@ -1972,7 +1635,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -1983,20 +1646,30 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", +] + +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", ] [[package]] name = "env_logger" -version = "0.9.3" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" dependencies = [ - "atty", + "anstream", + "anstyle", + "env_filter", "humantime", "log", - "regex", - "termcolor", ] [[package]] @@ -2072,15 +1745,9 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -2105,7 +1772,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "auto_impl", "bytes", ] @@ -2130,7 +1797,7 @@ dependencies = [ "ark-poly", "ark-serialize 0.4.2", "ark-std 0.4.0", - "merlin 3.0.0", + "merlin", ] [[package]] @@ -2151,22 +1818,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "finality-grandpa" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" -dependencies = [ - "either", - "futures", - "futures-timer", - "log", - "num-traits", - "parity-scale-codec", - "parking_lot", - "scale-info", -] - [[package]] name = "fixed-hash" version = "0.8.0" @@ -2225,7 +1876,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -2244,23 +1895,6 @@ dependencies = [ "sp-std 14.0.0", ] -[[package]] -name = "frame-executive" -version = "28.0.0" -dependencies = [ - "frame-support", - "frame-system", - "frame-try-runtime", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "sp-tracing 16.0.0", -] - [[package]] name = "frame-metadata" version = "16.0.0" @@ -2319,7 +1953,7 @@ version = "23.0.0" dependencies = [ "Inflector", "cfg-expr", - "derive-syn-parse", + "derive-syn-parse 0.2.0", "expander", "frame-support-procedural-tools", "itertools", @@ -2328,7 +1962,7 @@ dependencies = [ "proc-macro2", "quote", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -2339,7 +1973,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -2348,7 +1982,7 @@ version = "11.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -2370,39 +2004,6 @@ dependencies = [ "sp-weights", ] -[[package]] -name = "frame-system-benchmarking" -version = "28.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "frame-system-rpc-runtime-api" -version = "26.0.0" -dependencies = [ - "parity-scale-codec", - "sp-api", -] - -[[package]] -name = "frame-try-runtime" -version = "0.34.0" -dependencies = [ - "frame-support", - "parity-scale-codec", - "sp-api", - "sp-runtime", - "sp-std 14.0.0", -] - [[package]] name = "fs-err" version = "2.11.0" @@ -2475,7 +2076,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -2490,12 +2091,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - [[package]] name = "futures-util" version = "0.3.30" @@ -2514,15 +2109,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2632,15 +2218,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.8" @@ -2653,6 +2230,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" + [[package]] name = "hex-literal" version = "0.4.1" @@ -2665,17 +2248,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.0", + "crypto-mac", "digest 0.9.0", ] @@ -2695,7 +2268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", - "generic-array 0.14.7", + "generic-array", "hmac 0.8.1", ] @@ -2831,7 +2404,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.8", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -2870,6 +2443,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", + "serdect", "sha2 0.10.8", ] @@ -2990,18 +2564,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "lru" -version = "0.8.1" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" -dependencies = [ - "hashbrown 0.12.3", -] +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "mach" @@ -3021,7 +2586,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -3031,11 +2596,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "468155613a44cfd825f1fb0ffa532b018253920d404e6fca1e8d43155198a46d" dependencies = [ "const-random", - "derive-syn-parse", + "derive-syn-parse 0.1.5", "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -3046,7 +2611,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -3057,7 +2622,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -3069,6 +2634,15 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matrixmultiply" version = "0.3.8" @@ -3112,18 +2686,6 @@ dependencies = [ "hash-db", ] -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - [[package]] name = "merlin" version = "3.0.0" @@ -3178,6 +2740,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -3204,7 +2776,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "itoa", ] @@ -3244,124 +2816,59 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.8", + "hermit-abi", "libc", ] -[[package]] -name = "object" -version = "0.30.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "memchr", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "pallet-asset-conversion" -version = "10.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "pallet-asset-rate" -version = "7.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "pallet-asset-tx-payment" -version = "28.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "pallet-transaction-payment", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", +[[package]] +name = "object" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", ] [[package]] -name = "pallet-assets" -version = "29.0.0" +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", + "memchr", ] [[package]] -name = "pallet-aura" -version = "27.0.0" +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pallet-asset-rate" +version = "7.0.0" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", - "log", - "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-consensus-aura", + "sp-core", "sp-runtime", "sp-std 14.0.0", ] @@ -3432,82 +2939,6 @@ dependencies = [ "sp-std 14.0.0", ] -[[package]] -name = "pallet-bridge-grandpa" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-runtime", - "bp-test-utils", - "finality-grandpa", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-consensus-grandpa", - "sp-runtime", - "sp-std 14.0.0", - "sp-trie", -] - -[[package]] -name = "pallet-bridge-messages" -version = "0.7.0" -dependencies = [ - "bp-messages", - "bp-runtime", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "num-traits", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "pallet-bridge-parachains" -version = "0.7.0" -dependencies = [ - "bp-header-chain", - "bp-parachains", - "bp-polkadot-core", - "bp-runtime", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-bridge-grandpa", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std 14.0.0", - "sp-trie", -] - -[[package]] -name = "pallet-bridge-relayers" -version = "0.7.0" -dependencies = [ - "bp-messages", - "bp-relayers", - "bp-runtime", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-bridge-messages", - "parity-scale-codec", - "scale-info", - "sp-arithmetic", - "sp-runtime", - "sp-std 14.0.0", -] - [[package]] name = "pallet-broker" version = "0.6.0" @@ -3518,6 +2949,7 @@ dependencies = [ "frame-system", "parity-scale-codec", "scale-info", + "sp-api", "sp-arithmetic", "sp-core", "sp-runtime", @@ -3561,7 +2993,7 @@ dependencies = [ "sp-npos-elections", "sp-runtime", "sp-std 14.0.0", - "strum", + "strum 0.26.2", ] [[package]] @@ -3630,21 +3062,6 @@ dependencies = [ "sp-weights", ] -[[package]] -name = "pallet-multisig" -version = "28.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", -] - [[package]] name = "pallet-session" version = "28.0.0" @@ -3730,17 +3147,6 @@ dependencies = [ "sp-std 14.0.0", ] -[[package]] -name = "pallet-transaction-payment-rpc-runtime-api" -version = "28.0.0" -dependencies = [ - "pallet-transaction-payment", - "parity-scale-codec", - "sp-api", - "sp-runtime", - "sp-weights", -] - [[package]] name = "pallet-treasury" version = "27.0.0" @@ -3808,72 +3214,7 @@ dependencies = [ "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", -] - -[[package]] -name = "pallet-xcm-benchmarks" -version = "7.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", -] - -[[package]] -name = "pallet-xcm-bridge-hub-router" -version = "0.5.0" -dependencies = [ - "bp-xcm-bridge-hub-router", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", - "sp-std 14.0.0", - "staging-xcm", - "staging-xcm-builder", -] - -[[package]] -name = "parachains-common" -version = "7.0.0" -dependencies = [ - "cumulus-primitives-core", - "cumulus-primitives-utility", - "frame-support", - "frame-system", - "log", - "pallet-asset-tx-payment", - "pallet-assets", - "pallet-authorship", - "pallet-balances", - "pallet-collator-selection", - "pallet-message-queue", - "pallet-xcm", - "parity-scale-codec", - "polkadot-primitives", - "scale-info", - "sp-consensus-aura", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-executor", - "substrate-wasm-builder", + "xcm-fee-payment-runtime-api", ] [[package]] @@ -3906,6 +3247,19 @@ dependencies = [ "substrate-wasm-builder", ] +[[package]] +name = "parity-bip39" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" +dependencies = [ + "bitcoin_hashes", + "rand", + "rand_core 0.6.4", + "serde", + "unicode-normalization", +] + [[package]] name = "parity-bytes" version = "0.1.2" @@ -3918,7 +3272,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "bitvec", "byte-slice-cast", "bytes", @@ -3939,35 +3293,6 @@ dependencies = [ "syn 1.0.109", ] -[[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", - "parity-util-mem-derive", - "parking_lot", - "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", -] - [[package]] name = "parity-wasm" version = "0.45.0" @@ -3997,6 +3322,17 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "paste" version = "1.0.14" @@ -4005,11 +3341,12 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" -version = "0.8.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "crypto-mac 0.11.0", + "digest 0.10.7", + "password-hash", ] [[package]] @@ -4143,7 +3480,6 @@ dependencies = [ "pallet-transaction-payment", "pallet-treasury", "pallet-vesting", - "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-primitives", "polkadot-runtime-parachains", @@ -4233,13 +3569,28 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92c99f7eee94e7be43ba37eef65ad0ee8cbaf89b7c00001c3f6d2be985cb1817" +[[package]] +name = "polkavm-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9428a5cfcc85c5d7b9fc4b6a18c4b802d0173d768182a51cc7751640f08b92" + [[package]] name = "polkavm-derive" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79fa916f7962348bd1bb1a65a83401675e6fc86c51a0fdbcf92a3108e58e6125" dependencies = [ - "polkavm-derive-impl-macro", + "polkavm-derive-impl-macro 0.8.0", +] + +[[package]] +name = "polkavm-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606" +dependencies = [ + "polkavm-derive-impl-macro 0.9.0", ] [[package]] @@ -4248,10 +3599,22 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c10b2654a8a10a83c260bfb93e97b262cf0017494ab94a65d389e0eda6de6c9c" dependencies = [ - "polkavm-common", + "polkavm-common 0.8.0", + "proc-macro2", + "quote", + "syn 2.0.59", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c" +dependencies = [ + "polkavm-common 0.9.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -4260,21 +3623,31 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" dependencies = [ - "polkavm-derive-impl", - "syn 2.0.50", + "polkavm-derive-impl 0.8.0", + "syn 2.0.59", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" +dependencies = [ + "polkavm-derive-impl 0.9.0", + "syn 2.0.59", ] [[package]] name = "polkavm-linker" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdec1451cb18261d5d01de82acc15305e417fb59588cdcb3127d3dcc9672b925" +checksum = "9c7be503e60cf56c0eb785f90aaba4b583b36bff00e93997d93fef97f9553c39" dependencies = [ "gimli 0.28.1", "hashbrown 0.14.3", "log", "object 0.32.2", - "polkavm-common", + "polkavm-common 0.9.0", "regalloc2", "rustc-demangle", ] @@ -4359,14 +3732,14 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ "unicode-ident", ] @@ -4528,7 +3901,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -4611,7 +3984,7 @@ dependencies = [ "blake2", "common", "fflonk", - "merlin 3.0.0", + "merlin", ] [[package]] @@ -4761,9 +4134,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" dependencies = [ "bitvec", "cfg-if", @@ -4775,9 +4148,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -4796,22 +4169,6 @@ dependencies = [ "hashbrown 0.13.2", ] -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "merlin 2.0.1", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - [[package]] name = "schnorrkel" version = "0.11.4" @@ -4820,10 +4177,10 @@ checksum = "8de18f6d8ba0aad7045f5feae07ec29899c1112584a38509a84ad7b04451eaa0" dependencies = [ "aead", "arrayref", - "arrayvec 0.7.4", + "arrayvec", "curve25519-dalek 4.1.2", "getrandom_or_panic", - "merlin 3.0.0", + "merlin", "rand_core 0.6.4", "serde_bytes", "sha2 0.10.8", @@ -4857,8 +4214,9 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", - "generic-array 0.14.7", + "generic-array", "pkcs8", + "serdect", "subtle", "zeroize", ] @@ -4967,7 +4325,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -4991,15 +4349,13 @@ dependencies = [ ] [[package]] -name = "sha2" -version = "0.8.2" +name = "serdect" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "base16ct", + "serde", ] [[package]] @@ -5012,7 +4368,7 @@ dependencies = [ "cfg-if", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -5118,11 +4474,10 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" -version = "0.9.0" +version = "0.2.0" dependencies = [ "byte-slice-cast", "frame-support", - "frame-system", "hex", "hex-literal", "parity-scale-codec", @@ -5137,12 +4492,11 @@ dependencies = [ "sp-std 14.0.0", "ssz_rs", "ssz_rs_derive", - "static_assertions", ] [[package]] name = "snowbridge-core" -version = "0.9.0" +version = "0.2.0" dependencies = [ "ethabi-decode", "frame-support", @@ -5165,7 +4519,7 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" -version = "0.9.0" +version = "0.3.0" dependencies = [ "ethabi-decode", "ethbloom", @@ -5175,18 +4529,30 @@ dependencies = [ "parity-scale-codec", "rand", "rlp", - "rustc-hex", "scale-info", "serde", "serde-big-array", "serde_json", - "sp-core", "sp-io", "sp-runtime", "sp-std 14.0.0", "wasm-bindgen-test", ] +[[package]] +name = "snowbridge-inbound-queue-runtime-api" +version = "0.2.0" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "snowbridge-core", + "snowbridge-router-primitives", + "sp-api", + "sp-std 14.0.0", + "staging-xcm", +] + [[package]] name = "snowbridge-milagro-bls" version = "1.5.4" @@ -5204,7 +4570,7 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" -version = "0.9.0" +version = "0.3.0" dependencies = [ "array-bytes 4.2.0", "env_logger", @@ -5219,24 +4585,20 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-runtime-api" -version = "0.9.0" +version = "0.2.0" dependencies = [ "frame-support", "parity-scale-codec", "snowbridge-core", "snowbridge-outbound-queue-merkle-tree", "sp-api", - "sp-core", "sp-std 14.0.0", - "staging-xcm", ] [[package]] name = "snowbridge-pallet-ethereum-client" -version = "0.9.0" +version = "0.2.0" dependencies = [ - "bp-runtime", - "byte-slice-cast", "frame-benchmarking", "frame-support", "frame-system", @@ -5245,7 +4607,6 @@ dependencies = [ "pallet-timestamp", "parity-scale-codec", "rand", - "rlp", "scale-info", "serde", "serde_json", @@ -5258,8 +4619,6 @@ dependencies = [ "sp-keyring", "sp-runtime", "sp-std 14.0.0", - "ssz_rs", - "ssz_rs_derive", "static_assertions", ] @@ -5267,9 +4626,6 @@ dependencies = [ name = "snowbridge-pallet-ethereum-client-fixtures" version = "0.9.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", @@ -5279,24 +4635,21 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue" -version = "0.9.0" +version = "0.2.0" dependencies = [ "alloy-primitives", - "alloy-rlp", "alloy-sol-types", "frame-benchmarking", "frame-support", "frame-system", "hex-literal", "log", - "num-traits", "pallet-balances", "parity-scale-codec", "scale-info", "serde", "snowbridge-beacon-primitives", "snowbridge-core", - "snowbridge-ethereum", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-router-primitives", @@ -5306,17 +4659,13 @@ dependencies = [ "sp-runtime", "sp-std 14.0.0", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", ] [[package]] name = "snowbridge-pallet-inbound-queue-fixtures" -version = "0.9.0" +version = "0.10.0" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", @@ -5326,14 +4675,13 @@ dependencies = [ [[package]] name = "snowbridge-pallet-outbound-queue" -version = "0.9.0" +version = "0.2.0" dependencies = [ "bridge-hub-common", "ethabi-decode", "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", "pallet-message-queue", "parity-scale-codec", "scale-info", @@ -5346,14 +4694,12 @@ dependencies = [ "sp-keyring", "sp-runtime", "sp-std 14.0.0", - "staging-xcm", ] [[package]] name = "snowbridge-pallet-system" -version = "0.9.0" +version = "0.2.0" dependencies = [ - "ethabi-decode", "frame-benchmarking", "frame-support", "frame-system", @@ -5373,7 +4719,6 @@ dependencies = [ "sp-runtime", "sp-std 14.0.0", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", ] @@ -5381,31 +4726,26 @@ dependencies = [ name = "snowbridge-router-primitives" version = "0.9.0" dependencies = [ - "ethabi-decode", "frame-support", - "frame-system", "hex-literal", "log", "parity-scale-codec", "rustc-hex", "scale-info", - "serde", "snowbridge-core", "sp-core", "sp-io", "sp-runtime", "sp-std 14.0.0", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", ] [[package]] name = "snowbridge-runtime-common" -version = "0.9.0" +version = "0.2.0" dependencies = [ "frame-support", - "frame-system", "log", "parity-scale-codec", "snowbridge-core", @@ -5418,89 +4758,41 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" -version = "0.9.0" +version = "0.2.0" dependencies = [ - "assets-common", - "bridge-hub-test-utils", - "bridge-runtime-common", - "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", - "cumulus-pallet-session-benchmarking", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "cumulus-primitives-utility", - "frame-benchmarking", - "frame-executive", "frame-support", "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal", - "log", - "pallet-aura", - "pallet-authorship", "pallet-balances", "pallet-collator-selection", "pallet-message-queue", - "pallet-multisig", "pallet-session", "pallet-timestamp", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", "pallet-utility", "pallet-xcm", - "pallet-xcm-benchmarks", - "parachains-common", "parachains-runtimes-test-utils", "parity-scale-codec", - "polkadot-core-primitives", - "polkadot-parachain-primitives", - "polkadot-runtime-common", - "scale-info", - "serde", - "smallvec", - "snowbridge-beacon-primitives", "snowbridge-core", - "snowbridge-outbound-queue-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", - "snowbridge-pallet-inbound-queue", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", - "snowbridge-router-primitives", - "snowbridge-system-runtime-api", - "sp-api", - "sp-block-builder", - "sp-consensus-aura", "sp-core", - "sp-genesis-builder", - "sp-inherents", "sp-io", "sp-keyring", - "sp-offchain", "sp-runtime", - "sp-session", - "sp-std 14.0.0", - "sp-storage 19.0.0", - "sp-transaction-pool", - "sp-version", "staging-parachain-info", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", - "static_assertions", ] [[package]] name = "snowbridge-system-runtime-api" -version = "0.9.0" +version = "0.2.0" dependencies = [ "parity-scale-codec", "snowbridge-core", "sp-api", - "sp-core", "sp-std 14.0.0", "staging-xcm", ] @@ -5536,7 +4828,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -5555,6 +4847,7 @@ dependencies = [ name = "sp-arithmetic" version = "23.0.0" dependencies = [ + "docify", "integer-sqrt", "num-traits", "parity-scale-codec", @@ -5591,17 +4884,6 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "sp-block-builder" -version = "26.0.0" -dependencies = [ - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -5616,7 +4898,6 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "sp-timestamp", ] @@ -5634,27 +4915,9 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "sp-timestamp", ] -[[package]] -name = "sp-consensus-grandpa" -version = "13.0.0" -dependencies = [ - "finality-grandpa", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-std 14.0.0", -] - [[package]] name = "sp-consensus-slots" version = "0.32.0" @@ -5662,7 +4925,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-std 14.0.0", "sp-timestamp", ] @@ -5672,7 +4934,6 @@ version = "28.0.0" dependencies = [ "array-bytes 6.2.2", "bandersnatch_vrfs", - "bip39", "bitflags 1.3.2", "blake2", "bounded-collections", @@ -5684,16 +4945,18 @@ dependencies = [ "hash256-std-hasher", "impl-serde", "itertools", + "k256", "libsecp256k1", "log", - "merlin 3.0.0", + "merlin", + "parity-bip39", "parity-scale-codec", "parking_lot", "paste", "primitive-types", "rand", "scale-info", - "schnorrkel 0.11.4", + "schnorrkel", "secp256k1", "secrecy", "serde", @@ -5734,7 +4997,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" -version = "0.0.0" +version = "0.1.0" dependencies = [ "blake2b_simd", "byteorder", @@ -5746,11 +5009,11 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" -version = "0.0.0" +version = "0.1.0" dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -5759,7 +5022,7 @@ version = "14.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -5769,7 +5032,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk#de6d02591b57d03f70ed8db dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -5778,7 +5041,6 @@ version = "0.25.0" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 14.0.0", "sp-storage 19.0.0", ] @@ -5795,12 +5057,13 @@ dependencies = [ [[package]] name = "sp-genesis-builder" -version = "0.7.0" +version = "0.8.0" dependencies = [ + "parity-scale-codec", + "scale-info", "serde_json", "sp-api", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -5812,7 +5075,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0", "thiserror", ] @@ -5825,6 +5087,7 @@ dependencies = [ "libsecp256k1", "log", "parity-scale-codec", + "polkavm-derive 0.9.1", "rustversion", "secp256k1", "sp-core", @@ -5846,7 +5109,7 @@ version = "31.0.0" dependencies = [ "sp-core", "sp-runtime", - "strum", + "strum 0.26.2", ] [[package]] @@ -5874,7 +5137,6 @@ dependencies = [ "frame-metadata", "parity-scale-codec", "scale-info", - "sp-std 14.0.0", ] [[package]] @@ -5887,16 +5149,6 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-runtime", - "sp-std 14.0.0", -] - -[[package]] -name = "sp-offchain" -version = "26.0.0" -dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", ] [[package]] @@ -5938,7 +5190,7 @@ dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "polkavm-derive", + "polkavm-derive 0.9.1", "primitive-types", "sp-externalities 0.25.0", "sp-runtime-interface-proc-macro 17.0.0", @@ -5957,7 +5209,7 @@ dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", - "polkavm-derive", + "polkavm-derive 0.8.0", "primitive-types", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk)", "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk)", @@ -5977,7 +5229,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -5990,7 +5242,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -6004,7 +5256,6 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", - "sp-std 14.0.0", ] [[package]] @@ -6017,7 +5268,6 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0", ] [[package]] @@ -6033,7 +5283,6 @@ dependencies = [ "sp-core", "sp-externalities 0.25.0", "sp-panic-handler", - "sp-std 14.0.0", "sp-trie", "thiserror", "tracing", @@ -6058,7 +5307,6 @@ dependencies = [ "ref-cast", "serde", "sp-debug-derive 14.0.0", - "sp-std 14.0.0", ] [[package]] @@ -6082,7 +5330,6 @@ dependencies = [ "parity-scale-codec", "sp-inherents", "sp-runtime", - "sp-std 14.0.0", "thiserror", ] @@ -6091,10 +5338,9 @@ name = "sp-tracing" version = "16.0.0" dependencies = [ "parity-scale-codec", - "sp-std 14.0.0", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -6106,15 +5352,7 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", "tracing", "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-transaction-pool" -version = "26.0.0" -dependencies = [ - "sp-api", - "sp-runtime", + "tracing-subscriber 0.2.25", ] [[package]] @@ -6133,7 +5371,6 @@ dependencies = [ "schnellru", "sp-core", "sp-externalities 0.25.0", - "sp-std 14.0.0", "thiserror", "tracing", "trie-db", @@ -6163,19 +5400,16 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] name = "sp-wasm-interface" version = "20.0.0" dependencies = [ - "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 14.0.0", - "wasmtime", ] [[package]] @@ -6202,7 +5436,6 @@ dependencies = [ "smallvec", "sp-arithmetic", "sp-debug-derive 14.0.0", - "sp-std 14.0.0", ] [[package]] @@ -6341,8 +5574,14 @@ name = "strum" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" dependencies = [ - "strum_macros", + "strum_macros 0.26.2", ] [[package]] @@ -6359,15 +5598,26 @@ dependencies = [ ] [[package]] -name = "substrate-bip39" -version = "0.4.5" +name = "strum_macros" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e620c7098893ba667438b47169c00aacdd9e7c10e042250ce2b60b087ec97328" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.59", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.7" dependencies = [ - "hmac 0.11.0", + "hmac 0.12.1", "pbkdf2", - "schnorrkel 0.9.1", - "sha2 0.9.9", + "schnorrkel", + "sha2 0.10.8", "zeroize", ] @@ -6382,7 +5632,7 @@ dependencies = [ "parity-wasm", "polkavm-linker", "sp-maybe-compressed-blob", - "strum", + "strum 0.26.2", "tempfile", "toml", "walkdir", @@ -6408,9 +5658,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.50" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", @@ -6426,19 +5676,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.50", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", + "syn 2.0.59", ] [[package]] @@ -6491,7 +5729,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -6614,7 +5852,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -6638,6 +5876,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-serde" version = "0.1.3" @@ -6657,7 +5906,7 @@ dependencies = [ "ansi_term", "chrono", "lazy_static", - "matchers", + "matchers 0.0.1", "regex", "serde", "serde_json", @@ -6666,18 +5915,35 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", "tracing-serde", ] +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers 0.1.0", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.2.0", +] + [[package]] name = "trie-db" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" +checksum = "65ed83be775d85ebb0e272914fff6462c39b3ddd6dc67b5c1c41271aad280c69" dependencies = [ "hash-db", - "hashbrown 0.13.2", "log", "rustc-hex", "smallvec", @@ -6784,6 +6050,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "valuable" version = "0.1.0" @@ -6866,7 +6138,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", "wasm-bindgen-shared", ] @@ -6900,7 +6172,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6933,7 +6205,7 @@ checksum = "a5211b7550606857312bba1d978a8ec75692eae187becc5e680444fffc5e6f89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -6944,8 +6216,8 @@ checksum = "fc942673e7684671f0c5708fc18993569d184265fd5223bb51fc8e5b9b6cfd52" dependencies = [ "anyhow", "libc", - "strum", - "strum_macros", + "strum 0.24.1", + "strum_macros 0.24.3", "tempfile", "thiserror", "wasm-opt-cxx-sys", @@ -7403,6 +6675,20 @@ dependencies = [ "tap", ] +[[package]] +name = "xcm-fee-payment-runtime-api" +version = "0.1.0" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime", + "sp-std 14.0.0", + "sp-weights", + "staging-xcm", +] + [[package]] name = "xcm-procedural" version = "7.0.0" @@ -7410,7 +6696,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -7430,7 +6716,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] @@ -7450,7 +6736,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn 2.0.59", ] [[package]] diff --git a/bridges/snowbridge/Cargo.toml b/bridges/snowbridge/Cargo.toml index ca70de1d0e07..a342d970b2a7 100644 --- a/bridges/snowbridge/Cargo.toml +++ b/bridges/snowbridge/Cargo.toml @@ -10,6 +10,7 @@ members = [ "pallets/ethereum-client/fixtures", "pallets/inbound-queue", "pallets/inbound-queue/fixtures", + "pallets/inbound-queue/runtime-api", "pallets/outbound-queue", "pallets/outbound-queue/merkle-tree", "pallets/outbound-queue/runtime-api", diff --git a/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml b/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml new file mode 100644 index 000000000000..e6278017d426 --- /dev/null +++ b/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "snowbridge-inbound-queue-runtime-api" +description = "Snowbridge Inbound Queue Runtime API" +version = "0.2.0" +authors = ["Snowfork "] +edition.workspace = true +repository.workspace = true +license = "Apache-2.0" +categories = ["cryptography::cryptocurrencies"] + +[lints] +workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { version = "3.1.5", package = "parity-scale-codec", features = ["derive"], default-features = false } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +sp-std = { path = "../../../../../substrate/primitives/std", default-features = false } +sp-api = { path = "../../../../../substrate/primitives/api", default-features = false } +frame-support = { path = "../../../../../substrate/frame/support", default-features = false } +snowbridge-core = { path = "../../../primitives/core", default-features = false } +snowbridge-router-primitives = { path = "../../../primitives/router", default-features = false } +xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "scale-info/std", + "snowbridge-core/std", + "snowbridge-router-primitives/std", + "sp-api/std", + "sp-std/std", + "xcm/std", +] diff --git a/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs new file mode 100644 index 000000000000..6ea0d8b647f6 --- /dev/null +++ b/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 Snowfork +#![cfg_attr(not(feature = "std"), no_std)] + +use snowbridge_core::inbound::{EstimateInboundFeeError, Log}; +use xcm::VersionedAssets; + +sp_api::decl_runtime_apis! { + pub trait InboundQueueApi + { + /// Calculate the delivery fee for `command` + fn calculate_fee(log: Log) -> Result; + } +} diff --git a/bridges/snowbridge/pallets/inbound-queue/src/api.rs b/bridges/snowbridge/pallets/inbound-queue/src/api.rs new file mode 100644 index 000000000000..c9023f49318b --- /dev/null +++ b/bridges/snowbridge/pallets/inbound-queue/src/api.rs @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023 Snowfork +#![cfg_attr(not(feature = "std"), no_std)] + +use crate::{envelope::Envelope, Config}; +use codec::DecodeAll; +use snowbridge_core::{ + inbound::{EstimateInboundFeeError, Log}, + StaticLookup, +}; +use snowbridge_router_primitives::inbound::{ConvertMessage, VersionedMessage}; +use sp_core::Get; +use sp_runtime::SaturatedConversion; +use xcm::{ + prelude::{Location, Parachain, SendXcm}, + v4::Asset, + VersionedAssets, +}; + +pub fn calculate_fee(event_log: Log) -> Result +where + T: Config, +{ + let envelope = + Envelope::try_from(&event_log).map_err(|_| EstimateInboundFeeError::InvalidEnvelope)?; + let versioned_message = VersionedMessage::decode_all(&mut envelope.payload.as_ref()) + .map_err(|_| EstimateInboundFeeError::InvalidPayload)?; + let channel = T::ChannelLookup::lookup(envelope.channel_id) + .ok_or(EstimateInboundFeeError::InvalidChannel)?; + let (xcm, _) = T::MessageConverter::convert(envelope.message_id, versioned_message) + .map_err(|_| EstimateInboundFeeError::VersionedConversionFailed)?; + + let dest = Location::new(1, [Parachain(channel.para_id.into())]); + let (_, mut send_cost) = T::XcmSender::validate(&mut Some(dest), &mut Some(xcm)) + .map_err(|_| EstimateInboundFeeError::Unroutable)?; + + let delivery_amount = crate::Pallet::::calculate_delivery_cost(T::MaxMessageSize::get()) + .saturated_into::(); + let delivery_cost = Asset::from((Location::parent(), delivery_amount)); + + send_cost.push(delivery_cost); + + Ok(VersionedAssets::from(send_cost)) +} diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index 3b2485f3d967..bae33dd91699 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -33,6 +33,7 @@ pub mod weights; #[cfg(test)] mod mock; +pub mod api; #[cfg(test)] mod test; @@ -52,7 +53,8 @@ use sp_core::{H160, H256}; use sp_runtime::traits::Zero; use sp_std::{convert::TryFrom, vec}; use xcm::prelude::{ - send_xcm, Junction::*, Location, SendError as XcmpSendError, SendXcm, Xcm, XcmContext, XcmHash, + send_xcm, validate_send, Junction::*, Location, SendError as XcmpSendError, SendXcm, Xcm, + XcmContext, XcmHash, *, }; use xcm_executor::traits::TransactAsset; @@ -61,9 +63,8 @@ use snowbridge_core::{ sibling_sovereign_account, BasicOperatingMode, Channel, ChannelId, ParaId, PricingParameters, StaticLookup, }; -use snowbridge_router_primitives::{ - inbound, - inbound::{ConvertMessage, ConvertMessageError}, +use snowbridge_router_primitives::inbound::{ + ConvertMessage, ConvertMessageError, VersionedMessage, }; use sp_runtime::{traits::Saturating, SaturatedConversion, TokenError}; @@ -139,6 +140,9 @@ pub mod pallet { /// To withdraw and deposit an asset. type AssetTransactor: TransactAsset; + + /// The most expensive xcm here only used to estimate send cost + type MaxSendCostXcm: Get>; } #[pallet::hooks] @@ -276,12 +280,11 @@ pub mod pallet { } // Decode message into XCM - let (xcm, fee) = - match inbound::VersionedMessage::decode_all(&mut envelope.payload.as_ref()) { - Ok(message) => T::MessageConverter::convert(envelope.message_id, message) - .map_err(|e| Error::::ConvertMessage(e))?, - Err(_) => return Err(Error::::InvalidPayload.into()), - }; + let (xcm, fee) = match VersionedMessage::decode_all(&mut envelope.payload.as_ref()) { + Ok(message) => T::MessageConverter::convert(envelope.message_id, message) + .map_err(|e| Error::::ConvertMessage(e))?, + Err(_) => return Err(Error::::InvalidPayload.into()), + }; log::info!( target: LOG_TARGET, @@ -358,13 +361,29 @@ pub mod pallet { })?; Ok(()) } + + pub fn calculate_send_cost(xcm: Xcm<()>) -> Result, Error> { + let dest = Location::new(1, [Parachain(1000)]); + let (_, assets) = validate_send::(dest, xcm).map_err(Error::::from)?; + ensure!(assets.len() == 1, Error::::Send(SendError::Fees)); + let fee = assets.get(0).unwrap(); + let cost: u128 = match (*fee).fun { + Fungible(amount) => Some(amount), + _ => None, + } + .ok_or(Error::::Send(SendError::Fees))?; + Ok(cost.saturated_into::>()) + } } /// API for accessing the delivery cost of a message impl Get> for Pallet { fn get() -> BalanceOf { // Cost here based on MaxMessagePayloadSize(the worst case) - Self::calculate_delivery_cost(T::MaxMessageSize::get()) + let delivery_cost = Self::calculate_delivery_cost(T::MaxMessageSize::get()); + // Cost here based on MaxSendCostXcm(the worst case) + let send_cost = Self::calculate_send_cost(T::MaxSendCostXcm::get()).unwrap_or_default(); + delivery_cost.saturating_add(send_cost) } } } diff --git a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs index c96c868bc26e..299cee7c4849 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs @@ -180,6 +180,28 @@ parameter_types! { rewards: Rewards { local: DOT, remote: meth(1) }, multiplier: FixedU128::from_rational(1, 1), }; + pub DefaultFee: Asset = (Parent, 1_000_000_000).into(); + pub MaxSendCostXcm: Xcm<()> = vec![ + ReceiveTeleportedAsset(DefaultFee::get().into()), + BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, + DescendOrigin(PalletInstance(80).into()), + UniversalOrigin(GlobalConsensus(Ethereum { chain_id: 1 })), + ReserveAssetDeposited(DefaultFee::get().into()), + ClearOrigin, + DepositReserveAsset { + assets: Definite(DefaultFee::get().into()), + dest: Location::new(1, [Parachain(1000)]), + xcm: vec![ + // Buy execution on target. + BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, + // Deposit asset to beneficiary. + DepositAsset { assets: Definite(DefaultFee::get().into()), beneficiary: Location::default() }, + // Forward message id to destination parachain. + SetTopic([0; 32]), + ] + .into(), + }, + ].into(); } pub const DOT: u128 = 10_000_000_000; @@ -253,6 +275,7 @@ impl inbound_queue::Config for Test { type LengthToFee = IdentityFee; type MaxMessageSize = ConstU32<1024>; type AssetTransactor = SuccessfulTransactor; + type MaxSendCostXcm = MaxSendCostXcm; } pub fn last_events(n: usize) -> Vec { diff --git a/bridges/snowbridge/primitives/core/src/inbound.rs b/bridges/snowbridge/primitives/core/src/inbound.rs index 9e8ed789ab50..064a3aff7dd0 100644 --- a/bridges/snowbridge/primitives/core/src/inbound.rs +++ b/bridges/snowbridge/primitives/core/src/inbound.rs @@ -80,3 +80,12 @@ pub struct InboundQueueFixture { pub finalized_header: BeaconHeader, pub block_roots_root: H256, } + +#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)] +pub enum EstimateInboundFeeError { + InvalidEnvelope, + InvalidPayload, + InvalidChannel, + VersionedConversionFailed, + Unroutable, +} diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml index bbe54c367baf..b21b8880161e 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/Cargo.toml @@ -47,4 +47,5 @@ snowbridge-core = { path = "../../../../../../../bridges/snowbridge/primitives/c snowbridge-router-primitives = { path = "../../../../../../../bridges/snowbridge/primitives/router", default-features = false } snowbridge-pallet-system = { path = "../../../../../../../bridges/snowbridge/pallets/system", default-features = false } snowbridge-pallet-outbound-queue = { path = "../../../../../../../bridges/snowbridge/pallets/outbound-queue", default-features = false } +snowbridge-pallet-inbound-queue = { path = "../../../../../../../bridges/snowbridge/pallets/inbound-queue", default-features = false } snowbridge-pallet-inbound-queue-fixtures = { path = "../../../../../../../bridges/snowbridge/pallets/inbound-queue/fixtures" } diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index f5a75aa03acd..3b25761bd08c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -118,6 +118,7 @@ snowbridge-pallet-outbound-queue = { path = "../../../../../bridges/snowbridge/p snowbridge-outbound-queue-runtime-api = { path = "../../../../../bridges/snowbridge/pallets/outbound-queue/runtime-api", default-features = false } snowbridge-router-primitives = { path = "../../../../../bridges/snowbridge/primitives/router", default-features = false } snowbridge-runtime-common = { path = "../../../../../bridges/snowbridge/runtime/runtime-common", default-features = false } +snowbridge-inbound-queue-runtime-api = { path = "../../../../../bridges/snowbridge/pallets/inbound-queue/runtime-api", default-features = false } bridge-hub-common = { path = "../common", default-features = false } @@ -194,6 +195,7 @@ std = [ "serde", "snowbridge-beacon-primitives/std", "snowbridge-core/std", + "snowbridge-inbound-queue-runtime-api/std", "snowbridge-outbound-queue-runtime-api/std", "snowbridge-pallet-ethereum-client/std", "snowbridge-pallet-inbound-queue/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 1eac813b10ce..b2f45d1802ed 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -38,7 +38,9 @@ pub mod xcm_config; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::{ - gwei, meth, + gwei, + inbound::{EstimateInboundFeeError, Log}, + meth, outbound::{Command, Fee}, AgentId, AllowSiblingsOnly, PricingParameters, Rewards, }; @@ -83,7 +85,7 @@ use bridge_hub_common::{ use pallet_xcm::EnsureXcm; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; pub use sp_runtime::{MultiAddress, Perbill, Permill}; -use xcm::VersionedLocation; +use xcm::{VersionedAssets, VersionedLocation}; use xcm_config::{TreasuryAccount, XcmOriginToTransactDispatchOrigin, XcmRouter}; #[cfg(any(feature = "std", test))] @@ -508,6 +510,25 @@ parameter_types! { rewards: Rewards { local: 1 * UNITS, remote: meth(1) }, multiplier: FixedU128::from_rational(1, 1), }; + pub DefaultFee: Asset = (Parent, 1_000_000_000).into(); + pub MaxSendCostXcm: Xcm<()> = vec![ + ReceiveTeleportedAsset(DefaultFee::get().into()), + BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, + DescendOrigin(PalletInstance(80).into()), + UniversalOrigin(GlobalConsensus(Ethereum { chain_id: 11155111 })), + ReserveAssetDeposited(DefaultFee::get().into()), + ClearOrigin, + DepositReserveAsset { + assets: Definite(DefaultFee::get().into()), + dest: Location::new(1, [Parachain(bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID)]), + xcm: vec![ + BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, + DepositAsset { assets: Definite(DefaultFee::get().into()), beneficiary: Location::default() }, + SetTopic([0; 32]), + ] + .into(), + }, + ].into(); } #[cfg(feature = "runtime-benchmarks")] @@ -573,6 +594,7 @@ impl snowbridge_pallet_inbound_queue::Config for Runtime { type WeightInfo = weights::snowbridge_pallet_inbound_queue::WeightInfo; type PricingParameters = EthereumSystem; type AssetTransactor = ::AssetTransactor; + type MaxSendCostXcm = MaxSendCostXcm; } impl snowbridge_pallet_outbound_queue::Config for Runtime { @@ -1031,6 +1053,13 @@ impl_runtime_apis! { } } + impl snowbridge_inbound_queue_runtime_api::InboundQueueApi for Runtime { + + fn calculate_fee(log: Log) -> Result { + snowbridge_pallet_inbound_queue::api::calculate_fee::(log) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { From c20791d82a9eb652f396f15003a24398e9d30799 Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 15 Apr 2024 21:18:37 +0800 Subject: [PATCH 03/11] Revert "Fix validate in xcm-bridge-hub-router" This reverts commit 7973ce3eaaf329cceadee09791a6dd3f6f70a394. --- bridges/modules/xcm-bridge-hub-router/src/lib.rs | 4 ++-- .../tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bridges/modules/xcm-bridge-hub-router/src/lib.rs b/bridges/modules/xcm-bridge-hub-router/src/lib.rs index 85d7b0a66179..5d0be41b1b55 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/lib.rs @@ -341,8 +341,8 @@ impl, I: 'static> SendXcm for Pallet { // versioned message to the sibling bridge hub. However, the local bridge hub may have a // higher XCM version than the remote `dest`. Once again, it is better to discard such // messages here than at the bridge hub (e.g., to avoid losing funds). - let destination_version = - T::DestinationVersion::get_version_for(dest_ref).ok_or(SendError::NotApplicable)?; + let destination_version = T::DestinationVersion::get_version_for(dest_ref) + .ok_or(SendError::DestinationUnsupported)?; let _ = VersionedXcm::from(xcm_ref.clone()) .into_version(destination_version) .map_err(|()| SendError::DestinationUnsupported)?; diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs index d529927028ee..3ce3bc94c700 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/snowbridge.rs @@ -388,6 +388,10 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { AssetHubRococo::force_default_xcm_version(Some(XCM_VERSION)); BridgeHubRococo::force_default_xcm_version(Some(XCM_VERSION)); + AssetHubRococo::force_xcm_version( + Location::new(2, [GlobalConsensus(Ethereum { chain_id: CHAIN_ID })]), + XCM_VERSION, + ); BridgeHubRococo::fund_accounts(vec![(assethub_sovereign.clone(), INITIAL_FUND)]); AssetHubRococo::fund_accounts(vec![(AssetHubRococoReceiver::get(), INITIAL_FUND)]); From be3ca3530ace8932489a493057c690fe59469d4c Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 15 Apr 2024 23:16:30 +0800 Subject: [PATCH 04/11] Revamp calculate_send_cost --- bridges/snowbridge/pallets/inbound-queue/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index bae33dd91699..9ce4898dafaa 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -362,8 +362,11 @@ pub mod pallet { Ok(()) } - pub fn calculate_send_cost(xcm: Xcm<()>) -> Result, Error> { - let dest = Location::new(1, [Parachain(1000)]); + pub fn calculate_send_cost( + para_id: ParaId, + xcm: Xcm<()>, + ) -> Result, Error> { + let dest = Location::new(1, [Parachain(para_id.into())]); let (_, assets) = validate_send::(dest, xcm).map_err(Error::::from)?; ensure!(assets.len() == 1, Error::::Send(SendError::Fees)); let fee = assets.get(0).unwrap(); @@ -382,7 +385,8 @@ pub mod pallet { // Cost here based on MaxMessagePayloadSize(the worst case) let delivery_cost = Self::calculate_delivery_cost(T::MaxMessageSize::get()); // Cost here based on MaxSendCostXcm(the worst case) - let send_cost = Self::calculate_send_cost(T::MaxSendCostXcm::get()).unwrap_or_default(); + let send_cost = Self::calculate_send_cost(1000_u32.into(), T::MaxSendCostXcm::get()) + .unwrap_or_default(); delivery_cost.saturating_add(send_cost) } } From 0a0186276266fc5c3d577abc81fce675b284d2c7 Mon Sep 17 00:00:00 2001 From: ron Date: Tue, 16 Apr 2024 11:57:48 +0800 Subject: [PATCH 05/11] Remove runtime api --- Cargo.lock | 15 ------- bridges/snowbridge/Cargo.toml | 1 - .../inbound-queue/runtime-api/Cargo.toml | 38 ---------------- .../inbound-queue/runtime-api/src/lib.rs | 14 ------ .../pallets/inbound-queue/src/api.rs | 44 ------------------- .../pallets/inbound-queue/src/lib.rs | 1 - .../snowbridge/primitives/core/src/inbound.rs | 9 ---- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 - .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 13 +----- 9 files changed, 2 insertions(+), 135 deletions(-) delete mode 100644 bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml delete mode 100644 bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs delete mode 100644 bridges/snowbridge/pallets/inbound-queue/src/api.rs diff --git a/Cargo.lock b/Cargo.lock index 546c2ef4a2d8..9d99306d2a08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2114,7 +2114,6 @@ dependencies = [ "serde", "snowbridge-beacon-primitives", "snowbridge-core", - "snowbridge-inbound-queue-runtime-api", "snowbridge-outbound-queue-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-inbound-queue", @@ -18661,20 +18660,6 @@ dependencies = [ "wasm-bindgen-test", ] -[[package]] -name = "snowbridge-inbound-queue-runtime-api" -version = "0.2.0" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "snowbridge-core", - "snowbridge-router-primitives", - "sp-api", - "sp-std 14.0.0", - "staging-xcm", -] - [[package]] name = "snowbridge-milagro-bls" version = "1.5.4" diff --git a/bridges/snowbridge/Cargo.toml b/bridges/snowbridge/Cargo.toml index a342d970b2a7..ca70de1d0e07 100644 --- a/bridges/snowbridge/Cargo.toml +++ b/bridges/snowbridge/Cargo.toml @@ -10,7 +10,6 @@ members = [ "pallets/ethereum-client/fixtures", "pallets/inbound-queue", "pallets/inbound-queue/fixtures", - "pallets/inbound-queue/runtime-api", "pallets/outbound-queue", "pallets/outbound-queue/merkle-tree", "pallets/outbound-queue/runtime-api", diff --git a/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml b/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml deleted file mode 100644 index e6278017d426..000000000000 --- a/bridges/snowbridge/pallets/inbound-queue/runtime-api/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "snowbridge-inbound-queue-runtime-api" -description = "Snowbridge Inbound Queue Runtime API" -version = "0.2.0" -authors = ["Snowfork "] -edition.workspace = true -repository.workspace = true -license = "Apache-2.0" -categories = ["cryptography::cryptocurrencies"] - -[lints] -workspace = true - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = { version = "3.1.5", package = "parity-scale-codec", features = ["derive"], default-features = false } -scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } -sp-std = { path = "../../../../../substrate/primitives/std", default-features = false } -sp-api = { path = "../../../../../substrate/primitives/api", default-features = false } -frame-support = { path = "../../../../../substrate/frame/support", default-features = false } -snowbridge-core = { path = "../../../primitives/core", default-features = false } -snowbridge-router-primitives = { path = "../../../primitives/router", default-features = false } -xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false } - -[features] -default = ["std"] -std = [ - "codec/std", - "frame-support/std", - "scale-info/std", - "snowbridge-core/std", - "snowbridge-router-primitives/std", - "sp-api/std", - "sp-std/std", - "xcm/std", -] diff --git a/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs deleted file mode 100644 index 6ea0d8b647f6..000000000000 --- a/bridges/snowbridge/pallets/inbound-queue/runtime-api/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2023 Snowfork -#![cfg_attr(not(feature = "std"), no_std)] - -use snowbridge_core::inbound::{EstimateInboundFeeError, Log}; -use xcm::VersionedAssets; - -sp_api::decl_runtime_apis! { - pub trait InboundQueueApi - { - /// Calculate the delivery fee for `command` - fn calculate_fee(log: Log) -> Result; - } -} diff --git a/bridges/snowbridge/pallets/inbound-queue/src/api.rs b/bridges/snowbridge/pallets/inbound-queue/src/api.rs deleted file mode 100644 index c9023f49318b..000000000000 --- a/bridges/snowbridge/pallets/inbound-queue/src/api.rs +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// SPDX-FileCopyrightText: 2023 Snowfork -#![cfg_attr(not(feature = "std"), no_std)] - -use crate::{envelope::Envelope, Config}; -use codec::DecodeAll; -use snowbridge_core::{ - inbound::{EstimateInboundFeeError, Log}, - StaticLookup, -}; -use snowbridge_router_primitives::inbound::{ConvertMessage, VersionedMessage}; -use sp_core::Get; -use sp_runtime::SaturatedConversion; -use xcm::{ - prelude::{Location, Parachain, SendXcm}, - v4::Asset, - VersionedAssets, -}; - -pub fn calculate_fee(event_log: Log) -> Result -where - T: Config, -{ - let envelope = - Envelope::try_from(&event_log).map_err(|_| EstimateInboundFeeError::InvalidEnvelope)?; - let versioned_message = VersionedMessage::decode_all(&mut envelope.payload.as_ref()) - .map_err(|_| EstimateInboundFeeError::InvalidPayload)?; - let channel = T::ChannelLookup::lookup(envelope.channel_id) - .ok_or(EstimateInboundFeeError::InvalidChannel)?; - let (xcm, _) = T::MessageConverter::convert(envelope.message_id, versioned_message) - .map_err(|_| EstimateInboundFeeError::VersionedConversionFailed)?; - - let dest = Location::new(1, [Parachain(channel.para_id.into())]); - let (_, mut send_cost) = T::XcmSender::validate(&mut Some(dest), &mut Some(xcm)) - .map_err(|_| EstimateInboundFeeError::Unroutable)?; - - let delivery_amount = crate::Pallet::::calculate_delivery_cost(T::MaxMessageSize::get()) - .saturated_into::(); - let delivery_cost = Asset::from((Location::parent(), delivery_amount)); - - send_cost.push(delivery_cost); - - Ok(VersionedAssets::from(send_cost)) -} diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index d55448fe3e91..cccbc6d97484 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -33,7 +33,6 @@ pub mod weights; #[cfg(test)] mod mock; -pub mod api; #[cfg(test)] mod test; diff --git a/bridges/snowbridge/primitives/core/src/inbound.rs b/bridges/snowbridge/primitives/core/src/inbound.rs index 064a3aff7dd0..9e8ed789ab50 100644 --- a/bridges/snowbridge/primitives/core/src/inbound.rs +++ b/bridges/snowbridge/primitives/core/src/inbound.rs @@ -80,12 +80,3 @@ pub struct InboundQueueFixture { pub finalized_header: BeaconHeader, pub block_roots_root: H256, } - -#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)] -pub enum EstimateInboundFeeError { - InvalidEnvelope, - InvalidPayload, - InvalidChannel, - VersionedConversionFailed, - Unroutable, -} diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 3b25761bd08c..f5a75aa03acd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -118,7 +118,6 @@ snowbridge-pallet-outbound-queue = { path = "../../../../../bridges/snowbridge/p snowbridge-outbound-queue-runtime-api = { path = "../../../../../bridges/snowbridge/pallets/outbound-queue/runtime-api", default-features = false } snowbridge-router-primitives = { path = "../../../../../bridges/snowbridge/primitives/router", default-features = false } snowbridge-runtime-common = { path = "../../../../../bridges/snowbridge/runtime/runtime-common", default-features = false } -snowbridge-inbound-queue-runtime-api = { path = "../../../../../bridges/snowbridge/pallets/inbound-queue/runtime-api", default-features = false } bridge-hub-common = { path = "../common", default-features = false } @@ -195,7 +194,6 @@ std = [ "serde", "snowbridge-beacon-primitives/std", "snowbridge-core/std", - "snowbridge-inbound-queue-runtime-api/std", "snowbridge-outbound-queue-runtime-api/std", "snowbridge-pallet-ethereum-client/std", "snowbridge-pallet-inbound-queue/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index b2f45d1802ed..5fe682c4e9fc 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -38,9 +38,7 @@ pub mod xcm_config; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::{ - gwei, - inbound::{EstimateInboundFeeError, Log}, - meth, + gwei, meth, outbound::{Command, Fee}, AgentId, AllowSiblingsOnly, PricingParameters, Rewards, }; @@ -85,7 +83,7 @@ use bridge_hub_common::{ use pallet_xcm::EnsureXcm; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; pub use sp_runtime::{MultiAddress, Perbill, Permill}; -use xcm::{VersionedAssets, VersionedLocation}; +use xcm::VersionedLocation; use xcm_config::{TreasuryAccount, XcmOriginToTransactDispatchOrigin, XcmRouter}; #[cfg(any(feature = "std", test))] @@ -1053,13 +1051,6 @@ impl_runtime_apis! { } } - impl snowbridge_inbound_queue_runtime_api::InboundQueueApi for Runtime { - - fn calculate_fee(log: Log) -> Result { - snowbridge_pallet_inbound_queue::api::calculate_fee::(log) - } - } - #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { From 7e8b9e0a3e2f6a8a8d87643e12c918f663796568 Mon Sep 17 00:00:00 2001 From: ron Date: Mon, 29 Apr 2024 22:11:12 +0800 Subject: [PATCH 06/11] Add tests calculate all delivery costs --- Cargo.lock | 1 + bridges/snowbridge/Cargo.lock | 15 +--- .../pallets/outbound-queue/src/lib.rs | 2 +- .../snowbridge/runtime/test-common/Cargo.toml | 83 ++++++++++--------- .../snowbridge/runtime/test-common/src/lib.rs | 49 ++++++++++- .../bridge-hub-rococo/tests/snowbridge.rs | 7 ++ 6 files changed, 101 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d99306d2a08..d716cbf8c58c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18882,6 +18882,7 @@ dependencies = [ "snowbridge-core", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-inbound-queue", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "sp-core", diff --git a/bridges/snowbridge/Cargo.lock b/bridges/snowbridge/Cargo.lock index b44ee684ab38..48dbdb4a6c56 100644 --- a/bridges/snowbridge/Cargo.lock +++ b/bridges/snowbridge/Cargo.lock @@ -4539,20 +4539,6 @@ dependencies = [ "wasm-bindgen-test", ] -[[package]] -name = "snowbridge-inbound-queue-runtime-api" -version = "0.2.0" -dependencies = [ - "frame-support", - "parity-scale-codec", - "scale-info", - "snowbridge-core", - "snowbridge-router-primitives", - "sp-api", - "sp-std 14.0.0", - "staging-xcm", -] - [[package]] name = "snowbridge-milagro-bls" version = "1.5.4" @@ -4775,6 +4761,7 @@ dependencies = [ "snowbridge-core", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-inbound-queue", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "sp-core", diff --git a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs index 9b9dbe854a5e..664ea0911e53 100644 --- a/bridges/snowbridge/pallets/outbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/outbound-queue/src/lib.rs @@ -402,7 +402,7 @@ pub mod pallet { } /// The local component of the message processing fees in native currency - pub(crate) fn calculate_local_fee() -> T::Balance { + pub fn calculate_local_fee() -> T::Balance { T::WeightToFee::weight_to_fee( &T::WeightInfo::do_process_message().saturating_add(T::WeightInfo::commit_single()), ) diff --git a/bridges/snowbridge/runtime/test-common/Cargo.toml b/bridges/snowbridge/runtime/test-common/Cargo.toml index 92970339fac0..b79f8f6ba597 100644 --- a/bridges/snowbridge/runtime/test-common/Cargo.toml +++ b/bridges/snowbridge/runtime/test-common/Cargo.toml @@ -42,53 +42,56 @@ snowbridge-core = { path = "../../primitives/core", default-features = false } snowbridge-pallet-ethereum-client = { path = "../../pallets/ethereum-client", default-features = false } snowbridge-pallet-ethereum-client-fixtures = { path = "../../pallets/ethereum-client/fixtures", default-features = false } snowbridge-pallet-outbound-queue = { path = "../../pallets/outbound-queue", default-features = false } +snowbridge-pallet-inbound-queue = { path = "../../pallets/inbound-queue", default-features = false } snowbridge-pallet-system = { path = "../../pallets/system", default-features = false } [features] default = ["std"] std = [ - "codec/std", - "cumulus-pallet-parachain-system/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-message-queue/std", - "pallet-session/std", - "pallet-timestamp/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-runtimes-test-utils/std", - "snowbridge-core/std", - "snowbridge-pallet-ethereum-client-fixtures/std", - "snowbridge-pallet-ethereum-client/std", - "snowbridge-pallet-outbound-queue/std", - "snowbridge-pallet-system/std", - "sp-core/std", - "sp-io/std", - "sp-keyring/std", - "sp-runtime/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-parachain-system/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-message-queue/std", + "pallet-session/std", + "pallet-timestamp/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-runtimes-test-utils/std", + "snowbridge-core/std", + "snowbridge-pallet-ethereum-client-fixtures/std", + "snowbridge-pallet-ethereum-client/std", + "snowbridge-pallet-outbound-queue/std", + "snowbridge-pallet-inbound-queue/std", + "snowbridge-pallet-system/std", + "sp-core/std", + "sp-io/std", + "sp-keyring/std", + "sp-runtime/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "snowbridge-core/runtime-benchmarks", - "snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks", - "snowbridge-pallet-ethereum-client/runtime-benchmarks", - "snowbridge-pallet-outbound-queue/runtime-benchmarks", - "snowbridge-pallet-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "snowbridge-core/runtime-benchmarks", + "snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks", + "snowbridge-pallet-ethereum-client/runtime-benchmarks", + "snowbridge-pallet-outbound-queue/runtime-benchmarks", + "snowbridge-pallet-inbound-queue/runtime-benchmarks", + "snowbridge-pallet-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] fast-runtime = [] diff --git a/bridges/snowbridge/runtime/test-common/src/lib.rs b/bridges/snowbridge/runtime/test-common/src/lib.rs index 8f36313e360f..579f4f9ce4d0 100644 --- a/bridges/snowbridge/runtime/test-common/src/lib.rs +++ b/bridges/snowbridge/runtime/test-common/src/lib.rs @@ -12,7 +12,7 @@ use parachains_runtimes_test_utils::{ }; use snowbridge_core::{ChannelId, ParaId}; use snowbridge_pallet_ethereum_client_fixtures::*; -use sp_core::{H160, U256}; +use sp_core::{Get, H160, U256}; use sp_keyring::AccountKeyring::*; use sp_runtime::{traits::Header, AccountId32, DigestItem, SaturatedConversion, Saturating}; use xcm::{ @@ -561,3 +561,50 @@ pub fn ethereum_to_polkadot_message_extrinsics_work( assert_ok!(sync_committee_outcome); }); } + +pub fn fetch_delivery_cost(collator_session_key: CollatorSessionKeys) +where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_parachain_system::Config + + snowbridge_pallet_outbound_queue::Config + + snowbridge_pallet_inbound_queue::Config + + pallet_timestamp::Config, + XcmConfig: xcm_executor::Config, + ValidatorIdOf: From>, + ::AccountId: From + AsRef<[u8]>, +{ + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_para_id(1013.into()) + .with_tracing() + .build() + .execute_with(|| { + let _ = >::force_xcm_version( + RuntimeHelper::::root_origin(), + Box::new(Location { parents: 1, interior: [Parachain(1000)].into() }), + XCM_VERSION, + ); + let inbound_delivery_cost = + >::calculate_delivery_cost( + ::MaxMessageSize::get(), + ); + let inbound_send_cost = + >::calculate_send_cost( + 1000.into(), + ::MaxSendCostXcm::get(), + ) + .unwrap(); + let outbound_delivery_cost = + >::calculate_local_fee(); + + println!("inbound_delivery_cost:{:?}", inbound_delivery_cost); + println!("inbound_send_cost:{:?}", inbound_send_cost); + println!("outbound_delivery_cost:{:?}", outbound_delivery_cost); + }) +} diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs index 5960ab7b5505..b2952b2f2c65 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/snowbridge.rs @@ -202,3 +202,10 @@ fn construct_and_apply_extrinsic( let r = Executive::apply_extrinsic(xt); r.unwrap() } + +#[test] +fn fetch_delivery_cost() { + snowbridge_runtime_test_common::fetch_delivery_cost::( + collator_session_keys(), + ); +} From 8ad87ba8f861f8020752d52063b017423c80553f Mon Sep 17 00:00:00 2001 From: ron Date: Wed, 26 Jun 2024 12:45:24 +0800 Subject: [PATCH 07/11] Use a const fee instead --- bridges/snowbridge/Cargo.lock | 2 ++ .../pallets/inbound-queue/src/lib.rs | 30 ++++--------------- .../pallets/inbound-queue/src/mock.rs | 24 ++------------- .../snowbridge/runtime/test-common/src/lib.rs | 6 +--- .../src/bridge_to_ethereum_config.rs | 2 ++ 5 files changed, 12 insertions(+), 52 deletions(-) diff --git a/bridges/snowbridge/Cargo.lock b/bridges/snowbridge/Cargo.lock index 620f87a1dd56..3cb15b781ddb 100644 --- a/bridges/snowbridge/Cargo.lock +++ b/bridges/snowbridge/Cargo.lock @@ -3073,6 +3073,7 @@ name = "pallet-migrations" version = "1.0.0" dependencies = [ "docify", + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", @@ -4748,6 +4749,7 @@ dependencies = [ "snowbridge-core", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-inbound-queue", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-system", "sp-core", diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index b5d243ace29c..34fd69c1d671 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -52,8 +52,8 @@ use sp_core::H160; use sp_runtime::traits::Zero; use sp_std::vec; use xcm::prelude::{ - send_xcm, validate_send, Junction::*, Location, SendError as XcmpSendError, SendXcm, Xcm, - XcmContext, XcmHash, *, + send_xcm, Junction::*, Location, SendError as XcmpSendError, SendXcm, Xcm, XcmContext, XcmHash, + *, }; use xcm_executor::traits::TransactAsset; @@ -143,7 +143,7 @@ pub mod pallet { type AssetTransactor: TransactAsset; /// The most expensive xcm here only used to estimate send cost - type MaxSendCostXcm: Get>; + type MaxSendCost: Get>; } #[pallet::hooks] @@ -362,33 +362,13 @@ pub mod pallet { })?; Ok(()) } - - pub fn calculate_send_cost( - para_id: ParaId, - xcm: Xcm<()>, - ) -> Result, Error> { - let dest = Location::new(1, [Parachain(para_id.into())]); - let (_, assets) = validate_send::(dest, xcm).map_err(Error::::from)?; - ensure!(assets.len() == 1, Error::::Send(SendError::Fees)); - let fee = assets.get(0).unwrap(); - let cost: u128 = match (*fee).fun { - Fungible(amount) => Some(amount), - _ => None, - } - .ok_or(Error::::Send(SendError::Fees))?; - Ok(cost.saturated_into::>()) - } } /// API for accessing the delivery cost of a message impl Get> for Pallet { fn get() -> BalanceOf { - // Cost here based on MaxMessagePayloadSize(the worst case) - let delivery_cost = Self::calculate_delivery_cost(T::MaxMessageSize::get()); - // Cost here based on MaxSendCostXcm(the worst case) - let send_cost = Self::calculate_send_cost(1000_u32.into(), T::MaxSendCostXcm::get()) - .unwrap_or_default(); - delivery_cost.saturating_add(send_cost) + Self::calculate_delivery_cost(T::MaxMessageSize::get()) + .saturating_add(T::MaxSendCost::get()) } } } diff --git a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs index 77ba83bd9b47..df2f65fb34d6 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs @@ -176,27 +176,7 @@ parameter_types! { multiplier: FixedU128::from_rational(1, 1), }; pub DefaultFee: Asset = (Parent, 1_000_000_000).into(); - pub MaxSendCostXcm: Xcm<()> = vec![ - ReceiveTeleportedAsset(DefaultFee::get().into()), - BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, - DescendOrigin(PalletInstance(80).into()), - UniversalOrigin(GlobalConsensus(Ethereum { chain_id: 1 })), - ReserveAssetDeposited(DefaultFee::get().into()), - ClearOrigin, - DepositReserveAsset { - assets: Definite(DefaultFee::get().into()), - dest: Location::new(1, [Parachain(1000)]), - xcm: vec![ - // Buy execution on target. - BuyExecution { fees: DefaultFee::get(), weight_limit: Unlimited }, - // Deposit asset to beneficiary. - DepositAsset { assets: Definite(DefaultFee::get().into()), beneficiary: Location::default() }, - // Forward message id to destination parachain. - SetTopic([0; 32]), - ] - .into(), - }, - ].into(); + pub MaxSendCost: u128 = 1; } pub const DOT: u128 = 10_000_000_000; @@ -270,7 +250,7 @@ impl inbound_queue::Config for Test { type LengthToFee = IdentityFee; type MaxMessageSize = ConstU32<1024>; type AssetTransactor = SuccessfulTransactor; - type MaxSendCostXcm = MaxSendCostXcm; + type MaxSendCost = MaxSendCost; } pub fn last_events(n: usize) -> Vec { diff --git a/bridges/snowbridge/runtime/test-common/src/lib.rs b/bridges/snowbridge/runtime/test-common/src/lib.rs index 579f4f9ce4d0..0e2753d61599 100644 --- a/bridges/snowbridge/runtime/test-common/src/lib.rs +++ b/bridges/snowbridge/runtime/test-common/src/lib.rs @@ -595,11 +595,7 @@ where ::MaxMessageSize::get(), ); let inbound_send_cost = - >::calculate_send_cost( - 1000.into(), - ::MaxSendCostXcm::get(), - ) - .unwrap(); + ::MaxSendCost::get(); let outbound_delivery_cost = >::calculate_local_fee(); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_ethereum_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_ethereum_config.rs index 53a536655408..96aae0e50eb9 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_ethereum_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_to_ethereum_config.rs @@ -63,6 +63,7 @@ parameter_types! { rewards: Rewards { local: 1 * UNITS, remote: meth(1) }, multiplier: FixedU128::from_rational(1, 1), }; + pub MaxSendCost: Balance = UNITS / 10; } impl snowbridge_pallet_inbound_queue::Config for Runtime { @@ -90,6 +91,7 @@ impl snowbridge_pallet_inbound_queue::Config for Runtime { type WeightInfo = crate::weights::snowbridge_pallet_inbound_queue::WeightInfo; type PricingParameters = EthereumSystem; type AssetTransactor = ::AssetTransactor; + type MaxSendCost = MaxSendCost; } impl snowbridge_pallet_outbound_queue::Config for Runtime { From ca5f974d6def42c870d8e832331fd1b24999e4d1 Mon Sep 17 00:00:00 2001 From: ron Date: Wed, 26 Jun 2024 13:00:51 +0800 Subject: [PATCH 08/11] Fix taplo --- .../snowbridge/runtime/test-common/Cargo.toml | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/bridges/snowbridge/runtime/test-common/Cargo.toml b/bridges/snowbridge/runtime/test-common/Cargo.toml index 35d8b384e781..b33fdb48ff7f 100644 --- a/bridges/snowbridge/runtime/test-common/Cargo.toml +++ b/bridges/snowbridge/runtime/test-common/Cargo.toml @@ -48,50 +48,50 @@ snowbridge-pallet-system = { path = "../../pallets/system", default-features = f [features] default = ["std"] std = [ - "codec/std", - "cumulus-pallet-parachain-system/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-message-queue/std", - "pallet-session/std", - "pallet-timestamp/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-runtimes-test-utils/std", - "snowbridge-core/std", - "snowbridge-pallet-ethereum-client-fixtures/std", - "snowbridge-pallet-ethereum-client/std", - "snowbridge-pallet-outbound-queue/std", - "snowbridge-pallet-inbound-queue/std", - "snowbridge-pallet-system/std", - "sp-core/std", - "sp-io/std", - "sp-keyring/std", - "sp-runtime/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-parachain-system/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-message-queue/std", + "pallet-session/std", + "pallet-timestamp/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-runtimes-test-utils/std", + "snowbridge-core/std", + "snowbridge-pallet-ethereum-client-fixtures/std", + "snowbridge-pallet-ethereum-client/std", + "snowbridge-pallet-inbound-queue/std", + "snowbridge-pallet-outbound-queue/std", + "snowbridge-pallet-system/std", + "sp-core/std", + "sp-io/std", + "sp-keyring/std", + "sp-runtime/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "snowbridge-core/runtime-benchmarks", - "snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks", - "snowbridge-pallet-ethereum-client/runtime-benchmarks", - "snowbridge-pallet-outbound-queue/runtime-benchmarks", - "snowbridge-pallet-inbound-queue/runtime-benchmarks", - "snowbridge-pallet-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "snowbridge-core/runtime-benchmarks", + "snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks", + "snowbridge-pallet-ethereum-client/runtime-benchmarks", + "snowbridge-pallet-inbound-queue/runtime-benchmarks", + "snowbridge-pallet-outbound-queue/runtime-benchmarks", + "snowbridge-pallet-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] fast-runtime = [] From 129cb746a0bc821033f077812afe90403fb45cb8 Mon Sep 17 00:00:00 2001 From: ron Date: Tue, 2 Jul 2024 09:54:51 +0800 Subject: [PATCH 09/11] Move the cost to calculate_delivery_cost --- bridges/snowbridge/pallets/inbound-queue/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index 34fd69c1d671..fd45e1f55ece 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -337,6 +337,7 @@ pub mod pallet { weight_fee .saturating_add(len_fee) .saturating_add(T::PricingParameters::get().rewards.local) + .saturating_add(T::MaxSendCost::get()) } /// Burn the amount of the fee embedded into the XCM for teleports @@ -368,7 +369,6 @@ pub mod pallet { impl Get> for Pallet { fn get() -> BalanceOf { Self::calculate_delivery_cost(T::MaxMessageSize::get()) - .saturating_add(T::MaxSendCost::get()) } } } From 4012a59586b251ecfff74f4f83bef0b59b4f3977 Mon Sep 17 00:00:00 2001 From: ron Date: Tue, 30 Jul 2024 13:36:07 +0800 Subject: [PATCH 10/11] Assert the configured cost can cover the worst case xcm --- .../pallets/inbound-queue/src/lib.rs | 7 +++ .../snowbridge/runtime/test-common/src/lib.rs | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs index fd45e1f55ece..5312171eda8a 100644 --- a/bridges/snowbridge/pallets/inbound-queue/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue/src/lib.rs @@ -331,6 +331,13 @@ pub mod pallet { Ok(xcm_hash) } + pub fn calculate_send_cost(xcm: Xcm<()>, dest: ParaId) -> Result> { + let dest = Location::new(1, [Parachain(dest.into())]); + let (_, fee) = T::XcmSender::validate(&mut Some(dest), &mut Some(xcm)) + .map_err(Error::::from)?; + Ok(fee) + } + pub fn calculate_delivery_cost(length: u32) -> BalanceOf { let weight_fee = T::WeightToFee::weight_to_fee(&T::WeightInfo::submit()); let len_fee = T::LengthToFee::weight_to_fee(&Weight::from_parts(length as u64, 0)); diff --git a/bridges/snowbridge/runtime/test-common/src/lib.rs b/bridges/snowbridge/runtime/test-common/src/lib.rs index 0e2753d61599..f484f84c1f58 100644 --- a/bridges/snowbridge/runtime/test-common/src/lib.rs +++ b/bridges/snowbridge/runtime/test-common/src/lib.rs @@ -602,5 +602,60 @@ where println!("inbound_delivery_cost:{:?}", inbound_delivery_cost); println!("inbound_send_cost:{:?}", inbound_send_cost); println!("outbound_delivery_cost:{:?}", outbound_delivery_cost); + + const CHAIN_ID: u64 = 11155111; + const WETH: [u8; 20] = [1; 20]; + + let total_fee_amount: u32 = 2_000_000_000; + let asset_hub_fee_amount: u32 = 1_000_000_000; + let dest_fee_amount: u32 = total_fee_amount - asset_hub_fee_amount; + + let total_fee_asset: Asset = (Location::parent(), total_fee_amount).into(); + let asset_hub_fee_asset: Asset = (Location::parent(), asset_hub_fee_amount).into(); + let dest_para_fee_asset: Asset = (Location::parent(), dest_fee_amount).into(); + + let weth_asset_id = Location::new( + 2, + [ + GlobalConsensus(Ethereum { chain_id: CHAIN_ID }), + AccountKey20 { network: None, key: WETH.into() }, + ], + ); + let weth_asset = Asset::from((weth_asset_id.clone(), 1_000_000)); + + let xcm_worst_case = Xcm(vec![ + ReceiveTeleportedAsset(total_fee_asset.into()), + BuyExecution { fees: asset_hub_fee_asset, weight_limit: Unlimited }, + DescendOrigin(PalletInstance(80).into()), + UniversalOrigin(GlobalConsensus(Ethereum { chain_id: CHAIN_ID })), + ReserveAssetDeposited(weth_asset.clone().into()), + ClearOrigin, + DepositReserveAsset { + assets: Definite(vec![dest_para_fee_asset.clone(), weth_asset.clone()].into()), + dest: Location::new(1, [Parachain(2000)]), + xcm: vec![ + BuyExecution { fees: dest_para_fee_asset, weight_limit: Unlimited }, + DepositAsset { + assets: Definite(weth_asset.into()), + beneficiary: [1; 32].into(), + }, + SetTopic([1; 32]), + ] + .into(), + }, + ]); + + let delivery_cost_worst_case = + >::calculate_send_cost( + xcm_worst_case, + ParaId::from(1000), + ) + .unwrap() + .into_inner(); + // println!("{:?}", delivery_cost_worst_case[0]); + + let send_cost_max: Asset = + (Location::parent(), inbound_send_cost.saturated_into::()).into(); + assert!(send_cost_max.gt(&delivery_cost_worst_case[0])) }) } From 279bda2ce41d4ebb3692b175cbae6fcb4ff3ef40 Mon Sep 17 00:00:00 2001 From: ron Date: Wed, 31 Jul 2024 13:29:22 +0800 Subject: [PATCH 11/11] Fix check --- .../bridge-hub-westend/src/bridge_to_ethereum_config.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs index 7922d3ed02b1..34b74935b5ef 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs @@ -64,6 +64,7 @@ parameter_types! { rewards: Rewards { local: 1 * UNITS, remote: meth(1) }, multiplier: FixedU128::from_rational(1, 1), }; + pub MaxSendCost: Balance = UNITS / 10; } impl snowbridge_pallet_inbound_queue::Config for Runtime { @@ -91,6 +92,7 @@ impl snowbridge_pallet_inbound_queue::Config for Runtime { type WeightInfo = crate::weights::snowbridge_pallet_inbound_queue::WeightInfo; type PricingParameters = EthereumSystem; type AssetTransactor = ::AssetTransactor; + type MaxSendCost = MaxSendCost; } impl snowbridge_pallet_outbound_queue::Config for Runtime {