From 91992179d814ef2ca722cec01197a23003fc2219 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 09:57:37 +0200 Subject: [PATCH 01/11] rename crate from snowbridge-pallet-inbound-queue-fixtures-v2 to snowbridge-pallet-inbound-queue-v2-fixtures. --- Cargo.lock | 28 +++++++++---------- Cargo.toml | 2 +- .../pallets/inbound-queue-v2/Cargo.toml | 6 ++-- .../inbound-queue-v2/fixtures/Cargo.toml | 2 +- .../inbound-queue-v2/src/benchmarking.rs | 2 +- umbrella/Cargo.toml | 8 +++--- umbrella/src/lib.rs | 4 +-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a28ca4fbcbe8..909b82c648f85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19276,8 +19276,8 @@ dependencies = [ "snowbridge-pallet-ethereum-client-fixtures 0.9.0", "snowbridge-pallet-inbound-queue 0.2.0", "snowbridge-pallet-inbound-queue-fixtures 0.10.0", - "snowbridge-pallet-inbound-queue-fixtures-v2", "snowbridge-pallet-inbound-queue-v2", + "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-outbound-queue 0.2.0", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system 0.2.0", @@ -25723,18 +25723,6 @@ dependencies = [ "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "snowbridge-pallet-inbound-queue-fixtures-v2" -version = "0.10.0" -dependencies = [ - "hex-literal", - "snowbridge-beacon-primitives 0.2.0", - "snowbridge-core 0.2.0", - "snowbridge-inbound-queue-primitives", - "sp-core 28.0.0", - "sp-std 14.0.0", -] - [[package]] name = "snowbridge-pallet-inbound-queue-v2" version = "0.2.0" @@ -25755,7 +25743,7 @@ dependencies = [ "snowbridge-core 0.2.0", "snowbridge-inbound-queue-primitives", "snowbridge-pallet-ethereum-client 0.2.0", - "snowbridge-pallet-inbound-queue-fixtures-v2", + "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-test-utils", "sp-core 28.0.0", "sp-io 30.0.0", @@ -25768,6 +25756,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "snowbridge-pallet-inbound-queue-v2-fixtures" +version = "0.10.0" +dependencies = [ + "hex-literal", + "snowbridge-beacon-primitives 0.2.0", + "snowbridge-core 0.2.0", + "snowbridge-inbound-queue-primitives", + "sp-core 28.0.0", + "sp-std 14.0.0", +] + [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 732ae372b53d8..f0ecc9e471e1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1265,7 +1265,7 @@ snowbridge-pallet-ethereum-client = { path = "bridges/snowbridge/pallets/ethereu snowbridge-pallet-ethereum-client-fixtures = { path = "bridges/snowbridge/pallets/ethereum-client/fixtures", 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", default-features = false } -snowbridge-pallet-inbound-queue-fixtures-v2 = { path = "bridges/snowbridge/pallets/inbound-queue-v2/fixtures", default-features = false } +snowbridge-pallet-inbound-queue-v2-fixtures = { path = "bridges/snowbridge/pallets/inbound-queue-v2/fixtures", default-features = false } snowbridge-pallet-inbound-queue-v2 = { path = "bridges/snowbridge/pallets/inbound-queue-v2", default-features = false } snowbridge-pallet-outbound-queue = { path = "bridges/snowbridge/pallets/outbound-queue", default-features = false } snowbridge-pallet-outbound-queue-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2", default-features = false } diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml b/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml index 7daea7f7517f7..d49cb7c3561b8 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml +++ b/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml @@ -39,7 +39,7 @@ xcm-executor = { workspace = true } snowbridge-beacon-primitives = { workspace = true } snowbridge-core = { workspace = true } snowbridge-inbound-queue-primitives = { workspace = true } -snowbridge-pallet-inbound-queue-fixtures-v2 = { optional = true, workspace = true } +snowbridge-pallet-inbound-queue-v2-fixtures = { optional = true, workspace = true } bp-relayers = { workspace = true } @@ -67,7 +67,7 @@ std = [ "snowbridge-beacon-primitives/std", "snowbridge-core/std", "snowbridge-inbound-queue-primitives/std", - "snowbridge-pallet-inbound-queue-fixtures-v2?/std", + "snowbridge-pallet-inbound-queue-v2-fixtures?/std", "sp-core/std", "sp-io/std", "sp-runtime/std", @@ -87,7 +87,7 @@ runtime-benchmarks = [ "snowbridge-core/runtime-benchmarks", "snowbridge-inbound-queue-primitives/runtime-benchmarks", "snowbridge-pallet-ethereum-client/runtime-benchmarks", - "snowbridge-pallet-inbound-queue-fixtures-v2/runtime-benchmarks", + "snowbridge-pallet-inbound-queue-v2-fixtures/runtime-benchmarks", "snowbridge-test-utils/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/fixtures/Cargo.toml b/bridges/snowbridge/pallets/inbound-queue-v2/fixtures/Cargo.toml index 4b9e07fd472d0..1d981e8f3ad50 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/fixtures/Cargo.toml +++ b/bridges/snowbridge/pallets/inbound-queue-v2/fixtures/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snowbridge-pallet-inbound-queue-fixtures-v2" +name = "snowbridge-pallet-inbound-queue-v2-fixtures" description = "Snowbridge Inbound Queue Test Fixtures V2" version = "0.10.0" authors = ["Snowfork "] diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/src/benchmarking.rs b/bridges/snowbridge/pallets/inbound-queue-v2/src/benchmarking.rs index dda47b4e9f0e7..a79648ef9bdc4 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/src/benchmarking.rs +++ b/bridges/snowbridge/pallets/inbound-queue-v2/src/benchmarking.rs @@ -6,7 +6,7 @@ use crate::Pallet as InboundQueue; use frame_benchmarking::v2::*; use frame_support::assert_ok; use frame_system::RawOrigin; -use snowbridge_pallet_inbound_queue_fixtures_v2::register_token::make_register_token_message; +use snowbridge_pallet_inbound_queue_v2_fixtures::register_token::make_register_token_message; #[benchmarks] mod benchmarks { diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 7006f1b49b21d..6ee9c88e4afa1 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -180,7 +180,7 @@ std = [ "snowbridge-outbound-queue-runtime-api?/std", "snowbridge-pallet-ethereum-client-fixtures?/std", "snowbridge-pallet-ethereum-client?/std", - "snowbridge-pallet-inbound-queue-fixtures-v2?/std", + "snowbridge-pallet-inbound-queue-v2-fixtures?/std", "snowbridge-pallet-inbound-queue-fixtures?/std", "snowbridge-pallet-inbound-queue-v2?/std", "snowbridge-pallet-inbound-queue?/std", @@ -370,7 +370,7 @@ runtime-benchmarks = [ "snowbridge-inbound-queue-primitives?/runtime-benchmarks", "snowbridge-pallet-ethereum-client-fixtures?/runtime-benchmarks", "snowbridge-pallet-ethereum-client?/runtime-benchmarks", - "snowbridge-pallet-inbound-queue-fixtures-v2?/runtime-benchmarks", + "snowbridge-pallet-inbound-queue-v2-fixtures?/runtime-benchmarks", "snowbridge-pallet-inbound-queue-fixtures?/runtime-benchmarks", "snowbridge-pallet-inbound-queue-v2?/runtime-benchmarks", "snowbridge-pallet-inbound-queue?/runtime-benchmarks", @@ -576,7 +576,7 @@ with-tracing = [ "sp-tracing?/with-tracing", "sp-tracing?/with-tracing", ] -runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-runtime-api-v2", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-fixtures-v2", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-runtime-api-v2", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] +runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-runtime-api-v2", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-runtime-api-v2", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] runtime = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -1548,7 +1548,7 @@ default-features = false optional = true path = "../bridges/snowbridge/pallets/inbound-queue/fixtures" -[dependencies.snowbridge-pallet-inbound-queue-fixtures-v2] +[dependencies.snowbridge-pallet-inbound-queue-v2-fixtures] default-features = false optional = true path = "../bridges/snowbridge/pallets/inbound-queue-v2/fixtures" diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index bb54b34c41d9f..20afa709aa498 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -1220,8 +1220,8 @@ pub use snowbridge_pallet_inbound_queue; pub use snowbridge_pallet_inbound_queue_fixtures; /// Snowbridge Inbound Queue Test Fixtures V2. -#[cfg(feature = "snowbridge-pallet-inbound-queue-fixtures-v2")] -pub use snowbridge_pallet_inbound_queue_fixtures_v2; +#[cfg(feature = "snowbridge-pallet-inbound-queue-v2-fixtures")] +pub use snowbridge_pallet_inbound_queue_v2_fixtures; /// Snowbridge Inbound Queue Pallet V2. #[cfg(feature = "snowbridge-pallet-inbound-queue-v2")] From dc7973fb1a307d5aaa4f23ed9a7077e5dff2705f Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 10:32:09 +0200 Subject: [PATCH 02/11] pr comments --- Cargo.lock | 6 ++-- Cargo.toml | 2 +- .../pallets/inbound-queue-v2/src/lib.rs | 7 ++-- .../pallets/inbound-queue-v2/src/mock.rs | 4 ++- .../pallets/inbound-queue-v2/src/test.rs | 16 ++++----- .../outbound-queue-v2/runtime-api/Cargo.toml | 2 +- .../outbound-queue/src/v2/converter/tests.rs | 10 +++--- .../primitives/verification/README.md | 5 ++- .../src/tests/snowbridge.rs | 2 +- .../bridge-hubs/bridge-hub-westend/Cargo.toml | 4 +-- .../src/bridge_common_config.rs | 16 ++++----- .../src/bridge_to_ethereum_config.rs | 33 +++++++++---------- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 2 +- prdoc/pr_6706.prdoc | 4 +-- umbrella/Cargo.toml | 6 ++-- umbrella/src/lib.rs | 4 +-- 16 files changed, 61 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 909b82c648f85..de5383bca1421 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3001,7 +3001,7 @@ dependencies = [ "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api 0.2.0", - "snowbridge-outbound-queue-runtime-api-v2", + "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client 0.2.0", "snowbridge-pallet-inbound-queue 0.2.0", "snowbridge-pallet-inbound-queue-v2", @@ -19271,7 +19271,7 @@ dependencies = [ "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api 0.2.0", - "snowbridge-outbound-queue-runtime-api-v2", + "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client 0.2.0", "snowbridge-pallet-ethereum-client-fixtures 0.9.0", "snowbridge-pallet-inbound-queue 0.2.0", @@ -25551,7 +25551,7 @@ dependencies = [ ] [[package]] -name = "snowbridge-outbound-queue-runtime-api-v2" +name = "snowbridge-outbound-queue-v2-runtime-api" version = "0.2.0" dependencies = [ "frame-support 28.0.0", diff --git a/Cargo.toml b/Cargo.toml index f0ecc9e471e1a..447900ffb46c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1260,7 +1260,7 @@ snowbridge-inbound-queue-primitives = { path = "bridges/snowbridge/primitives/in snowbridge-merkle-tree = { path = "bridges/snowbridge/primitives/merkle-tree", default-features = false } snowbridge-outbound-queue-primitives = { path = "bridges/snowbridge/primitives/outbound-queue", default-features = false } snowbridge-outbound-queue-runtime-api = { path = "bridges/snowbridge/pallets/outbound-queue/runtime-api", default-features = false } -snowbridge-outbound-queue-runtime-api-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2/runtime-api", default-features = false } +snowbridge-outbound-queue-v2-runtime-api = { path = "bridges/snowbridge/pallets/outbound-queue-v2/runtime-api", default-features = false } snowbridge-pallet-ethereum-client = { path = "bridges/snowbridge/pallets/ethereum-client", default-features = false } snowbridge-pallet-ethereum-client-fixtures = { path = "bridges/snowbridge/pallets/ethereum-client/fixtures", default-features = false } snowbridge-pallet-inbound-queue = { path = "bridges/snowbridge/pallets/inbound-queue", default-features = false } diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs index 01362565dc100..38fd802d94bba 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs @@ -19,7 +19,7 @@ //! //! ## Message Submission //! -//! * [`Call::submit`]: Submit a message for verification and dispatch the final destination +//! * [`Call::submit`]: Submit a message for verification and dispatch to the final destination //! parachain. #![cfg_attr(not(feature = "std"), no_std)] @@ -283,9 +283,10 @@ pub mod pallet { ) -> Result { let (ticket, fee) = validate_send::(dest, xcm)?; let fee_payer = T::AccountToLocation::try_convert(&fee_payer).map_err(|err| { - log::error!( + tracing::error!( target: LOG_TARGET, - "Failed to convert account to XCM location: {err:?}", + ?err, + "Failed to convert account to XCM location", ); SendError::NotApplicable })?; diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/src/mock.rs b/bridges/snowbridge/pallets/inbound-queue-v2/src/mock.rs index 43a705b281a16..3980a038441d9 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/src/mock.rs +++ b/bridges/snowbridge/pallets/inbound-queue-v2/src/mock.rs @@ -36,6 +36,8 @@ frame_support::construct_runtime!( } ); +pub(crate) const ERROR_ADDRESS: [u8; 20] = hex!("0000000000000000000000000000000000000911"); + pub type AccountId = sp_runtime::AccountId32; type Balance = u128; @@ -99,7 +101,7 @@ pub struct MockVerifier; impl Verifier for MockVerifier { fn verify(log: &Log, _: &Proof) -> Result<(), VerificationError> { - if log.address == hex!("0000000000000000000000000000000000000911").into() { + if log.address == ERROR_ADDRESS.into() { return Err(VerificationError::InvalidProof) } Ok(()) diff --git a/bridges/snowbridge/pallets/inbound-queue-v2/src/test.rs b/bridges/snowbridge/pallets/inbound-queue-v2/src/test.rs index 57035ca4ee052..1bc1f37fed910 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/src/test.rs +++ b/bridges/snowbridge/pallets/inbound-queue-v2/src/test.rs @@ -4,7 +4,7 @@ use super::*; use crate::{mock::*, Error}; use codec::Encode; -use frame_support::{assert_err, assert_noop, assert_ok}; +use frame_support::{assert_noop, assert_ok}; use hex_literal::hex; use snowbridge_inbound_queue_primitives::{EventProof, Proof}; use snowbridge_test_utils::mock_xcm::{set_charge_fees_override, set_sender_override}; @@ -85,9 +85,9 @@ fn test_submit_verification_fails_with_invalid_proof() { }, }; // The mock verifier will error once it matches this address. - event.event_log.address = hex!("0000000000000000000000000000000000000911").into(); + event.event_log.address = ERROR_ADDRESS.into(); - assert_err!( + assert_noop!( InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::Verification(VerificationError::InvalidProof) ); @@ -110,7 +110,7 @@ fn test_submit_fails_with_malformed_message() { }, }; - assert_err!( + assert_noop!( InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::InvalidMessage ); @@ -145,7 +145,7 @@ fn test_using_same_nonce_fails() { "no event emitted." ); - assert_err!( + assert_noop!( InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::InvalidNonce ); @@ -216,7 +216,7 @@ fn test_xcm_send_failure() { }, }; - assert_err!( + assert_noop!( crate::test::InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::SendFailure ); @@ -246,7 +246,7 @@ fn test_xcm_send_validate_failure() { }, }; - assert_err!( + assert_noop!( crate::test::InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::Unreachable ); @@ -271,7 +271,7 @@ fn test_xcm_charge_fees_failure() { }, }; - assert_err!( + assert_noop!( crate::test::InboundQueue::submit(origin.clone(), Box::new(event.clone())), Error::::FeesNotMet ); diff --git a/bridges/snowbridge/pallets/outbound-queue-v2/runtime-api/Cargo.toml b/bridges/snowbridge/pallets/outbound-queue-v2/runtime-api/Cargo.toml index 2978ee742b9bd..4ac7078ebc97d 100644 --- a/bridges/snowbridge/pallets/outbound-queue-v2/runtime-api/Cargo.toml +++ b/bridges/snowbridge/pallets/outbound-queue-v2/runtime-api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snowbridge-outbound-queue-runtime-api-v2" +name = "snowbridge-outbound-queue-v2-runtime-api" description = "Snowbridge Outbound Queue Runtime API V2" version = "0.2.0" authors = ["Snowfork "] diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs index 1771eba6045c6..0298128c6db70 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs @@ -670,14 +670,14 @@ fn xcm_converter_with_different_fee_asset_succeed() { } #[test] -fn xcm_converter_with_fees_greater_than_reserve_succeed() { +fn xcm_converter_with_fees_greater_than_reserve_fails() { let network = BridgedNetwork::get(); let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000"); let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000"); let asset_location: Location = [AccountKey20 { network: None, key: token_address }].into(); - let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(1000) }.into(); + let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(2000) }.into(); // Fee is greater than asset amount let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into(); @@ -685,7 +685,7 @@ fn xcm_converter_with_fees_greater_than_reserve_succeed() { let message: Xcm<()> = vec![ WithdrawAsset(assets.clone()), - PayFees { asset: fee_asset }, + PayFees { asset: fee_asset }, // Fees exceed available balance WithdrawAsset(assets.clone()), AliasOrigin(Location::new(1, [GlobalConsensus(Polkadot), Parachain(1000)])), DepositAsset { @@ -694,10 +694,10 @@ fn xcm_converter_with_fees_greater_than_reserve_succeed() { }, SetTopic([0; 32]), ] - .into(); + .into(); let mut converter = XcmConverter::::new(&message, network); let result = converter.convert(); - assert_eq!(result.is_ok(), true); + assert_eq!(result.is_ok(), false); // Now expecting failure } #[test] diff --git a/bridges/snowbridge/primitives/verification/README.md b/bridges/snowbridge/primitives/verification/README.md index 0126be63aebaf..22be52e5be820 100644 --- a/bridges/snowbridge/primitives/verification/README.md +++ b/bridges/snowbridge/primitives/verification/README.md @@ -1,4 +1,3 @@ -# Core Primitives +# Verification Primitives -Contains common code core to Snowbridge, such as inbound and outbound queue types, pricing structs, ringbuffer data -types (used in the beacon client). +Defines traits and types for verifying event logs, transaction receipt proofs, and execution proofs, ensuring secure cross-chain message delivery. It provides validation mechanisms for Ethereum logs and proof structures to maintain the integrity of cross-chain communication. diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge.rs index 1c1b11899115a..2368f7479e861 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge.rs @@ -961,7 +961,7 @@ fn send_token_from_ethereum_to_penpal() { assert_ok!(::ForeignAssets::force_create( RuntimeOrigin::root(), weth_asset_location.clone().try_into().unwrap(), - asset_hub_sovereign.into(), + ethereum_sovereign.into(), false, 1, )); diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index dc7683834b91a..531a8ab904dad 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -115,7 +115,7 @@ snowbridge-inbound-queue-primitives = { workspace = true } snowbridge-merkle-tree = { workspace = true } snowbridge-outbound-queue-primitives = { workspace = true } snowbridge-outbound-queue-runtime-api = { workspace = true } -snowbridge-outbound-queue-runtime-api-v2 = { workspace = true } +snowbridge-outbound-queue-v2-runtime-api = { workspace = true } snowbridge-pallet-ethereum-client = { workspace = true } snowbridge-pallet-inbound-queue = { workspace = true } snowbridge-pallet-inbound-queue-v2 = { workspace = true } @@ -203,7 +203,7 @@ std = [ "snowbridge-inbound-queue-primitives/std", "snowbridge-merkle-tree/std", "snowbridge-outbound-queue-primitives/std", - "snowbridge-outbound-queue-runtime-api-v2/std", + "snowbridge-outbound-queue-v2-runtime-api/std", "snowbridge-outbound-queue-runtime-api/std", "snowbridge-pallet-ethereum-client/std", "snowbridge-pallet-inbound-queue-v2/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs index e9e98be6ae072..b2604cc18509b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs @@ -22,22 +22,20 @@ //! GRANDPA tracking pallet only needs to be aware of one chain. use super::{weights, AccountId, Balance, Balances, BlockNumber, Runtime, RuntimeEvent}; +use crate::{ + bridge_to_ethereum_config::{AssetHubLocation, AssetHubXCMFee, InboundQueueLocation}, + xcm_config::XcmConfig, + RuntimeCall, XcmRouter, +}; use bp_messages::LegacyLaneId; use bp_relayers::RewardsAccountParams; use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen}; use frame_support::parameter_types; use scale_info::TypeInfo; -use xcm::VersionedLocation; use snowbridge_core::reward::NoOpReward; -use crate::bridge_to_ethereum_config::AssetHubXCMFee; -use crate::xcm_config::XcmConfig; -use xcm_executor::XcmExecutor; -use crate::RuntimeCall; -use crate::XcmRouter; -use crate::bridge_to_ethereum_config::InboundQueueLocation; use testnet_parachains_constants::westend::snowbridge::EthereumNetwork; -use crate::bridge_to_ethereum_config::AssetHubLocation; -use xcm::opaque::latest::Location; +use xcm::{opaque::latest::Location, VersionedLocation}; +use xcm_executor::XcmExecutor; parameter_types! { pub storage RequiredStakeForStakeAndSlash: Balance = 1_000_000; 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 f1de9f6b43282..278a6fb0a4342 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 @@ -14,12 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +#[cfg(feature = "runtime-benchmarks")] +use crate::XcmRouter; use crate::{ + bridge_common_config::BridgeReward, xcm_config, - xcm_config::{TreasuryAccount, UniversalLocation}, - Balances, EthereumInboundQueue, EthereumOutboundQueue, EthereumOutboundQueueV2, EthereumSystem, - EthereumSystemV2, MessageQueue, Runtime, RuntimeEvent, TransactionByteFee, + xcm_config::{RelayNetwork, TreasuryAccount, UniversalLocation, XcmConfig}, + Balances, BridgeRelayers, EthereumInboundQueue, EthereumOutboundQueue, EthereumOutboundQueueV2, + EthereumSystem, EthereumSystemV2, MessageQueue, Runtime, RuntimeEvent, TransactionByteFee, }; +#[cfg(feature = "runtime-benchmarks")] +use benchmark_helpers::DoNothingRouter; +use frame_support::{parameter_types, traits::Contains, weights::ConstantMultiplier}; +use frame_system::EnsureRootWithSuccess; +use pallet_xcm::EnsureXcm; use parachains_common::{AccountId, Balance}; use snowbridge_beacon_primitives::{Fork, ForkVersions}; use snowbridge_core::{gwei, meth, AllowSiblingsOnly, PricingParameters, Rewards}; @@ -27,8 +35,11 @@ use snowbridge_outbound_queue_primitives::{ v1::{ConstantGasMeter, EthereumBlobExporter}, v2::{ConstantGasMeter as ConstantGasMeterV2, EthereumBlobExporter as EthereumBlobExporterV2}, }; -use crate::BridgeRelayers; use sp_core::H160; +use sp_runtime::{ + traits::{ConstU32, ConstU8, Keccak256}, + FixedU128, +}; use testnet_parachains_constants::westend::{ currency::*, fee::WeightToFee, @@ -37,19 +48,7 @@ use testnet_parachains_constants::westend::{ INBOUND_QUEUE_PALLET_INDEX_V1, INBOUND_QUEUE_PALLET_INDEX_V2, }, }; -use crate::bridge_common_config::BridgeReward; - -use crate::xcm_config::{RelayNetwork, XcmConfig, XcmRouter}; -#[cfg(feature = "runtime-benchmarks")] -use benchmark_helpers::DoNothingRouter; -use frame_support::{parameter_types, traits::Contains, weights::ConstantMultiplier}; -use frame_system::EnsureRootWithSuccess; -use pallet_xcm::EnsureXcm; -use sp_runtime::{ - traits::{ConstU32, ConstU8, Keccak256}, - FixedU128, -}; -use xcm::prelude::{GlobalConsensus, InteriorLocation, Location, Parachain, PalletInstance}; +use xcm::prelude::{GlobalConsensus, InteriorLocation, Location, PalletInstance, Parachain}; use xcm_executor::XcmExecutor; pub const SLOTS_PER_EPOCH: u32 = snowbridge_pallet_ethereum_client::config::SLOTS_PER_EPOCH as u32; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 2fabe85b7a83b..90f736189838d 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -952,7 +952,7 @@ impl_runtime_apis! { } } - impl snowbridge_outbound_queue_runtime_api_v2::OutboundQueueV2Api for Runtime { + impl snowbridge_outbound_queue_v2_runtime_api::OutboundQueueV2Api for Runtime { fn prove_message(leaf_index: u64) -> Option { snowbridge_pallet_outbound_queue_v2::api::prove_message::(leaf_index) } diff --git a/prdoc/pr_6706.prdoc b/prdoc/pr_6706.prdoc index d04a2dceeea46..9fa470a509401 100644 --- a/prdoc/pr_6706.prdoc +++ b/prdoc/pr_6706.prdoc @@ -8,7 +8,7 @@ doc: crates: - name: snowbridge-pallet-outbound-queue-v2 bump: minor -- name: snowbridge-outbound-queue-runtime-api-v2 +- name: snowbridge-outbound-queue-v2-runtime-api bump: minor - name: snowbridge-core bump: major @@ -23,4 +23,4 @@ crates: - name: bridge-hub-westend-runtime bump: major - name: bridge-hub-rococo-runtime - bump: minor \ No newline at end of file + bump: minor diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 6ee9c88e4afa1..0d77f67745fde 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -176,7 +176,7 @@ std = [ "snowbridge-inbound-queue-primitives?/std", "snowbridge-merkle-tree?/std", "snowbridge-outbound-queue-primitives?/std", - "snowbridge-outbound-queue-runtime-api-v2?/std", + "snowbridge-outbound-queue-v2-runtime-api?/std", "snowbridge-outbound-queue-runtime-api?/std", "snowbridge-pallet-ethereum-client-fixtures?/std", "snowbridge-pallet-ethereum-client?/std", @@ -576,7 +576,7 @@ with-tracing = [ "sp-tracing?/with-tracing", "sp-tracing?/with-tracing", ] -runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-runtime-api-v2", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-runtime-api-v2", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] +runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-runtime-api-v2", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] runtime = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -1523,7 +1523,7 @@ default-features = false optional = true path = "../bridges/snowbridge/pallets/outbound-queue/runtime-api" -[dependencies.snowbridge-outbound-queue-runtime-api-v2] +[dependencies.snowbridge-outbound-queue-v2-runtime-api] default-features = false optional = true path = "../bridges/snowbridge/pallets/outbound-queue-v2/runtime-api" diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index 20afa709aa498..cb331b94f346a 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -1200,8 +1200,8 @@ pub use snowbridge_outbound_queue_primitives; pub use snowbridge_outbound_queue_runtime_api; /// Snowbridge Outbound Queue Runtime API V2. -#[cfg(feature = "snowbridge-outbound-queue-runtime-api-v2")] -pub use snowbridge_outbound_queue_runtime_api_v2; +#[cfg(feature = "snowbridge-outbound-queue-v2-runtime-api")] +pub use snowbridge_outbound_queue_v2_runtime_api; /// Snowbridge Ethereum Client Pallet. #[cfg(feature = "snowbridge-pallet-ethereum-client")] From f4ca5dbb6ac0982dafdcf8d5bc9d0ac5e658cba7 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 10:57:49 +0200 Subject: [PATCH 03/11] rename crate and other comments --- Cargo.lock | 6 +-- Cargo.toml | 2 +- .../pallets/outbound-queue-v2/src/lib.rs | 44 +++++++++---------- .../pallets/outbound-queue-v2/src/test.rs | 6 ++- .../pallets/system-frontend/src/lib.rs | 4 +- .../pallets/system-v2/runtime-api/Cargo.toml | 2 +- .../bridge-hubs/bridge-hub-westend/Cargo.toml | 4 +- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 2 +- umbrella/Cargo.toml | 6 +-- umbrella/src/lib.rs | 4 +- 10 files changed, 41 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de5383bca1421..a6ee569b7f01c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3012,7 +3012,7 @@ dependencies = [ "snowbridge-runtime-common 0.2.0", "snowbridge-runtime-test-common 0.2.0", "snowbridge-system-runtime-api 0.2.0", - "snowbridge-system-runtime-api-v2", + "snowbridge-system-v2-runtime-api", "sp-api 26.0.0", "sp-block-builder 26.0.0", "sp-consensus-aura 0.32.0", @@ -19286,7 +19286,7 @@ dependencies = [ "snowbridge-runtime-common 0.2.0", "snowbridge-runtime-test-common 0.2.0", "snowbridge-system-runtime-api 0.2.0", - "snowbridge-system-runtime-api-v2", + "snowbridge-system-v2-runtime-api", "snowbridge-verification-primitives", "sp-api 26.0.0", "sp-api-proc-macro 15.0.0", @@ -26085,7 +26085,7 @@ dependencies = [ ] [[package]] -name = "snowbridge-system-runtime-api-v2" +name = "snowbridge-system-v2-runtime-api" version = "0.2.0" dependencies = [ "parity-scale-codec", diff --git a/Cargo.toml b/Cargo.toml index 447900ffb46c7..2cdc0776069c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1275,7 +1275,7 @@ snowbridge-pallet-system-v2 = { path = "bridges/snowbridge/pallets/system-v2", d snowbridge-runtime-common = { path = "bridges/snowbridge/runtime/runtime-common", default-features = false } snowbridge-runtime-test-common = { path = "bridges/snowbridge/runtime/test-common", default-features = false } snowbridge-system-runtime-api = { path = "bridges/snowbridge/pallets/system/runtime-api", default-features = false } -snowbridge-system-runtime-api-v2 = { path = "bridges/snowbridge/pallets/system-v2/runtime-api", default-features = false } +snowbridge-system-v2-runtime-api = { path = "bridges/snowbridge/pallets/system-v2/runtime-api", default-features = false } snowbridge-test-utils = { path = "bridges/snowbridge/test-utils" } snowbridge-verification-primitives = { path = "bridges/snowbridge/primitives/verification", default-features = false } soketto = { version = "0.8.0" } diff --git a/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs index 91d135f76bcd9..d8ee4a22175f0 100644 --- a/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs @@ -20,9 +20,9 @@ //! [`frame_support::traits::ProcessMessage::process_message`] //! 5. The message is processed in `Pallet::do_process_message`: //! a. Convert to `OutboundMessage`, and stored into the `Messages` vector storage -//! b. ABI-encoded the OutboundMessage, with commited hash stored into the `MessageLeaves` storage -//! c. Generate `PendingOrder` with assigned nonce and fee attach, stored into the `PendingOrders` -//! map storage, with nonce as the key +//! b. ABI-encode the `OutboundMessage` and store the committed hash in `MessageLeaves` +//! c. Generate `PendingOrder` with assigned nonce and fee attached, stored into the +//! `PendingOrders` map storage, with nonce as the key //! d. Increment nonce and update the `Nonce` storage //! 6. At the end of the block, a merkle root is constructed from all the leaves in `MessageLeaves`, //! then `MessageLeaves` is dropped so that it is never committed to storage or included in PoV. @@ -31,8 +31,9 @@ //! a. Generating a merkle proof for the committed message using the `prove_message` runtime API //! b. Reading the actual message content from the `Messages` vector in storage //! 9. On the Ethereum side, the message root is ultimately the thing being verified by the Beefy -//! light client. When the message has been verified and executed, the relayer will call the -//! extrinsic `submit_delivery_proof` work the way as follows: +//! light client. +//! 10. When the message has been verified and executed, the relayer will call the +//! extrinsic `submit_delivery_receipt` work the way as follows: //! a. Verify the message with proof for a transaction receipt containing the event log, //! same as the inbound queue verification flow //! b. Fetch the pending order by nonce of the message, pay reward with fee attached in the order @@ -47,12 +48,11 @@ //! # Extrinsics //! //! * [`Call::set_operating_mode`]: Set the operating mode -//! * [`Call::submit_delivery_proof`]: Submit delivery proof +//! * [`Call::submit_delivery_receipt`]: Submit delivery proof //! //! # Runtime API //! //! * `prove_message`: Generate a merkle proof for a committed message -//! * `dry_run`: Convert xcm to InboundMessage #![cfg_attr(not(feature = "std"), no_std)] pub mod api; pub mod process_message_impl; @@ -222,7 +222,6 @@ pub mod pallet { /// `on_initialize`, so should never go into block PoV. #[pallet::storage] #[pallet::unbounded] - #[pallet::getter(fn message_leaves)] pub(super) type MessageLeaves = StorageValue<_, Vec, ValueQuery>; /// The current nonce for the messages @@ -317,24 +316,14 @@ pub mod pallet { // b. Convert to committed hash and save into MessageLeaves // c. Save nonce&fee into PendingOrders let message: Message = Message::decode(&mut message).map_err(|_| Corrupt)?; - let commands: Vec = message + let abi_commands: Vec = message .commands .clone() .into_iter() - .map(|command| OutboundCommandWrapper { + .map(|command| CommandWrapper { kind: command.index(), gas: T::GasMeter::maximum_dispatch_gas_used_at_most(&command), - payload: command.abi_encode(), - }) - .collect(); - - let abi_commands: Vec = commands - .clone() - .into_iter() - .map(|command| CommandWrapper { - kind: command.kind, - gas: command.gas, - payload: Bytes::from(command.payload), + payload: Bytes::from(command.abi_encode()), }) .collect(); let committed_message = OutboundMessageWrapper { @@ -349,7 +338,18 @@ pub mod pallet { let outbound_message = OutboundMessage { origin: message.origin, nonce, - commands: commands.try_into().map_err(|_| Corrupt)?, + commands: message + .commands + .clone() + .into_iter() + .map(|command| OutboundCommandWrapper { + kind: command.index(), + gas: T::GasMeter::maximum_dispatch_gas_used_at_most(&command), + payload: command.abi_encode(), + }) + .collect::>() + .try_into() + .map_err(|_| Corrupt)?, }; Messages::::append(Box::new(outbound_message)); diff --git a/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs b/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs index 1dcc5e0f23d83..07e5fed4f24fc 100644 --- a/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs +++ b/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs @@ -11,6 +11,7 @@ use frame_support::{ }; use codec::Encode; +use hex_literal::hex; use snowbridge_core::{ChannelId, ParaId}; use snowbridge_outbound_queue_primitives::{ v2::{abi::OutboundMessageWrapper, Command, Initializer, SendMessage}, @@ -140,8 +141,8 @@ fn process_message_fails_on_overweight_message() { } #[test] -fn governance_message_does_not_get_the_chance_to_processed_in_same_block_when_congest_of_low_priority_sibling_messages( -) { +fn governance_message_not_processed_in_same_block_when_queue_congested_with_low_priority_messages() +{ use AggregateMessageOrigin::*; let sibling_id: u32 = 1000; @@ -250,4 +251,5 @@ fn encode_mock_message() { }; let message_abi_encoded = committed_message.abi_encode(); println!("{}", HexDisplay::from(&message_abi_encoded)); + assert_eq!(hex!("000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000eda338e4dc46038493b885327842fd3e301cab3900000000000000000000000000000000000000000000000000000000000f4240").to_vec(), message_abi_encoded) } diff --git a/bridges/snowbridge/pallets/system-frontend/src/lib.rs b/bridges/snowbridge/pallets/system-frontend/src/lib.rs index f663019ecf2b5..821b4d0f5687d 100644 --- a/bridges/snowbridge/pallets/system-frontend/src/lib.rs +++ b/bridges/snowbridge/pallets/system-frontend/src/lib.rs @@ -3,7 +3,7 @@ //! //! System frontend pallet that acts as the user-facing controlplane for Snowbridge. //! -//! Some operations are delegated to a backend pallet installed a remote parachain. +//! Some operations are delegated to a backend pallet installed on a remote parachain. //! //! # Extrinsics //! @@ -120,7 +120,7 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// A XCM message was sent + /// An XCM was sent MessageSent { origin: Location, destination: Location, diff --git a/bridges/snowbridge/pallets/system-v2/runtime-api/Cargo.toml b/bridges/snowbridge/pallets/system-v2/runtime-api/Cargo.toml index aa44ac725b53c..31b4868f62fe4 100644 --- a/bridges/snowbridge/pallets/system-v2/runtime-api/Cargo.toml +++ b/bridges/snowbridge/pallets/system-v2/runtime-api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "snowbridge-system-runtime-api-v2" +name = "snowbridge-system-v2-runtime-api" description = "Snowbridge System Runtime API V2" version = "0.2.0" authors = ["Snowfork "] diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml index 531a8ab904dad..7ac9cead99363 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/Cargo.toml @@ -125,7 +125,7 @@ snowbridge-pallet-system = { workspace = true } snowbridge-pallet-system-v2 = { workspace = true } snowbridge-runtime-common = { workspace = true } snowbridge-system-runtime-api = { workspace = true } -snowbridge-system-runtime-api-v2 = { workspace = true } +snowbridge-system-v2-runtime-api = { workspace = true } [dev-dependencies] @@ -213,7 +213,7 @@ std = [ "snowbridge-pallet-system-v2/std", "snowbridge-pallet-system/std", "snowbridge-runtime-common/std", - "snowbridge-system-runtime-api-v2/std", + "snowbridge-system-v2-runtime-api/std", "snowbridge-system-runtime-api/std", "sp-api/std", "sp-block-builder/std", diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 90f736189838d..c786dd76ede72 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -964,7 +964,7 @@ impl_runtime_apis! { } } - impl snowbridge_system_runtime_api_v2::ControlV2Api for Runtime { + impl snowbridge_system_v2_runtime_api::ControlV2Api for Runtime { fn agent_id(location: VersionedLocation) -> Option { snowbridge_pallet_system_v2::api::agent_id::(location) } diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 0d77f67745fde..673b38a6922c3 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -191,7 +191,7 @@ std = [ "snowbridge-pallet-system?/std", "snowbridge-runtime-common?/std", "snowbridge-runtime-test-common?/std", - "snowbridge-system-runtime-api-v2?/std", + "snowbridge-system-v2-runtime-api?/std", "snowbridge-system-runtime-api?/std", "snowbridge-verification-primitives?/std", "sp-api-proc-macro?/std", @@ -576,7 +576,7 @@ with-tracing = [ "sp-tracing?/with-tracing", "sp-tracing?/with-tracing", ] -runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-runtime-api-v2", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] +runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-v2-runtime-api", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] runtime = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -1593,7 +1593,7 @@ default-features = false optional = true path = "../bridges/snowbridge/pallets/system/runtime-api" -[dependencies.snowbridge-system-runtime-api-v2] +[dependencies.snowbridge-system-v2-runtime-api] default-features = false optional = true path = "../bridges/snowbridge/pallets/system-v2/runtime-api" diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index cb331b94f346a..818c348df8721 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -1260,8 +1260,8 @@ pub use snowbridge_runtime_test_common; pub use snowbridge_system_runtime_api; /// Snowbridge System Runtime API V2. -#[cfg(feature = "snowbridge-system-runtime-api-v2")] -pub use snowbridge_system_runtime_api_v2; +#[cfg(feature = "snowbridge-system-v2-runtime-api")] +pub use snowbridge_system_v2_runtime_api; /// Snowbridge Verification Primitives. #[cfg(feature = "snowbridge-verification-primitives")] From 38d3d317b8d7d1ebd53ddbe18939e17aff3ee9c9 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 11:39:27 +0200 Subject: [PATCH 04/11] cleanup --- .../snowbridge/pallets/system-v2/README.md | 3 +++ .../pallets/system-v2/runtime-api/README.md | 2 +- .../pallets/system-v2/runtime-api/src/lib.rs | 1 + .../snowbridge/pallets/system-v2/src/lib.rs | 11 +++++++++-- .../snowbridge/pallets/system-v2/src/mock.rs | 7 +------ .../snowbridge/pallets/system-v2/src/tests.rs | 12 +----------- .../primitives/core/src/location.rs | 2 +- .../snowbridge/primitives/core/src/reward.rs | 3 +++ .../primitives/core/src/sparse_bitmap.rs | 3 ++- .../inbound-queue/src/v2/converter.rs | 12 +++++------- .../inbound-queue/src/v2/message.rs | 19 ++++++++++++++----- 11 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 bridges/snowbridge/pallets/system-v2/README.md diff --git a/bridges/snowbridge/pallets/system-v2/README.md b/bridges/snowbridge/pallets/system-v2/README.md new file mode 100644 index 0000000000000..f36632edc08f2 --- /dev/null +++ b/bridges/snowbridge/pallets/system-v2/README.md @@ -0,0 +1,3 @@ +# Ethereum System V2 + +This pallet is part of BridgeHub. Certain extrinsics in this pallet (like `register_token` and `add_tip`) will be called from the System Frontend pallet on AssetHub. diff --git a/bridges/snowbridge/pallets/system-v2/runtime-api/README.md b/bridges/snowbridge/pallets/system-v2/runtime-api/README.md index d7e81c9e78610..c989394af73dd 100644 --- a/bridges/snowbridge/pallets/system-v2/runtime-api/README.md +++ b/bridges/snowbridge/pallets/system-v2/runtime-api/README.md @@ -1,3 +1,3 @@ # Ethereum System Runtime API V2 -Provides an API for looking up an agent ID on Ethereum. +Provides an API for looking up an agent ID on Ethereum. An agent ID is a unique mapping to an Agent contract on Ethereum which acts as the sovereign account for the Location. diff --git a/bridges/snowbridge/pallets/system-v2/runtime-api/src/lib.rs b/bridges/snowbridge/pallets/system-v2/runtime-api/src/lib.rs index c8cb777fff57f..fe5a5e50b9df0 100644 --- a/bridges/snowbridge/pallets/system-v2/runtime-api/src/lib.rs +++ b/bridges/snowbridge/pallets/system-v2/runtime-api/src/lib.rs @@ -8,6 +8,7 @@ use xcm::VersionedLocation; sp_api::decl_runtime_apis! { pub trait ControlV2Api { + /// Provides the Agent ID on Ethereum for the specified location. fn agent_id(location: VersionedLocation) -> Option; } } diff --git a/bridges/snowbridge/pallets/system-v2/src/lib.rs b/bridges/snowbridge/pallets/system-v2/src/lib.rs index 87c903d730226..ea56ebd91d94d 100644 --- a/bridges/snowbridge/pallets/system-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/system-v2/src/lib.rs @@ -54,6 +54,8 @@ pub use pallet::*; pub type AccountIdOf = ::AccountId; +#[cfg(feature = "runtime-benchmarks")] +use frame_support::traits::OriginTrait; #[cfg(feature = "runtime-benchmarks")] pub trait BenchmarkHelper where @@ -105,11 +107,16 @@ pub mod pallet { #[pallet::error] pub enum Error { + /// Location could not be reachored LocationReanchorFailed, + /// A token location could not be converted to a token ID. LocationConversionFailed, + /// A `VersionedLocation` could not be converted into a `Location`. UnsupportedLocationVersion, - InvalidLocation, + /// An XCM could not be sent, due to a `SendError`. Send(SendError), + /// The gateway contract upgrade message could not be sent due to invalid upgrade + /// parameters. InvalidUpgradeParameters, } @@ -157,7 +164,7 @@ pub mod pallet { /// /// Fee required: No /// - /// - `origin`: Must be `Root` + /// - `origin`: Must be `GovernanceOrigin` #[pallet::call_index(4)] #[pallet::weight((::WeightInfo::set_operating_mode(), DispatchClass::Operational))] pub fn set_operating_mode(origin: OriginFor, mode: OperatingMode) -> DispatchResult { diff --git a/bridges/snowbridge/pallets/system-v2/src/mock.rs b/bridges/snowbridge/pallets/system-v2/src/mock.rs index 6e643ac5e0573..a1f5ac7cfcd57 100644 --- a/bridges/snowbridge/pallets/system-v2/src/mock.rs +++ b/bridges/snowbridge/pallets/system-v2/src/mock.rs @@ -97,12 +97,7 @@ pub struct AllowFromAssetHub; impl Contains for AllowFromAssetHub { fn contains(location: &Location) -> bool { match location.unpack() { - (1, [Parachain(para_id)]) => - if *para_id == 1000 { - true - } else { - false - }, + (1, [Parachain(para_id)]) => return *para_id == 1000, _ => false, } } diff --git a/bridges/snowbridge/pallets/system-v2/src/tests.rs b/bridges/snowbridge/pallets/system-v2/src/tests.rs index bf6335605225a..716338eb7696e 100644 --- a/bridges/snowbridge/pallets/system-v2/src/tests.rs +++ b/bridges/snowbridge/pallets/system-v2/src/tests.rs @@ -2,7 +2,6 @@ // SPDX-FileCopyrightText: 2023 Snowfork use crate::{mock::*, DispatchError::BadOrigin, *}; use frame_support::{assert_noop, assert_ok}; -use hex_literal::hex; use sp_keyring::sr25519::Keyring; use xcm::{latest::WESTEND_GENESIS_HASH, prelude::*}; @@ -159,16 +158,7 @@ fn register_all_tokens_succeeds() { fn register_ethereum_native_token_fails() { new_test_ext(true).execute_with(|| { let origin = make_xcm_origin(Location::new(1, [Parachain(1000)])); - let location = Location::new( - 2, - [ - GlobalConsensus(Ethereum { chain_id: 11155111 }), - AccountKey20 { - network: None, - key: hex!("87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d"), - }, - ], - ); + let location = Location::new(2, [GlobalConsensus(Ethereum { chain_id: 11155111 })]); let versioned_location: Box = Box::new(location.clone().into()); assert_noop!( EthereumSystemV2::register_token( diff --git a/bridges/snowbridge/primitives/core/src/location.rs b/bridges/snowbridge/primitives/core/src/location.rs index 38f59550fd73f..06dd1bf0accb2 100644 --- a/bridges/snowbridge/primitives/core/src/location.rs +++ b/bridges/snowbridge/primitives/core/src/location.rs @@ -21,7 +21,7 @@ use xcm_builder::{ pub type AgentId = H256; -/// Creates an AgentId from a Location. An AgentId is a unique mapping to a Agent contract on +/// Creates an AgentId from a Location. An AgentId is a unique mapping to an Agent contract on /// Ethereum which acts as the sovereign account for the Location. #[allow(deprecated)] pub type AgentIdOf = HashedDescription< diff --git a/bridges/snowbridge/primitives/core/src/reward.rs b/bridges/snowbridge/primitives/core/src/reward.rs index 9925635f32c53..944b4f59f6ce5 100644 --- a/bridges/snowbridge/primitives/core/src/reward.rs +++ b/bridges/snowbridge/primitives/core/src/reward.rs @@ -18,9 +18,12 @@ use xcm::{ prelude::{ExecuteXcm, Junction::*, Location, SendXcm, *}, }; +/// Error related to paying out relayer rewards. #[derive(Debug, Encode, Decode)] pub enum RewardPaymentError { + /// The XCM to mint the reward on AssetHub could not be sent. XcmSendFailure, + /// The delivery fee to send the XCM could not be charged. ChargeFeesFailure, } diff --git a/bridges/snowbridge/primitives/core/src/sparse_bitmap.rs b/bridges/snowbridge/primitives/core/src/sparse_bitmap.rs index 810c4747c382b..8016e66fdaf8b 100644 --- a/bridges/snowbridge/primitives/core/src/sparse_bitmap.rs +++ b/bridges/snowbridge/primitives/core/src/sparse_bitmap.rs @@ -3,7 +3,7 @@ use frame_support::storage::StorageMap; use sp_std::marker::PhantomData; -/// Sparse bitmap implementation. +/// Sparse bitmap interface. pub trait SparseBitmap where BitMap: StorageMap, @@ -12,6 +12,7 @@ where fn set(index: u128); } +/// Sparse bitmap implementation. pub struct SparseBitmapImpl(PhantomData); impl SparseBitmap for SparseBitmapImpl diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs index 421db46a6f094..5c5370f83d04e 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs @@ -14,7 +14,6 @@ use xcm::{ prelude::{Junction::*, *}, MAX_XCM_DECODE_DEPTH, }; - use super::{message::*, traits::*}; use crate::{CallIndex, EthereumLocationsConverterFor}; use sp_runtime::MultiAddress; @@ -166,11 +165,11 @@ where Ok(prepared_message) } - /// Construct the remote XCM needed to create a new asset in the `ForeignAssets` pallet - /// on AssetHub (Polkadot or Kusama). - fn make_create_asset_xcm( + /// Construct the remote XCM needed to create a new asset in the `ForeignAssets` pallet + /// on AssetHub (Polkadot or Kusama). + fn make_create_asset_xcm( token: &H160, - network: u8, + network: super::message::Network, eth_value: u128, ) -> Result, ConvertMessageError> { let chain_id = match EthereumNetwork::get() { @@ -196,14 +195,13 @@ where ); match network { - 0 => Ok(Self::make_create_asset_xcm_for_polkadot( + super::message::Network::Polkadot => Ok(Self::make_create_asset_xcm_for_polkadot( create_call_index, asset_id, bridge_owner, dot_fee, eth_asset, )), - _ => Err(ConvertMessageError::InvalidNetwork), } } diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 12cadfb96f8b6..d8898d126ce4f 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs @@ -85,7 +85,14 @@ pub enum XcmPayload { /// Represents raw XCM bytes Raw(Vec), /// A token registration template - CreateAsset { token: H160, network: u8 }, + CreateAsset { token: H160, network: Network }, +} + +/// Network enum for cross-chain message destination +#[derive(Clone, Copy, Debug, Eq, PartialEq, Encode, Decode, TypeInfo)] +pub enum Network { + /// Polkadot network + Polkadot, } /// The ethereum side sends messages which are transcoded into XCM on BH. These messages are @@ -177,10 +184,12 @@ impl TryFrom<&Log> for Message { 1 => { let create_asset = IGatewayV2::XcmCreateAsset::abi_decode(&payload.xcm.data, true) .map_err(|_| MessageDecodeError)?; - XcmPayload::CreateAsset { - token: H160::from(create_asset.token.as_ref()), - network: create_asset.network, - } + // Convert u8 network to Network enum + let network = match create_asset.network { + 0 => Network::Polkadot, + _ => return Err(MessageDecodeError), + }; + XcmPayload::CreateAsset { token: H160::from(create_asset.token.as_ref()), network } }, _ => return Err(MessageDecodeError), }; From 480cc552f50d5397a61f6b27739e33ccf2d57798 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 11:50:33 +0200 Subject: [PATCH 05/11] refactor --- .../inbound-queue/src/v2/converter.rs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs index 5c5370f83d04e..2badc705dd2b8 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs @@ -20,6 +20,9 @@ use sp_runtime::MultiAddress; const MINIMUM_DEPOSIT: u128 = 1; +/// Topic prefix used for generating unique identifiers for messages +const INBOUND_QUEUE_TOPIC_PREFIX: &str = "SnowbridgeInboundQueueV2"; + /// Representation of an intermediate parsed message, before final /// conversion to XCM. #[derive(Clone, RuntimeDebug)] @@ -151,7 +154,7 @@ where } } - let topic = blake2_256(&("SnowbridgeInboundQueueV2", message.nonce).encode()); + let topic = blake2_256(&(INBOUND_QUEUE_TOPIC_PREFIX, message.nonce).encode()); let prepared_message = PreparedMessage { origin: message.origin.clone(), @@ -297,7 +300,6 @@ where DescendOrigin(InboundQueueLocation::get()), UniversalOrigin(GlobalConsensus(network)), ReserveAssetDeposited(message.execution_fee.clone().into()), - PayFees { asset: message.execution_fee.clone() }, ]; // Make the origin account on AH the default claimer. This account can transact @@ -314,12 +316,16 @@ where let claimer = message.claimer.unwrap_or(default_claimer); + // Set claimer before PayFees, in case the fees are not enough. Then the claimer will be + // able to claim the funds still. instructions.push(SetHints { hints: vec![AssetClaimer { location: claimer.clone() }] .try_into() .expect("checked statically, qed"), }); + instructions.push(PayFees { asset: message.execution_fee.clone() }); + let mut reserve_deposit_assets = vec![]; let mut reserve_withdraw_assets = vec![]; @@ -436,7 +442,6 @@ mod tests { EthereumAsset::ForeignTokenERC20 { token_id: foreign_token_id, value: token_value }, ]; let instructions = vec![ - RefundSurplus, DepositAsset { assets: Wild(AllCounted(1).into()), beneficiary: beneficiary.clone() }, ]; let xcm: Xcm<()> = instructions.into(); @@ -560,8 +565,8 @@ mod tests { assert!(reserve_deposited_found == 2); // Expecting one WithdrawAsset for the foreign ERC-20 assert!(withdraw_assets_found == 1); - // One added by the user, one appended to the message in the converter. - assert!(refund_surplus_found == 2); + // Appended to the message in the converter. + assert!(refund_surplus_found == 1); // Deposit asset added by the converter and user assert!(deposit_asset_found == 2); } @@ -673,7 +678,6 @@ mod tests { let assets = vec![EthereumAsset::ForeignTokenERC20 { token_id, value: token_value }]; let instructions = vec![ DepositAsset { assets: Wild(AllCounted(1).into()), beneficiary }, - SetTopic(message_id.into()), ]; let xcm: Xcm<()> = instructions.into(); let versioned_xcm = VersionedXcm::V5(xcm); @@ -695,7 +699,7 @@ mod tests { relayer_fee, }; - let result = Converter::convert(message); + let result = Converter::convert(message.clone()); // Invalid claimer does not break the message conversion assert_ok!(result.clone()); @@ -742,6 +746,10 @@ mod tests { beneficiary: Location::new(0, [AccountKey20 { network: None, key: origin.into() }]) }) ); + assert_eq!( + last, + Some(SetTopic(blake2_256(&(INBOUND_QUEUE_TOPIC_PREFIX, message.nonce).encode()))) + ); } #[test] From b33ed0ca9aa98aebefb4fb593fd8fdab078b1ba5 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 14:02:22 +0200 Subject: [PATCH 06/11] removes snowbridge crates from the umbrella crate --- Cargo.lock | 506 +++++++++--------- Cargo.toml | 2 +- .../outbound-queue/src/v2/converter/mod.rs | 8 +- .../outbound-queue/src/v2/converter/tests.rs | 10 +- scripts/generate-umbrella.py | 6 +- umbrella/Cargo.toml | 177 +----- umbrella/src/lib.rs | 96 ---- 7 files changed, 261 insertions(+), 544 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6ee569b7f01c..764e2515ba4a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9824,7 +9824,7 @@ dependencies = [ "pallet-example-mbm", "pallet-example-tasks", "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "primitive-types 0.13.1", "scale-info", "serde_json", @@ -11066,7 +11066,7 @@ dependencies = [ "futures-timer", "jsonrpsee", "minimal-template-runtime", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "serde_json", ] @@ -11076,7 +11076,7 @@ version = "0.0.0" dependencies = [ "pallet-minimal-template", "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "scale-info", "serde_json", ] @@ -14351,7 +14351,7 @@ name = "pallet-minimal-template" version = "0.0.0" dependencies = [ "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "scale-info", ] @@ -16580,7 +16580,7 @@ dependencies = [ "log", "parachain-template-runtime", "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "sc-tracing", "serde", "serde_json", @@ -16597,7 +16597,7 @@ dependencies = [ "log", "pallet-parachain-template", "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "scale-info", "serde_json", "smallvec", @@ -18972,7 +18972,239 @@ dependencies = [ [[package]] name = "polkadot-sdk" -version = "0.0.0" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb819108697967452fa6d8d96ab4c0d48cbaa423b3156499dcb24f1cf95d6775" +dependencies = [ + "asset-test-utils 18.0.0", + "assets-common 0.18.0", + "binary-merkle-tree 15.0.1", + "bp-header-chain 0.18.1", + "bp-messages 0.18.0", + "bp-parachains 0.18.0", + "bp-polkadot 0.16.0", + "bp-polkadot-core 0.18.0", + "bp-relayers 0.18.0", + "bp-runtime 0.18.0", + "bp-test-utils 0.18.0", + "bp-xcm-bridge-hub 0.4.0", + "bp-xcm-bridge-hub-router 0.14.1", + "bridge-hub-common 0.10.0", + "bridge-hub-test-utils 0.18.0", + "bridge-runtime-common 0.18.0", + "cumulus-pallet-aura-ext 0.17.0", + "cumulus-pallet-dmp-queue 0.17.0", + "cumulus-pallet-parachain-system 0.17.1", + "cumulus-pallet-parachain-system-proc-macro 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cumulus-pallet-session-benchmarking 19.0.0", + "cumulus-pallet-solo-to-para 0.17.0", + "cumulus-pallet-xcm 0.17.0", + "cumulus-pallet-xcmp-queue 0.17.0", + "cumulus-ping 0.17.0", + "cumulus-primitives-aura 0.15.0", + "cumulus-primitives-core 0.16.0", + "cumulus-primitives-parachain-inherent 0.16.0", + "cumulus-primitives-proof-size-hostfunction 0.10.0", + "cumulus-primitives-storage-weight-reclaim 8.0.0", + "cumulus-primitives-timestamp 0.16.0", + "cumulus-primitives-utility 0.17.0", + "cumulus-test-relay-sproof-builder 0.16.0", + "frame-benchmarking 38.0.0", + "frame-benchmarking-pallet-pov 28.0.0", + "frame-election-provider-support 38.0.0", + "frame-executive 38.0.0", + "frame-metadata-hash-extension 0.6.0", + "frame-support 38.0.0", + "frame-support-procedural 30.0.4", + "frame-system 38.0.0", + "frame-system-benchmarking 38.0.0", + "frame-system-rpc-runtime-api 34.0.0", + "frame-try-runtime 0.44.0", + "pallet-alliance 37.0.0", + "pallet-asset-conversion 20.0.0", + "pallet-asset-conversion-ops 0.6.0", + "pallet-asset-conversion-tx-payment 20.0.0", + "pallet-asset-rate 17.0.0", + "pallet-asset-tx-payment 38.0.0", + "pallet-assets 40.0.0", + "pallet-assets-freezer 0.5.0", + "pallet-atomic-swap 38.0.0", + "pallet-aura 37.0.0", + "pallet-authority-discovery 38.0.0", + "pallet-authorship 38.0.0", + "pallet-babe 38.0.0", + "pallet-bags-list 37.0.0", + "pallet-balances 39.0.0", + "pallet-beefy 39.0.0", + "pallet-beefy-mmr 39.0.0", + "pallet-bounties 37.0.0", + "pallet-bridge-grandpa 0.18.0", + "pallet-bridge-messages 0.18.0", + "pallet-bridge-parachains 0.18.0", + "pallet-bridge-relayers 0.18.0", + "pallet-broker 0.17.0", + "pallet-child-bounties 37.0.0", + "pallet-collator-selection 19.0.0", + "pallet-collective 38.0.0", + "pallet-collective-content 0.16.0", + "pallet-contracts 38.0.0", + "pallet-contracts-mock-network 14.0.0", + "pallet-conviction-voting 38.0.0", + "pallet-core-fellowship 22.0.0", + "pallet-delegated-staking 5.0.0", + "pallet-democracy 38.0.0", + "pallet-dev-mode 20.0.0", + "pallet-election-provider-multi-phase 37.0.0", + "pallet-election-provider-support-benchmarking 37.0.0", + "pallet-elections-phragmen 39.0.0", + "pallet-fast-unstake 37.0.0", + "pallet-glutton 24.0.0", + "pallet-grandpa 38.0.0", + "pallet-identity 38.0.0", + "pallet-im-online 37.0.0", + "pallet-indices 38.0.0", + "pallet-insecure-randomness-collective-flip 26.0.0", + "pallet-lottery 38.0.0", + "pallet-membership 38.0.0", + "pallet-message-queue 41.0.1", + "pallet-migrations 8.0.0", + "pallet-mixnet 0.14.0", + "pallet-mmr 38.0.0", + "pallet-multisig 38.0.0", + "pallet-nft-fractionalization 21.0.0", + "pallet-nfts 32.0.0", + "pallet-nfts-runtime-api 24.0.0", + "pallet-nis 38.0.0", + "pallet-node-authorization 38.0.0", + "pallet-nomination-pools 35.0.0", + "pallet-nomination-pools-benchmarking 36.0.0", + "pallet-nomination-pools-runtime-api 33.0.0", + "pallet-offences 37.0.0", + "pallet-offences-benchmarking 38.0.0", + "pallet-paged-list 0.16.0", + "pallet-parameters 0.9.0", + "pallet-preimage 38.0.0", + "pallet-proxy 38.0.0", + "pallet-ranked-collective 38.0.0", + "pallet-recovery 38.0.0", + "pallet-referenda 38.0.0", + "pallet-remark 38.0.0", + "pallet-revive 0.2.0", + "pallet-revive-fixtures 0.2.0", + "pallet-revive-mock-network 0.2.0", + "pallet-root-offences 35.0.0", + "pallet-root-testing 14.0.0", + "pallet-safe-mode 19.0.0", + "pallet-salary 23.0.0", + "pallet-scheduler 39.0.0", + "pallet-scored-pool 38.0.0", + "pallet-session 38.0.0", + "pallet-session-benchmarking 38.0.0", + "pallet-skip-feeless-payment 13.0.0", + "pallet-society 38.0.0", + "pallet-staking 38.0.0", + "pallet-staking-reward-fn 22.0.0", + "pallet-staking-runtime-api 24.0.0", + "pallet-state-trie-migration 40.0.0", + "pallet-statement 20.0.0", + "pallet-sudo 38.0.0", + "pallet-timestamp 37.0.0", + "pallet-tips 37.0.0", + "pallet-transaction-payment 38.0.0", + "pallet-transaction-payment-rpc-runtime-api 38.0.0", + "pallet-transaction-storage 37.0.0", + "pallet-treasury 37.0.0", + "pallet-tx-pause 19.0.0", + "pallet-uniques 38.0.0", + "pallet-utility 38.0.0", + "pallet-vesting 38.0.0", + "pallet-whitelist 37.0.0", + "pallet-xcm 17.0.0", + "pallet-xcm-benchmarks 17.0.0", + "pallet-xcm-bridge-hub 0.13.0", + "pallet-xcm-bridge-hub-router 0.15.1", + "parachains-common 18.0.0", + "parachains-runtimes-test-utils 17.0.0", + "polkadot-core-primitives 15.0.0", + "polkadot-parachain-primitives 14.0.0", + "polkadot-primitives 16.0.0", + "polkadot-runtime-common 17.0.0", + "polkadot-runtime-metrics 17.0.0", + "polkadot-runtime-parachains 17.0.1", + "polkadot-sdk-frame 0.7.0", + "sc-executor 0.40.1", + "slot-range-helper 15.0.0", + "snowbridge-beacon-primitives 0.10.0", + "snowbridge-core 0.10.0", + "snowbridge-ethereum 0.9.0", + "snowbridge-outbound-queue-merkle-tree", + "snowbridge-outbound-queue-runtime-api 0.10.0", + "snowbridge-pallet-ethereum-client 0.10.0", + "snowbridge-pallet-ethereum-client-fixtures 0.18.0", + "snowbridge-pallet-inbound-queue 0.10.0", + "snowbridge-pallet-inbound-queue-fixtures 0.18.0", + "snowbridge-pallet-outbound-queue 0.10.0", + "snowbridge-pallet-system 0.10.0", + "snowbridge-router-primitives", + "snowbridge-runtime-common 0.10.0", + "snowbridge-runtime-test-common 0.10.0", + "snowbridge-system-runtime-api 0.10.0", + "sp-api 34.0.0", + "sp-api-proc-macro 20.0.0", + "sp-application-crypto 38.0.0", + "sp-arithmetic 26.0.0", + "sp-authority-discovery 34.0.0", + "sp-block-builder 34.0.0", + "sp-consensus-aura 0.40.0", + "sp-consensus-babe 0.40.0", + "sp-consensus-beefy 22.1.0", + "sp-consensus-grandpa 21.0.0", + "sp-consensus-pow 0.40.0", + "sp-consensus-slots 0.40.1", + "sp-core 34.0.0", + "sp-core-hashing 16.0.0", + "sp-crypto-ec-utils 0.14.0", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.29.0", + "sp-genesis-builder 0.15.1", + "sp-inherents 34.0.0", + "sp-io 38.0.0", + "sp-keyring 39.0.0", + "sp-keystore 0.40.0", + "sp-metadata-ir 0.7.0", + "sp-mixnet 0.12.0", + "sp-mmr-primitives 34.1.0", + "sp-npos-elections 34.0.0", + "sp-offchain 34.0.0", + "sp-runtime 39.0.2", + "sp-runtime-interface 28.0.0", + "sp-session 36.0.0", + "sp-staking 36.0.0", + "sp-state-machine 0.43.0", + "sp-statement-store 18.0.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 21.0.0", + "sp-timestamp 34.0.0", + "sp-tracing 17.0.1", + "sp-transaction-pool 34.0.0", + "sp-transaction-storage-proof 34.0.0", + "sp-trie 37.0.0", + "sp-version 37.0.0", + "sp-wasm-interface 21.0.1", + "sp-weights 31.0.0", + "staging-parachain-info 0.17.0", + "staging-xcm 14.2.0", + "staging-xcm-builder 17.0.1", + "staging-xcm-executor 17.0.0", + "substrate-bip39 0.6.0", + "testnet-parachains-constants 10.0.0", + "xcm-runtime-apis 0.4.0", +] + +[[package]] +name = "polkadot-sdk" +version = "1.14.0" dependencies = [ "asset-test-utils 7.0.0", "assets-common 0.7.0", @@ -19264,30 +19496,6 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "slot-range-helper 7.0.0", - "snowbridge-beacon-primitives 0.2.0", - "snowbridge-core 0.2.0", - "snowbridge-ethereum 0.3.0", - "snowbridge-inbound-queue-primitives", - "snowbridge-merkle-tree", - "snowbridge-outbound-queue-primitives", - "snowbridge-outbound-queue-runtime-api 0.2.0", - "snowbridge-outbound-queue-v2-runtime-api", - "snowbridge-pallet-ethereum-client 0.2.0", - "snowbridge-pallet-ethereum-client-fixtures 0.9.0", - "snowbridge-pallet-inbound-queue 0.2.0", - "snowbridge-pallet-inbound-queue-fixtures 0.10.0", - "snowbridge-pallet-inbound-queue-v2", - "snowbridge-pallet-inbound-queue-v2-fixtures", - "snowbridge-pallet-outbound-queue 0.2.0", - "snowbridge-pallet-outbound-queue-v2", - "snowbridge-pallet-system 0.2.0", - "snowbridge-pallet-system-frontend", - "snowbridge-pallet-system-v2", - "snowbridge-runtime-common 0.2.0", - "snowbridge-runtime-test-common 0.2.0", - "snowbridge-system-runtime-api 0.2.0", - "snowbridge-system-v2-runtime-api", - "snowbridge-verification-primitives", "sp-api 26.0.0", "sp-api-proc-macro 15.0.0", "sp-application-crypto 30.0.0", @@ -19367,238 +19575,6 @@ dependencies = [ "xcm-simulator 7.0.0", ] -[[package]] -name = "polkadot-sdk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb819108697967452fa6d8d96ab4c0d48cbaa423b3156499dcb24f1cf95d6775" -dependencies = [ - "asset-test-utils 18.0.0", - "assets-common 0.18.0", - "binary-merkle-tree 15.0.1", - "bp-header-chain 0.18.1", - "bp-messages 0.18.0", - "bp-parachains 0.18.0", - "bp-polkadot 0.16.0", - "bp-polkadot-core 0.18.0", - "bp-relayers 0.18.0", - "bp-runtime 0.18.0", - "bp-test-utils 0.18.0", - "bp-xcm-bridge-hub 0.4.0", - "bp-xcm-bridge-hub-router 0.14.1", - "bridge-hub-common 0.10.0", - "bridge-hub-test-utils 0.18.0", - "bridge-runtime-common 0.18.0", - "cumulus-pallet-aura-ext 0.17.0", - "cumulus-pallet-dmp-queue 0.17.0", - "cumulus-pallet-parachain-system 0.17.1", - "cumulus-pallet-parachain-system-proc-macro 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cumulus-pallet-session-benchmarking 19.0.0", - "cumulus-pallet-solo-to-para 0.17.0", - "cumulus-pallet-xcm 0.17.0", - "cumulus-pallet-xcmp-queue 0.17.0", - "cumulus-ping 0.17.0", - "cumulus-primitives-aura 0.15.0", - "cumulus-primitives-core 0.16.0", - "cumulus-primitives-parachain-inherent 0.16.0", - "cumulus-primitives-proof-size-hostfunction 0.10.0", - "cumulus-primitives-storage-weight-reclaim 8.0.0", - "cumulus-primitives-timestamp 0.16.0", - "cumulus-primitives-utility 0.17.0", - "cumulus-test-relay-sproof-builder 0.16.0", - "frame-benchmarking 38.0.0", - "frame-benchmarking-pallet-pov 28.0.0", - "frame-election-provider-support 38.0.0", - "frame-executive 38.0.0", - "frame-metadata-hash-extension 0.6.0", - "frame-support 38.0.0", - "frame-support-procedural 30.0.4", - "frame-system 38.0.0", - "frame-system-benchmarking 38.0.0", - "frame-system-rpc-runtime-api 34.0.0", - "frame-try-runtime 0.44.0", - "pallet-alliance 37.0.0", - "pallet-asset-conversion 20.0.0", - "pallet-asset-conversion-ops 0.6.0", - "pallet-asset-conversion-tx-payment 20.0.0", - "pallet-asset-rate 17.0.0", - "pallet-asset-tx-payment 38.0.0", - "pallet-assets 40.0.0", - "pallet-assets-freezer 0.5.0", - "pallet-atomic-swap 38.0.0", - "pallet-aura 37.0.0", - "pallet-authority-discovery 38.0.0", - "pallet-authorship 38.0.0", - "pallet-babe 38.0.0", - "pallet-bags-list 37.0.0", - "pallet-balances 39.0.0", - "pallet-beefy 39.0.0", - "pallet-beefy-mmr 39.0.0", - "pallet-bounties 37.0.0", - "pallet-bridge-grandpa 0.18.0", - "pallet-bridge-messages 0.18.0", - "pallet-bridge-parachains 0.18.0", - "pallet-bridge-relayers 0.18.0", - "pallet-broker 0.17.0", - "pallet-child-bounties 37.0.0", - "pallet-collator-selection 19.0.0", - "pallet-collective 38.0.0", - "pallet-collective-content 0.16.0", - "pallet-contracts 38.0.0", - "pallet-contracts-mock-network 14.0.0", - "pallet-conviction-voting 38.0.0", - "pallet-core-fellowship 22.0.0", - "pallet-delegated-staking 5.0.0", - "pallet-democracy 38.0.0", - "pallet-dev-mode 20.0.0", - "pallet-election-provider-multi-phase 37.0.0", - "pallet-election-provider-support-benchmarking 37.0.0", - "pallet-elections-phragmen 39.0.0", - "pallet-fast-unstake 37.0.0", - "pallet-glutton 24.0.0", - "pallet-grandpa 38.0.0", - "pallet-identity 38.0.0", - "pallet-im-online 37.0.0", - "pallet-indices 38.0.0", - "pallet-insecure-randomness-collective-flip 26.0.0", - "pallet-lottery 38.0.0", - "pallet-membership 38.0.0", - "pallet-message-queue 41.0.1", - "pallet-migrations 8.0.0", - "pallet-mixnet 0.14.0", - "pallet-mmr 38.0.0", - "pallet-multisig 38.0.0", - "pallet-nft-fractionalization 21.0.0", - "pallet-nfts 32.0.0", - "pallet-nfts-runtime-api 24.0.0", - "pallet-nis 38.0.0", - "pallet-node-authorization 38.0.0", - "pallet-nomination-pools 35.0.0", - "pallet-nomination-pools-benchmarking 36.0.0", - "pallet-nomination-pools-runtime-api 33.0.0", - "pallet-offences 37.0.0", - "pallet-offences-benchmarking 38.0.0", - "pallet-paged-list 0.16.0", - "pallet-parameters 0.9.0", - "pallet-preimage 38.0.0", - "pallet-proxy 38.0.0", - "pallet-ranked-collective 38.0.0", - "pallet-recovery 38.0.0", - "pallet-referenda 38.0.0", - "pallet-remark 38.0.0", - "pallet-revive 0.2.0", - "pallet-revive-fixtures 0.2.0", - "pallet-revive-mock-network 0.2.0", - "pallet-root-offences 35.0.0", - "pallet-root-testing 14.0.0", - "pallet-safe-mode 19.0.0", - "pallet-salary 23.0.0", - "pallet-scheduler 39.0.0", - "pallet-scored-pool 38.0.0", - "pallet-session 38.0.0", - "pallet-session-benchmarking 38.0.0", - "pallet-skip-feeless-payment 13.0.0", - "pallet-society 38.0.0", - "pallet-staking 38.0.0", - "pallet-staking-reward-fn 22.0.0", - "pallet-staking-runtime-api 24.0.0", - "pallet-state-trie-migration 40.0.0", - "pallet-statement 20.0.0", - "pallet-sudo 38.0.0", - "pallet-timestamp 37.0.0", - "pallet-tips 37.0.0", - "pallet-transaction-payment 38.0.0", - "pallet-transaction-payment-rpc-runtime-api 38.0.0", - "pallet-transaction-storage 37.0.0", - "pallet-treasury 37.0.0", - "pallet-tx-pause 19.0.0", - "pallet-uniques 38.0.0", - "pallet-utility 38.0.0", - "pallet-vesting 38.0.0", - "pallet-whitelist 37.0.0", - "pallet-xcm 17.0.0", - "pallet-xcm-benchmarks 17.0.0", - "pallet-xcm-bridge-hub 0.13.0", - "pallet-xcm-bridge-hub-router 0.15.1", - "parachains-common 18.0.0", - "parachains-runtimes-test-utils 17.0.0", - "polkadot-core-primitives 15.0.0", - "polkadot-parachain-primitives 14.0.0", - "polkadot-primitives 16.0.0", - "polkadot-runtime-common 17.0.0", - "polkadot-runtime-metrics 17.0.0", - "polkadot-runtime-parachains 17.0.1", - "polkadot-sdk-frame 0.7.0", - "sc-executor 0.40.1", - "slot-range-helper 15.0.0", - "snowbridge-beacon-primitives 0.10.0", - "snowbridge-core 0.10.0", - "snowbridge-ethereum 0.9.0", - "snowbridge-outbound-queue-merkle-tree", - "snowbridge-outbound-queue-runtime-api 0.10.0", - "snowbridge-pallet-ethereum-client 0.10.0", - "snowbridge-pallet-ethereum-client-fixtures 0.18.0", - "snowbridge-pallet-inbound-queue 0.10.0", - "snowbridge-pallet-inbound-queue-fixtures 0.18.0", - "snowbridge-pallet-outbound-queue 0.10.0", - "snowbridge-pallet-system 0.10.0", - "snowbridge-router-primitives", - "snowbridge-runtime-common 0.10.0", - "snowbridge-runtime-test-common 0.10.0", - "snowbridge-system-runtime-api 0.10.0", - "sp-api 34.0.0", - "sp-api-proc-macro 20.0.0", - "sp-application-crypto 38.0.0", - "sp-arithmetic 26.0.0", - "sp-authority-discovery 34.0.0", - "sp-block-builder 34.0.0", - "sp-consensus-aura 0.40.0", - "sp-consensus-babe 0.40.0", - "sp-consensus-beefy 22.1.0", - "sp-consensus-grandpa 21.0.0", - "sp-consensus-pow 0.40.0", - "sp-consensus-slots 0.40.1", - "sp-core 34.0.0", - "sp-core-hashing 16.0.0", - "sp-crypto-ec-utils 0.14.0", - "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-debug-derive 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-externalities 0.29.0", - "sp-genesis-builder 0.15.1", - "sp-inherents 34.0.0", - "sp-io 38.0.0", - "sp-keyring 39.0.0", - "sp-keystore 0.40.0", - "sp-metadata-ir 0.7.0", - "sp-mixnet 0.12.0", - "sp-mmr-primitives 34.1.0", - "sp-npos-elections 34.0.0", - "sp-offchain 34.0.0", - "sp-runtime 39.0.2", - "sp-runtime-interface 28.0.0", - "sp-session 36.0.0", - "sp-staking 36.0.0", - "sp-state-machine 0.43.0", - "sp-statement-store 18.0.0", - "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sp-storage 21.0.0", - "sp-timestamp 34.0.0", - "sp-tracing 17.0.1", - "sp-transaction-pool 34.0.0", - "sp-transaction-storage-proof 34.0.0", - "sp-trie 37.0.0", - "sp-version 37.0.0", - "sp-wasm-interface 21.0.1", - "sp-weights 31.0.0", - "staging-parachain-info 0.17.0", - "staging-xcm 14.2.0", - "staging-xcm-builder 17.0.1", - "staging-xcm-executor 17.0.0", - "substrate-bip39 0.6.0", - "testnet-parachains-constants 10.0.0", - "xcm-runtime-apis 0.4.0", -] - [[package]] name = "polkadot-sdk-docs" version = "0.0.1" @@ -19652,7 +19628,7 @@ dependencies = [ "parachain-template-runtime", "parity-scale-codec", "polkadot-omni-node-lib", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "polkadot-sdk-docs-first-pallet", "polkadot-sdk-docs-first-runtime", "polkadot-sdk-frame 0.1.0", @@ -28909,7 +28885,7 @@ dependencies = [ "node-rpc", "node-testing", "parity-scale-codec", - "polkadot-sdk 0.0.0", + "polkadot-sdk 1.14.0", "pretty_assertions", "rand 0.8.5", "regex", diff --git a/Cargo.toml b/Cargo.toml index 2cdc0776069c2..7851b5427d6dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1265,8 +1265,8 @@ snowbridge-pallet-ethereum-client = { path = "bridges/snowbridge/pallets/ethereu snowbridge-pallet-ethereum-client-fixtures = { path = "bridges/snowbridge/pallets/ethereum-client/fixtures", 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", default-features = false } -snowbridge-pallet-inbound-queue-v2-fixtures = { path = "bridges/snowbridge/pallets/inbound-queue-v2/fixtures", default-features = false } snowbridge-pallet-inbound-queue-v2 = { path = "bridges/snowbridge/pallets/inbound-queue-v2", default-features = false } +snowbridge-pallet-inbound-queue-v2-fixtures = { path = "bridges/snowbridge/pallets/inbound-queue-v2/fixtures", default-features = false } snowbridge-pallet-outbound-queue = { path = "bridges/snowbridge/pallets/outbound-queue", default-features = false } snowbridge-pallet-outbound-queue-v2 = { path = "bridges/snowbridge/pallets/outbound-queue-v2", default-features = false } snowbridge-pallet-system = { path = "bridges/snowbridge/pallets/system", default-features = false } diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/mod.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/mod.rs index 26dbd326a86bb..c70839be7e456 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/mod.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/mod.rs @@ -24,6 +24,8 @@ use xcm_executor::traits::{ConvertLocation, ExportXcm}; pub const TARGET: &'static str = "xcm::ethereum_blob_exporter::v2"; +/// Used to process ExportMessages where the destination is Ethereum. It takes an ExportMessage +/// and converts it into a simpler message that the Ethereum gateway contract can understand. pub struct EthereumBlobExporter< UniversalLocation, EthereumNetwork, @@ -127,7 +129,11 @@ where SendError::MissingArgument })?; - // Inspect AliasOrigin as V2 message + // Inspect `AliasOrigin` as V2 message. This exporter should only process Snowbridge V2 + // messages. We use the presence of an `AliasOrigin` instruction to distinguish between + // Snowbridge V2 and Snowbridge V1 messages, since XCM V5 came after Snowbridge V1 and + // so is not supported in Snowbridge V1. Snowbridge V1 messages are processed by the + // snowbridge-outbound-queue-primitives v1 exporter. let mut instructions = message.clone().0; let result = instructions.matcher().match_next_inst_while( |_| true, diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs index 0298128c6db70..763fd91ae04fa 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs @@ -160,8 +160,8 @@ fn exporter_validate_without_universal_source_yields_missing_argument() { fn exporter_validate_without_global_universal_location_yields_not_applicable() { let network = BridgedNetwork::get(); let channel: u32 = 0; - let mut universal_source: Option = Here.into(); - let mut destination: Option = Here.into(); + let mut universal_source: Option = Some([GlobalConsensus(NetworkId::Polkadot)].into()); + let mut destination: Option = Some([GlobalConsensus(NetworkId::Ethereum { chain_id: 11155111 })].into()); let mut message: Option> = None; let result = @@ -330,7 +330,7 @@ fn exporter_validate_with_max_target_fee_yields_unroutable() { } #[test] -fn exporter_validate_with_unparsable_xcm_yields_unroutable() { +fn exporter_validate_with_unparsable_xcm_yields_not_applicable() { let network = BridgedNetwork::get(); let mut destination: Option = Here.into(); @@ -623,7 +623,7 @@ fn xcm_converter_convert_without_set_topic_yields_set_topic_expected() { } #[test] -fn xcm_converter_convert_with_partial_message_yields_invalid_fee_asset() { +fn xcm_converter_convert_with_partial_message_yields_unexpected_end_of_xcm() { let network = BridgedNetwork::get(); let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000"); @@ -677,7 +677,7 @@ fn xcm_converter_with_fees_greater_than_reserve_fails() { let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000"); let asset_location: Location = [AccountKey20 { network: None, key: token_address }].into(); - let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(2000) }.into(); // Fee is greater than asset amount + let fee_asset: Asset = Asset { id: AssetId([GlobalConsensus(NetworkId::Polkadot)].into()), fun: Fungible(2000) }.into(); // Fee is greater than asset amount let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into(); diff --git a/scripts/generate-umbrella.py b/scripts/generate-umbrella.py index 388573707822f..06616850503e2 100644 --- a/scripts/generate-umbrella.py +++ b/scripts/generate-umbrella.py @@ -36,6 +36,10 @@ def exclude(crate): # Note: this is a bit hacky. We should use custom crate metadata instead. return name != "sp-runtime" and name != "bp-runtime" and name != "frame-try-runtime" + # Exclude snowbridge crates. + if name.startswith("snowbridge-"): + return True + return False def main(path, version): @@ -77,7 +81,7 @@ def main(path, version): with open(lib_path, "r") as f: nostd_crate = False for line in f: - line = line.strip() + line = line.strip() if line == "#![no_std]" or line == '#![cfg_attr(not(feature = "std"), no_std)]': nostd_crate = True break diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 673b38a6922c3..46441f285fecc 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -170,30 +170,6 @@ std = [ "polkadot-sdk-frame?/std", "sc-executor?/std", "slot-range-helper?/std", - "snowbridge-beacon-primitives?/std", - "snowbridge-core?/std", - "snowbridge-ethereum?/std", - "snowbridge-inbound-queue-primitives?/std", - "snowbridge-merkle-tree?/std", - "snowbridge-outbound-queue-primitives?/std", - "snowbridge-outbound-queue-v2-runtime-api?/std", - "snowbridge-outbound-queue-runtime-api?/std", - "snowbridge-pallet-ethereum-client-fixtures?/std", - "snowbridge-pallet-ethereum-client?/std", - "snowbridge-pallet-inbound-queue-v2-fixtures?/std", - "snowbridge-pallet-inbound-queue-fixtures?/std", - "snowbridge-pallet-inbound-queue-v2?/std", - "snowbridge-pallet-inbound-queue?/std", - "snowbridge-pallet-outbound-queue-v2?/std", - "snowbridge-pallet-outbound-queue?/std", - "snowbridge-pallet-system-frontend?/std", - "snowbridge-pallet-system-v2?/std", - "snowbridge-pallet-system?/std", - "snowbridge-runtime-common?/std", - "snowbridge-runtime-test-common?/std", - "snowbridge-system-v2-runtime-api?/std", - "snowbridge-system-runtime-api?/std", - "snowbridge-verification-primitives?/std", "sp-api-proc-macro?/std", "sp-api?/std", "sp-application-crypto?/std", @@ -366,21 +342,6 @@ runtime-benchmarks = [ "polkadot-service?/runtime-benchmarks", "sc-client-db?/runtime-benchmarks", "sc-service?/runtime-benchmarks", - "snowbridge-core?/runtime-benchmarks", - "snowbridge-inbound-queue-primitives?/runtime-benchmarks", - "snowbridge-pallet-ethereum-client-fixtures?/runtime-benchmarks", - "snowbridge-pallet-ethereum-client?/runtime-benchmarks", - "snowbridge-pallet-inbound-queue-v2-fixtures?/runtime-benchmarks", - "snowbridge-pallet-inbound-queue-fixtures?/runtime-benchmarks", - "snowbridge-pallet-inbound-queue-v2?/runtime-benchmarks", - "snowbridge-pallet-inbound-queue?/runtime-benchmarks", - "snowbridge-pallet-outbound-queue-v2?/runtime-benchmarks", - "snowbridge-pallet-outbound-queue?/runtime-benchmarks", - "snowbridge-pallet-system-frontend?/runtime-benchmarks", - "snowbridge-pallet-system-v2?/runtime-benchmarks", - "snowbridge-pallet-system?/runtime-benchmarks", - "snowbridge-runtime-common?/runtime-benchmarks", - "snowbridge-runtime-test-common?/runtime-benchmarks", "sp-runtime?/runtime-benchmarks", "sp-staking?/runtime-benchmarks", "staging-node-inspect?/runtime-benchmarks", @@ -507,14 +468,6 @@ try-runtime = [ "polkadot-runtime-parachains?/try-runtime", "polkadot-sdk-frame?/try-runtime", "polkadot-service?/try-runtime", - "snowbridge-pallet-ethereum-client?/try-runtime", - "snowbridge-pallet-inbound-queue-v2?/try-runtime", - "snowbridge-pallet-inbound-queue?/try-runtime", - "snowbridge-pallet-outbound-queue-v2?/try-runtime", - "snowbridge-pallet-outbound-queue?/try-runtime", - "snowbridge-pallet-system-frontend?/try-runtime", - "snowbridge-pallet-system-v2?/try-runtime", - "snowbridge-pallet-system?/try-runtime", "sp-runtime?/try-runtime", "staging-parachain-info?/try-runtime", ] @@ -538,12 +491,6 @@ serde = [ "pallet-transaction-storage?/serde", "pallet-treasury?/serde", "pallet-xcm?/serde", - "snowbridge-beacon-primitives?/serde", - "snowbridge-core?/serde", - "snowbridge-ethereum?/serde", - "snowbridge-pallet-ethereum-client?/serde", - "snowbridge-pallet-inbound-queue-v2?/serde", - "snowbridge-pallet-inbound-queue?/serde", "sp-application-crypto?/serde", "sp-arithmetic?/serde", "sp-authority-discovery?/serde", @@ -576,7 +523,7 @@ with-tracing = [ "sp-tracing?/with-tracing", "sp-tracing?/with-tracing", ] -runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "snowbridge-beacon-primitives", "snowbridge-core", "snowbridge-ethereum", "snowbridge-inbound-queue-primitives", "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-ethereum-client-fixtures", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-fixtures", "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-pallet-inbound-queue-v2", "snowbridge-pallet-outbound-queue", "snowbridge-pallet-outbound-queue-v2", "snowbridge-pallet-system", "snowbridge-pallet-system-frontend", "snowbridge-pallet-system-v2", "snowbridge-runtime-common", "snowbridge-system-runtime-api", "snowbridge-system-v2-runtime-api", "snowbridge-verification-primitives", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] +runtime-full = ["assets-common", "binary-merkle-tree", "bp-header-chain", "bp-messages", "bp-parachains", "bp-polkadot", "bp-polkadot-core", "bp-relayers", "bp-runtime", "bp-test-utils", "bp-xcm-bridge-hub", "bp-xcm-bridge-hub-router", "bridge-hub-common", "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-parachain-system-proc-macro", "cumulus-pallet-session-benchmarking", "cumulus-pallet-solo-to-para", "cumulus-pallet-weight-reclaim", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", "cumulus-ping", "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "cumulus-primitives-storage-weight-reclaim", "cumulus-primitives-timestamp", "cumulus-primitives-utility", "frame-benchmarking", "frame-benchmarking-pallet-pov", "frame-election-provider-solution-type", "frame-election-provider-support", "frame-executive", "frame-metadata-hash-extension", "frame-support", "frame-support-procedural", "frame-support-procedural-tools-derive", "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "pallet-alliance", "pallet-asset-conversion", "pallet-asset-conversion-ops", "pallet-asset-conversion-tx-payment", "pallet-asset-rate", "pallet-asset-rewards", "pallet-asset-tx-payment", "pallet-assets", "pallet-assets-freezer", "pallet-assets-holder", "pallet-atomic-swap", "pallet-aura", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-bags-list", "pallet-balances", "pallet-beefy", "pallet-beefy-mmr", "pallet-bounties", "pallet-bridge-grandpa", "pallet-bridge-messages", "pallet-bridge-parachains", "pallet-bridge-relayers", "pallet-broker", "pallet-child-bounties", "pallet-collator-selection", "pallet-collective", "pallet-collective-content", "pallet-contracts", "pallet-contracts-proc-macro", "pallet-contracts-uapi", "pallet-conviction-voting", "pallet-core-fellowship", "pallet-delegated-staking", "pallet-democracy", "pallet-dev-mode", "pallet-election-provider-multi-block", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", "pallet-fast-unstake", "pallet-glutton", "pallet-grandpa", "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-insecure-randomness-collective-flip", "pallet-lottery", "pallet-membership", "pallet-message-queue", "pallet-migrations", "pallet-mixnet", "pallet-mmr", "pallet-multisig", "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-nis", "pallet-node-authorization", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", "pallet-paged-list", "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-recovery", "pallet-referenda", "pallet-remark", "pallet-revive", "pallet-revive-proc-macro", "pallet-revive-uapi", "pallet-root-offences", "pallet-root-testing", "pallet-safe-mode", "pallet-salary", "pallet-scheduler", "pallet-scored-pool", "pallet-session", "pallet-session-benchmarking", "pallet-skip-feeless-payment", "pallet-society", "pallet-staking", "pallet-staking-ah-client", "pallet-staking-rc-client", "pallet-staking-reward-curve", "pallet-staking-reward-fn", "pallet-staking-runtime-api", "pallet-state-trie-migration", "pallet-statement", "pallet-sudo", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-storage", "pallet-treasury", "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-verify-signature", "pallet-vesting", "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "pallet-xcm-bridge-hub", "pallet-xcm-bridge-hub-router", "parachains-common", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-common", "polkadot-runtime-metrics", "polkadot-runtime-parachains", "polkadot-sdk-frame", "sc-chain-spec-derive", "sc-tracing-proc-macro", "slot-range-helper", "sp-api", "sp-api-proc-macro", "sp-application-crypto", "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", "sp-consensus-pow", "sp-consensus-slots", "sp-core", "sp-crypto-ec-utils", "sp-crypto-hashing", "sp-crypto-hashing-proc-macro", "sp-debug-derive", "sp-externalities", "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", "sp-keystore", "sp-metadata-ir", "sp-mixnet", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", "sp-runtime", "sp-runtime-interface", "sp-runtime-interface-proc-macro", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", "sp-std", "sp-storage", "sp-timestamp", "sp-tracing", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", "sp-version-proc-macro", "sp-wasm-interface", "sp-weights", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", "substrate-bip39", "testnet-parachains-constants", "tracing-gum-proc-macro", "xcm-procedural", "xcm-runtime-apis"] runtime = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -640,7 +587,7 @@ runtime = [ "sp-wasm-interface", "sp-weights", ] -node = ["asset-test-utils", "bridge-hub-test-utils", "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-aura", "cumulus-client-consensus-common", "cumulus-client-consensus-proposer", "cumulus-client-consensus-relay-chain", "cumulus-client-network", "cumulus-client-parachain-inherent", "cumulus-client-pov-recovery", "cumulus-client-service", "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", "cumulus-relay-chain-rpc-interface", "cumulus-test-relay-sproof-builder", "emulated-integration-tests-common", "fork-tree", "frame-benchmarking-cli", "frame-remote-externalities", "frame-support-procedural-tools", "generate-bags", "mmr-gadget", "mmr-rpc", "pallet-contracts-mock-network", "pallet-revive-eth-rpc", "pallet-revive-mock-network", "pallet-transaction-payment-rpc", "parachains-runtimes-test-utils", "polkadot-approval-distribution", "polkadot-availability-bitfield-distribution", "polkadot-availability-distribution", "polkadot-availability-recovery", "polkadot-cli", "polkadot-collator-protocol", "polkadot-dispute-distribution", "polkadot-erasure-coding", "polkadot-gossip-support", "polkadot-network-bridge", "polkadot-node-collation-generation", "polkadot-node-core-approval-voting", "polkadot-node-core-approval-voting-parallel", "polkadot-node-core-av-store", "polkadot-node-core-backing", "polkadot-node-core-bitfield-signing", "polkadot-node-core-candidate-validation", "polkadot-node-core-chain-api", "polkadot-node-core-chain-selection", "polkadot-node-core-dispute-coordinator", "polkadot-node-core-parachains-inherent", "polkadot-node-core-prospective-parachains", "polkadot-node-core-provisioner", "polkadot-node-core-pvf", "polkadot-node-core-pvf-checker", "polkadot-node-core-pvf-common", "polkadot-node-core-pvf-execute-worker", "polkadot-node-core-pvf-prepare-worker", "polkadot-node-core-runtime-api", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", "polkadot-omni-node-lib", "polkadot-overseer", "polkadot-rpc", "polkadot-service", "polkadot-statement-distribution", "polkadot-statement-table", "sc-allocator", "sc-authority-discovery", "sc-basic-authorship", "sc-block-builder", "sc-chain-spec", "sc-cli", "sc-client-api", "sc-client-db", "sc-consensus", "sc-consensus-aura", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-beefy", "sc-consensus-beefy-rpc", "sc-consensus-epochs", "sc-consensus-grandpa", "sc-consensus-grandpa-rpc", "sc-consensus-manual-seal", "sc-consensus-pow", "sc-consensus-slots", "sc-executor", "sc-executor-common", "sc-executor-polkavm", "sc-executor-wasmtime", "sc-informant", "sc-keystore", "sc-mixnet", "sc-network", "sc-network-common", "sc-network-gossip", "sc-network-light", "sc-network-statement", "sc-network-sync", "sc-network-transactions", "sc-network-types", "sc-offchain", "sc-proposer-metrics", "sc-rpc", "sc-rpc-api", "sc-rpc-server", "sc-rpc-spec-v2", "sc-runtime-utilities", "sc-service", "sc-state-db", "sc-statement-store", "sc-storage-monitor", "sc-sync-state-rpc", "sc-sysinfo", "sc-telemetry", "sc-tracing", "sc-transaction-pool", "sc-transaction-pool-api", "sc-utils", "snowbridge-runtime-test-common", "sp-blockchain", "sp-consensus", "sp-core-hashing", "sp-core-hashing-proc-macro", "sp-database", "sp-maybe-compressed-blob", "sp-panic-handler", "sp-rpc", "staging-chain-spec-builder", "staging-node-inspect", "staging-tracking-allocator", "std", "subkey", "substrate-build-script-utils", "substrate-frame-rpc-support", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "substrate-rpc-client", "substrate-state-trie-migration-rpc", "substrate-wasm-builder", "tracing-gum", "xcm-emulator", "xcm-simulator"] +node = ["asset-test-utils", "bridge-hub-test-utils", "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-aura", "cumulus-client-consensus-common", "cumulus-client-consensus-proposer", "cumulus-client-consensus-relay-chain", "cumulus-client-network", "cumulus-client-parachain-inherent", "cumulus-client-pov-recovery", "cumulus-client-service", "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", "cumulus-relay-chain-rpc-interface", "cumulus-test-relay-sproof-builder", "emulated-integration-tests-common", "fork-tree", "frame-benchmarking-cli", "frame-remote-externalities", "frame-support-procedural-tools", "generate-bags", "mmr-gadget", "mmr-rpc", "pallet-contracts-mock-network", "pallet-revive-eth-rpc", "pallet-revive-mock-network", "pallet-transaction-payment-rpc", "parachains-runtimes-test-utils", "polkadot-approval-distribution", "polkadot-availability-bitfield-distribution", "polkadot-availability-distribution", "polkadot-availability-recovery", "polkadot-cli", "polkadot-collator-protocol", "polkadot-dispute-distribution", "polkadot-erasure-coding", "polkadot-gossip-support", "polkadot-network-bridge", "polkadot-node-collation-generation", "polkadot-node-core-approval-voting", "polkadot-node-core-approval-voting-parallel", "polkadot-node-core-av-store", "polkadot-node-core-backing", "polkadot-node-core-bitfield-signing", "polkadot-node-core-candidate-validation", "polkadot-node-core-chain-api", "polkadot-node-core-chain-selection", "polkadot-node-core-dispute-coordinator", "polkadot-node-core-parachains-inherent", "polkadot-node-core-prospective-parachains", "polkadot-node-core-provisioner", "polkadot-node-core-pvf", "polkadot-node-core-pvf-checker", "polkadot-node-core-pvf-common", "polkadot-node-core-pvf-execute-worker", "polkadot-node-core-pvf-prepare-worker", "polkadot-node-core-runtime-api", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", "polkadot-omni-node-lib", "polkadot-overseer", "polkadot-rpc", "polkadot-service", "polkadot-statement-distribution", "polkadot-statement-table", "sc-allocator", "sc-authority-discovery", "sc-basic-authorship", "sc-block-builder", "sc-chain-spec", "sc-cli", "sc-client-api", "sc-client-db", "sc-consensus", "sc-consensus-aura", "sc-consensus-babe", "sc-consensus-babe-rpc", "sc-consensus-beefy", "sc-consensus-beefy-rpc", "sc-consensus-epochs", "sc-consensus-grandpa", "sc-consensus-grandpa-rpc", "sc-consensus-manual-seal", "sc-consensus-pow", "sc-consensus-slots", "sc-executor", "sc-executor-common", "sc-executor-polkavm", "sc-executor-wasmtime", "sc-informant", "sc-keystore", "sc-mixnet", "sc-network", "sc-network-common", "sc-network-gossip", "sc-network-light", "sc-network-statement", "sc-network-sync", "sc-network-transactions", "sc-network-types", "sc-offchain", "sc-proposer-metrics", "sc-rpc", "sc-rpc-api", "sc-rpc-server", "sc-rpc-spec-v2", "sc-runtime-utilities", "sc-service", "sc-state-db", "sc-statement-store", "sc-storage-monitor", "sc-sync-state-rpc", "sc-sysinfo", "sc-telemetry", "sc-tracing", "sc-transaction-pool", "sc-transaction-pool-api", "sc-utils", "sp-blockchain", "sp-consensus", "sp-core-hashing", "sp-core-hashing-proc-macro", "sp-database", "sp-maybe-compressed-blob", "sp-panic-handler", "sp-rpc", "staging-chain-spec-builder", "staging-node-inspect", "staging-tracking-allocator", "std", "subkey", "substrate-build-script-utils", "substrate-frame-rpc-support", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "substrate-rpc-client", "substrate-state-trie-migration-rpc", "substrate-wasm-builder", "tracing-gum", "xcm-emulator", "xcm-simulator"] tuples-96 = [ "frame-support-procedural?/tuples-96", "frame-support?/tuples-96", @@ -1488,121 +1435,6 @@ default-features = false optional = true path = "../polkadot/runtime/common/slot_range_helper" -[dependencies.snowbridge-beacon-primitives] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/beacon" - -[dependencies.snowbridge-core] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/core" - -[dependencies.snowbridge-ethereum] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/ethereum" - -[dependencies.snowbridge-inbound-queue-primitives] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/inbound-queue" - -[dependencies.snowbridge-merkle-tree] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/merkle-tree" - -[dependencies.snowbridge-outbound-queue-primitives] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/outbound-queue" - -[dependencies.snowbridge-outbound-queue-runtime-api] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/outbound-queue/runtime-api" - -[dependencies.snowbridge-outbound-queue-v2-runtime-api] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/outbound-queue-v2/runtime-api" - -[dependencies.snowbridge-pallet-ethereum-client] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/ethereum-client" - -[dependencies.snowbridge-pallet-ethereum-client-fixtures] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/ethereum-client/fixtures" - -[dependencies.snowbridge-pallet-inbound-queue] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/inbound-queue" - -[dependencies.snowbridge-pallet-inbound-queue-fixtures] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/inbound-queue/fixtures" - -[dependencies.snowbridge-pallet-inbound-queue-v2-fixtures] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/inbound-queue-v2/fixtures" - -[dependencies.snowbridge-pallet-inbound-queue-v2] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/inbound-queue-v2" - -[dependencies.snowbridge-pallet-outbound-queue] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/outbound-queue" - -[dependencies.snowbridge-pallet-outbound-queue-v2] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/outbound-queue-v2" - -[dependencies.snowbridge-pallet-system] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/system" - -[dependencies.snowbridge-pallet-system-frontend] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/system-frontend" - -[dependencies.snowbridge-pallet-system-v2] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/system-v2" - -[dependencies.snowbridge-runtime-common] -default-features = false -optional = true -path = "../bridges/snowbridge/runtime/runtime-common" - -[dependencies.snowbridge-system-runtime-api] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/system/runtime-api" - -[dependencies.snowbridge-system-v2-runtime-api] -default-features = false -optional = true -path = "../bridges/snowbridge/pallets/system-v2/runtime-api" - -[dependencies.snowbridge-verification-primitives] -default-features = false -optional = true -path = "../bridges/snowbridge/primitives/verification" - [dependencies.sp-api] default-features = false optional = true @@ -2498,11 +2330,6 @@ default-features = false optional = true path = "../substrate/client/utils" -[dependencies.snowbridge-runtime-test-common] -default-features = false -optional = true -path = "../bridges/snowbridge/runtime/test-common" - [dependencies.sp-blockchain] default-features = false optional = true diff --git a/umbrella/src/lib.rs b/umbrella/src/lib.rs index 818c348df8721..c63d4c384d1cd 100644 --- a/umbrella/src/lib.rs +++ b/umbrella/src/lib.rs @@ -1171,102 +1171,6 @@ pub use sc_utils; #[cfg(feature = "slot-range-helper")] pub use slot_range_helper; -/// Snowbridge Beacon Primitives. -#[cfg(feature = "snowbridge-beacon-primitives")] -pub use snowbridge_beacon_primitives; - -/// Snowbridge Core. -#[cfg(feature = "snowbridge-core")] -pub use snowbridge_core; - -/// Snowbridge Ethereum. -#[cfg(feature = "snowbridge-ethereum")] -pub use snowbridge_ethereum; - -/// Snowbridge Inbound Queue Primitives. -#[cfg(feature = "snowbridge-inbound-queue-primitives")] -pub use snowbridge_inbound_queue_primitives; - -/// Snowbridge Merkle Tree. -#[cfg(feature = "snowbridge-merkle-tree")] -pub use snowbridge_merkle_tree; - -/// Snowbridge Outbound Queue Primitives. -#[cfg(feature = "snowbridge-outbound-queue-primitives")] -pub use snowbridge_outbound_queue_primitives; - -/// Snowbridge Outbound Queue Runtime API. -#[cfg(feature = "snowbridge-outbound-queue-runtime-api")] -pub use snowbridge_outbound_queue_runtime_api; - -/// Snowbridge Outbound Queue Runtime API V2. -#[cfg(feature = "snowbridge-outbound-queue-v2-runtime-api")] -pub use snowbridge_outbound_queue_v2_runtime_api; - -/// Snowbridge Ethereum Client Pallet. -#[cfg(feature = "snowbridge-pallet-ethereum-client")] -pub use snowbridge_pallet_ethereum_client; - -/// Snowbridge Ethereum Client Test Fixtures. -#[cfg(feature = "snowbridge-pallet-ethereum-client-fixtures")] -pub use snowbridge_pallet_ethereum_client_fixtures; - -/// Snowbridge Inbound Queue Pallet. -#[cfg(feature = "snowbridge-pallet-inbound-queue")] -pub use snowbridge_pallet_inbound_queue; - -/// Snowbridge Inbound Queue Test Fixtures. -#[cfg(feature = "snowbridge-pallet-inbound-queue-fixtures")] -pub use snowbridge_pallet_inbound_queue_fixtures; - -/// Snowbridge Inbound Queue Test Fixtures V2. -#[cfg(feature = "snowbridge-pallet-inbound-queue-v2-fixtures")] -pub use snowbridge_pallet_inbound_queue_v2_fixtures; - -/// Snowbridge Inbound Queue Pallet V2. -#[cfg(feature = "snowbridge-pallet-inbound-queue-v2")] -pub use snowbridge_pallet_inbound_queue_v2; - -/// Snowbridge Outbound Queue Pallet. -#[cfg(feature = "snowbridge-pallet-outbound-queue")] -pub use snowbridge_pallet_outbound_queue; - -/// Snowbridge Outbound Queue Pallet V2. -#[cfg(feature = "snowbridge-pallet-outbound-queue-v2")] -pub use snowbridge_pallet_outbound_queue_v2; - -/// Snowbridge System Pallet. -#[cfg(feature = "snowbridge-pallet-system")] -pub use snowbridge_pallet_system; - -/// Snowbridge System Frontend Pallet. -#[cfg(feature = "snowbridge-pallet-system-frontend")] -pub use snowbridge_pallet_system_frontend; - -/// Snowbridge System Pallet V2. -#[cfg(feature = "snowbridge-pallet-system-v2")] -pub use snowbridge_pallet_system_v2; - -/// Snowbridge Runtime Common. -#[cfg(feature = "snowbridge-runtime-common")] -pub use snowbridge_runtime_common; - -/// Snowbridge Runtime Tests. -#[cfg(feature = "snowbridge-runtime-test-common")] -pub use snowbridge_runtime_test_common; - -/// Snowbridge System Runtime API. -#[cfg(feature = "snowbridge-system-runtime-api")] -pub use snowbridge_system_runtime_api; - -/// Snowbridge System Runtime API V2. -#[cfg(feature = "snowbridge-system-v2-runtime-api")] -pub use snowbridge_system_v2_runtime_api; - -/// Snowbridge Verification Primitives. -#[cfg(feature = "snowbridge-verification-primitives")] -pub use snowbridge_verification_primitives; - /// Substrate runtime api primitives. #[cfg(feature = "sp-api")] pub use sp_api; From fb3d64ddf6d63577c9232a5bbee5465c4576000f Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 14:17:09 +0200 Subject: [PATCH 07/11] update cargo lock --- Cargo.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b47b62072652..065458a2b31f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2657,7 +2657,7 @@ dependencies = [ "snowbridge-merkle-tree", "snowbridge-outbound-queue-primitives", "snowbridge-outbound-queue-runtime-api", - "snowbridge-outbound-queue-runtime-api-v2", + "snowbridge-outbound-queue-v2-runtime-api", "snowbridge-pallet-ethereum-client", "snowbridge-pallet-inbound-queue", "snowbridge-pallet-inbound-queue-v2", @@ -2668,7 +2668,7 @@ dependencies = [ "snowbridge-runtime-common", "snowbridge-runtime-test-common", "snowbridge-system-runtime-api", - "snowbridge-system-runtime-api-v2", + "snowbridge-system-v2-runtime-api", "sp-api 26.0.0", "sp-block-builder", "sp-consensus-aura", @@ -21678,7 +21678,7 @@ dependencies = [ ] [[package]] -name = "snowbridge-outbound-queue-runtime-api-v2" +name = "snowbridge-outbound-queue-v2-runtime-api" version = "0.2.0" dependencies = [ "frame-support", @@ -21771,18 +21771,6 @@ dependencies = [ "sp-std 14.0.0", ] -[[package]] -name = "snowbridge-pallet-inbound-queue-fixtures-v2" -version = "0.10.0" -dependencies = [ - "hex-literal", - "snowbridge-beacon-primitives", - "snowbridge-core", - "snowbridge-inbound-queue-primitives", - "sp-core 28.0.0", - "sp-std 14.0.0", -] - [[package]] name = "snowbridge-pallet-inbound-queue-v2" version = "0.2.0" @@ -21803,7 +21791,7 @@ dependencies = [ "snowbridge-core", "snowbridge-inbound-queue-primitives", "snowbridge-pallet-ethereum-client", - "snowbridge-pallet-inbound-queue-fixtures-v2", + "snowbridge-pallet-inbound-queue-v2-fixtures", "snowbridge-test-utils", "sp-core 28.0.0", "sp-io 30.0.0", @@ -21816,6 +21804,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "snowbridge-pallet-inbound-queue-v2-fixtures" +version = "0.10.0" +dependencies = [ + "hex-literal", + "snowbridge-beacon-primitives", + "snowbridge-core", + "snowbridge-inbound-queue-primitives", + "sp-core 28.0.0", + "sp-std 14.0.0", +] + [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" @@ -22007,7 +22007,7 @@ dependencies = [ ] [[package]] -name = "snowbridge-system-runtime-api-v2" +name = "snowbridge-system-v2-runtime-api" version = "0.2.0" dependencies = [ "parity-scale-codec", From 2d10f9951f05859ad9d44352ad533b5b51022b6e Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 14:44:51 +0200 Subject: [PATCH 08/11] fix assets --- .../primitives/outbound-queue/src/v2/converter/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs index 763fd91ae04fa..8bf87a91e1637 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs @@ -542,7 +542,7 @@ fn xcm_converter_convert_success() { let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(1000) }.into(); let message: Xcm<()> = vec![ - WithdrawAsset(assets.clone()), + WithdrawAsset(fee_asset.clone().into()), PayFees { asset: fee_asset }, WithdrawAsset(assets.clone()), AliasOrigin(Location::new(1, [GlobalConsensus(Polkadot), Parachain(1000)])), From 7df837092917e98d0e8c69726469c2b8379ec9b1 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Tue, 4 Mar 2025 19:01:17 +0200 Subject: [PATCH 09/11] revert changes --- .../pallets/outbound-queue-v2/src/lib.rs | 29 +++++++++---------- .../primitives/outbound-queue/src/lib.rs | 17 +++++++++-- .../outbound-queue/src/v1/converter/tests.rs | 2 +- .../primitives/outbound-queue/src/v1/mod.rs | 4 +-- .../outbound-queue/src/v2/converter/tests.rs | 20 ++++++------- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs index d8ee4a22175f0..eaeefb8ed51fb 100644 --- a/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs @@ -316,14 +316,24 @@ pub mod pallet { // b. Convert to committed hash and save into MessageLeaves // c. Save nonce&fee into PendingOrders let message: Message = Message::decode(&mut message).map_err(|_| Corrupt)?; - let abi_commands: Vec = message + let commands: Vec = message .commands .clone() .into_iter() - .map(|command| CommandWrapper { + .map(|command| OutboundCommandWrapper { kind: command.index(), gas: T::GasMeter::maximum_dispatch_gas_used_at_most(&command), - payload: Bytes::from(command.abi_encode()), + payload: command.abi_encode(), + }) + .collect(); + + let abi_commands: Vec = commands + .clone() + .into_iter() + .map(|command| CommandWrapper { + kind: command.kind, + gas: command.gas, + payload: Bytes::from(command.payload), }) .collect(); let committed_message = OutboundMessageWrapper { @@ -338,18 +348,7 @@ pub mod pallet { let outbound_message = OutboundMessage { origin: message.origin, nonce, - commands: message - .commands - .clone() - .into_iter() - .map(|command| OutboundCommandWrapper { - kind: command.index(), - gas: T::GasMeter::maximum_dispatch_gas_used_at_most(&command), - payload: command.abi_encode(), - }) - .collect::>() - .try_into() - .map_err(|_| Corrupt)?, + commands: commands.try_into().map_err(|_| Corrupt)?, }; Messages::::append(Box::new(outbound_message)); diff --git a/bridges/snowbridge/primitives/outbound-queue/src/lib.rs b/bridges/snowbridge/primitives/outbound-queue/src/lib.rs index 959d2c731624a..0eb24e67130ed 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/lib.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/lib.rs @@ -16,7 +16,9 @@ use sp_core::RuntimeDebug; pub use snowbridge_verification_primitives::*; /// The operating mode of Channels and Gateway contract on Ethereum. -#[derive(Copy, Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, TypeInfo)] +#[derive( + Copy, Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, TypeInfo, +)] pub enum OperatingMode { /// Normal operations. Allow sending and receiving messages. Normal, @@ -35,7 +37,18 @@ pub trait SendMessageFeeProvider { } /// Reasons why sending to Ethereum could not be initiated -#[derive(Copy, Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, PalletError, TypeInfo)] +#[derive( + Copy, + Clone, + Encode, + Decode, + DecodeWithMemTracking, + PartialEq, + Eq, + RuntimeDebug, + PalletError, + TypeInfo, +)] pub enum SendError { /// Message is too large to be safely executed on Ethereum MessageTooLarge, diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v1/converter/tests.rs b/bridges/snowbridge/primitives/outbound-queue/src/v1/converter/tests.rs index a0fb75beb2b7d..5d4b3ef2e5b09 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v1/converter/tests.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v1/converter/tests.rs @@ -1,7 +1,7 @@ +use crate::{v1::Fee, SendError, SendMessageFeeProvider}; use frame_support::parameter_types; use hex_literal::hex; use snowbridge_core::AgentIdOf; -use crate::{v1::Fee, SendError, SendMessageFeeProvider}; use sp_std::default::Default; use xcm::{ latest::{ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH}, diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v1/mod.rs b/bridges/snowbridge/primitives/outbound-queue/src/v1/mod.rs index 40559d8029e79..eae1ba3d51b00 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v1/mod.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v1/mod.rs @@ -1,5 +1,5 @@ -pub mod message; pub mod converter; +pub mod message; -pub use message::*; pub use converter::*; +pub use message::*; diff --git a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs index 8bf87a91e1637..1771eba6045c6 100644 --- a/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs +++ b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/tests.rs @@ -160,8 +160,8 @@ fn exporter_validate_without_universal_source_yields_missing_argument() { fn exporter_validate_without_global_universal_location_yields_not_applicable() { let network = BridgedNetwork::get(); let channel: u32 = 0; - let mut universal_source: Option = Some([GlobalConsensus(NetworkId::Polkadot)].into()); - let mut destination: Option = Some([GlobalConsensus(NetworkId::Ethereum { chain_id: 11155111 })].into()); + let mut universal_source: Option = Here.into(); + let mut destination: Option = Here.into(); let mut message: Option> = None; let result = @@ -330,7 +330,7 @@ fn exporter_validate_with_max_target_fee_yields_unroutable() { } #[test] -fn exporter_validate_with_unparsable_xcm_yields_not_applicable() { +fn exporter_validate_with_unparsable_xcm_yields_unroutable() { let network = BridgedNetwork::get(); let mut destination: Option = Here.into(); @@ -542,7 +542,7 @@ fn xcm_converter_convert_success() { let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(1000) }.into(); let message: Xcm<()> = vec![ - WithdrawAsset(fee_asset.clone().into()), + WithdrawAsset(assets.clone()), PayFees { asset: fee_asset }, WithdrawAsset(assets.clone()), AliasOrigin(Location::new(1, [GlobalConsensus(Polkadot), Parachain(1000)])), @@ -623,7 +623,7 @@ fn xcm_converter_convert_without_set_topic_yields_set_topic_expected() { } #[test] -fn xcm_converter_convert_with_partial_message_yields_unexpected_end_of_xcm() { +fn xcm_converter_convert_with_partial_message_yields_invalid_fee_asset() { let network = BridgedNetwork::get(); let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000"); @@ -670,14 +670,14 @@ fn xcm_converter_with_different_fee_asset_succeed() { } #[test] -fn xcm_converter_with_fees_greater_than_reserve_fails() { +fn xcm_converter_with_fees_greater_than_reserve_succeed() { let network = BridgedNetwork::get(); let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000"); let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000"); let asset_location: Location = [AccountKey20 { network: None, key: token_address }].into(); - let fee_asset: Asset = Asset { id: AssetId([GlobalConsensus(NetworkId::Polkadot)].into()), fun: Fungible(2000) }.into(); // Fee is greater than asset amount + let fee_asset: Asset = Asset { id: AssetId(Here.into()), fun: Fungible(1000) }.into(); let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into(); @@ -685,7 +685,7 @@ fn xcm_converter_with_fees_greater_than_reserve_fails() { let message: Xcm<()> = vec![ WithdrawAsset(assets.clone()), - PayFees { asset: fee_asset }, // Fees exceed available balance + PayFees { asset: fee_asset }, WithdrawAsset(assets.clone()), AliasOrigin(Location::new(1, [GlobalConsensus(Polkadot), Parachain(1000)])), DepositAsset { @@ -694,10 +694,10 @@ fn xcm_converter_with_fees_greater_than_reserve_fails() { }, SetTopic([0; 32]), ] - .into(); + .into(); let mut converter = XcmConverter::::new(&message, network); let result = converter.convert(); - assert_eq!(result.is_ok(), false); // Now expecting failure + assert_eq!(result.is_ok(), true); } #[test] From 0c5512a586e22fc400871ec65cd9ad2949b278ef Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Wed, 5 Mar 2025 09:59:56 +0200 Subject: [PATCH 10/11] default claimer is the beneficiary --- .../snowbridge/pallets/system-v2/src/lib.rs | 3 -- .../inbound-queue/src/v2/converter.rs | 43 +++++++++++-------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/bridges/snowbridge/pallets/system-v2/src/lib.rs b/bridges/snowbridge/pallets/system-v2/src/lib.rs index fcbb8f24578bb..34601bbba5f1b 100644 --- a/bridges/snowbridge/pallets/system-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/system-v2/src/lib.rs @@ -53,9 +53,6 @@ use frame_support::traits::OriginTrait; pub use pallet::*; pub type AccountIdOf = ::AccountId; - -#[cfg(feature = "runtime-benchmarks")] -use frame_support::traits::OriginTrait; #[cfg(feature = "runtime-benchmarks")] pub trait BenchmarkHelper where diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs index 2badc705dd2b8..9746f122e1f1e 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs @@ -168,6 +168,16 @@ where Ok(prepared_message) } + /// Get the bridge owner account ID from the current Ethereum network chain ID. + /// Returns an error if the network is not Ethereum. + fn get_bridge_owner() -> Result<[u8; 32], ConvertMessageError> { + let chain_id = match EthereumNetwork::get() { + NetworkId::Ethereum { chain_id } => chain_id, + _ => return Err(ConvertMessageError::InvalidNetwork), + }; + Ok(EthereumLocationsConverterFor::<[u8; 32]>::from_chain_id(&chain_id)) + } + /// Construct the remote XCM needed to create a new asset in the `ForeignAssets` pallet /// on AssetHub (Polkadot or Kusama). fn make_create_asset_xcm( @@ -175,11 +185,7 @@ where network: super::message::Network, eth_value: u128, ) -> Result, ConvertMessageError> { - let chain_id = match EthereumNetwork::get() { - NetworkId::Ethereum { chain_id } => chain_id, - _ => return Err(ConvertMessageError::InvalidNetwork), - }; - let bridge_owner = EthereumLocationsConverterFor::<[u8; 32]>::from_chain_id(&chain_id); + let bridge_owner = Self::get_bridge_owner()?; let dot_asset = Location::new(1, Here); let dot_fee: xcm::prelude::Asset = (dot_asset, CreateAssetDeposit::get()).into(); @@ -302,15 +308,13 @@ where ReserveAssetDeposited(message.execution_fee.clone().into()), ]; - // Make the origin account on AH the default claimer. This account can transact - // on AH once it gets full EVM support. + let bridge_owner = Self::get_bridge_owner()?; + // Make the Snowbridge sovereign on AH the default claimer. let default_claimer = Location::new( 0, - [AccountKey20 { - // Set network to `None` to support future Plaza EVM chainid by default. + [AccountId32 { network: None, - // Ethereum account ID - key: message.origin.as_fixed_bytes().clone(), + id: bridge_owner, }], ); @@ -672,8 +676,6 @@ mod tests { hex!("37a6c666da38711a963d938eafdd09314fd3f95a96a3baffb55f26560f4ecdd8").into(); let beneficiary = hex!("908783d8cd24c9e02cee1d26ab9c46d458621ad0150b626c536a40b9df3f09c6").into(); - let message_id: H256 = - hex!("8b69c7e376e28114618e829a7ec768dbda28357d359ba417a3bd79b11215059d").into(); let token_value = 3_000_000_000_000u128; let assets = vec![EthereumAsset::ForeignTokenERC20 { token_id, value: token_value }]; let instructions = vec![ @@ -718,10 +720,15 @@ mod tests { } } - // actual claimer should default to message origin + // actual claimer should default to Snowbridge sovereign account + let chain_id = match EthereumNetwork::get() { + NetworkId::Ethereum { chain_id } => chain_id, + _ => 0, + }; + let bridge_owner = EthereumLocationsConverterFor::<[u8; 32]>::from_chain_id(&chain_id); assert_eq!( actual_claimer, - Some(Location::new(0, [AccountKey20 { network: None, key: origin.into() }])) + Some(Location::new(0, [AccountId32 { network: None, id: bridge_owner }])) ); // Find the last two instructions to check the appendix is correct. @@ -742,8 +749,8 @@ mod tests { second_last, Some(DepositAsset { assets: Wild(AllOf { id: AssetId(fee_asset), fun: WildFungibility::Fungible }), - // beneficiary is the relayer - beneficiary: Location::new(0, [AccountKey20 { network: None, key: origin.into() }]) + // beneficiary is the claimer (bridge owner) + beneficiary: Location::new(0, [AccountId32 { network: None, id: bridge_owner }]) }) ); assert_eq!( @@ -784,4 +791,4 @@ mod tests { // Invalid xcm does not break the message, allowing funds to be trapped on AH. assert_ok!(result.clone()); } -} +} \ No newline at end of file From a2a0d17b887f2b32b1e210340b79d319a2b32abf Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Wed, 5 Mar 2025 10:16:43 +0200 Subject: [PATCH 11/11] fix test --- .../src/tests/snowbridge_v2_inbound.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs index 0b48c0ac67fb1..f8e35e0ce6ba6 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs @@ -32,7 +32,7 @@ use rococo_westend_system_emulated_network::penpal_emulated_chain::PARA_ID_B; use snowbridge_core::{AssetMetadata, TokenIdOf}; use snowbridge_inbound_queue_primitives::v2::{ EthereumAsset::{ForeignTokenERC20, NativeTokenERC20}, - Message, XcmPayload, + Message, Network, XcmPayload, }; use sp_core::{H160, H256}; use sp_runtime::MultiAddress; @@ -72,7 +72,7 @@ fn register_token_v2() { nonce: 1, origin, assets: vec![], - xcm: XcmPayload::CreateAsset { token, network: 0 }, + xcm: XcmPayload::CreateAsset { token, network: Network::Polkadot }, claimer: Some(claimer_bytes), // Used to pay the asset creation deposit. value: 9_000_000_000_000u128, @@ -997,6 +997,11 @@ fn invalid_claimer_does_not_fail_the_message() { asset_id: *asset_id == weth_location(), owner: *owner == beneficiary_acc.into(), }, + // Leftover fees deposited into Snowbridge Sovereign + RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => { + asset_id: *asset_id == eth_location(), + owner: *owner == snowbridge_sovereign().into(), + }, ] ); @@ -1005,15 +1010,5 @@ fn invalid_claimer_does_not_fail_the_message() { ForeignAssets::balance(weth_location(), AccountId::from(beneficiary_acc)), token_transfer_value ); - - let events = AssetHubWestend::events(); - // Check that assets were trapped due to the invalid claimer. - assert!( - events.iter().any(|event| matches!( - event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) - )), - "Assets were trapped, should not happen." - ); }); }