diff --git a/Cargo.lock b/Cargo.lock index 0b47b6207265..065458a2b31f 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", diff --git a/Cargo.toml b/Cargo.toml index 2e7d4daa6502..006deb7d1a82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1258,13 +1258,13 @@ 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 } 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 = { 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 } @@ -1273,7 +1273,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/inbound-queue-v2/Cargo.toml b/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml index 2c8c73d3636d..fe52c823b9b2 100644 --- a/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml +++ b/bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml @@ -42,7 +42,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 } @@ -70,7 +70,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", @@ -90,7 +90,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 fc3f6efc3542..0ad7af6ead5b 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 dda47b4e9f0e..a79648ef9bdc 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/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs b/bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs index 01362565dc10..38fd802d94bb 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 1dfd45064647..1b4d6f815527 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 57035ca4ee05..1bc1f37fed91 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 41877a18ae17..5e98df5ab629 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/pallets/outbound-queue-v2/src/lib.rs b/bridges/snowbridge/pallets/outbound-queue-v2/src/lib.rs index acb701db6c3c..3f1f00903288 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 @@ -41,12 +42,11 @@ //! //! # Extrinsics //! -//! * [`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; @@ -216,7 +216,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 diff --git a/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs b/bridges/snowbridge/pallets/outbound-queue-v2/src/test.rs index 1dcc5e0f23d8..07e5fed4f24f 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 27d901a43dd9..61eaeb272f1e 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/README.md b/bridges/snowbridge/pallets/system-v2/README.md new file mode 100644 index 000000000000..f36632edc08f --- /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/Cargo.toml b/bridges/snowbridge/pallets/system-v2/runtime-api/Cargo.toml index eece738f8164..27b02aaa68e0 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/bridges/snowbridge/pallets/system-v2/runtime-api/README.md b/bridges/snowbridge/pallets/system-v2/runtime-api/README.md index d7e81c9e7861..c989394af73d 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 c8cb777fff57..fe5a5e50b9df 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 bc85a13a7de7..34601bbba5f1 100644 --- a/bridges/snowbridge/pallets/system-v2/src/lib.rs +++ b/bridges/snowbridge/pallets/system-v2/src/lib.rs @@ -53,7 +53,6 @@ use frame_support::traits::OriginTrait; pub use pallet::*; pub type AccountIdOf = ::AccountId; - #[cfg(feature = "runtime-benchmarks")] pub trait BenchmarkHelper where @@ -105,11 +104,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 +161,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 6e643ac5e057..a1f5ac7cfcd5 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 bf6335605225..716338eb7696 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 0ec9c634bb6f..2b2d288d0b8e 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. /// Resolves Polkadot locations (as seen by Ethereum) to unique `AgentId` identifiers. pub type AgentIdOf = HashedDescription< diff --git a/bridges/snowbridge/primitives/core/src/reward.rs b/bridges/snowbridge/primitives/core/src/reward.rs index 657c62215bfe..083fdc76c68f 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 810c4747c382..8016e66fdaf8 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 421db46a6f09..9746f122e1f1 100644 --- a/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs +++ b/bridges/snowbridge/primitives/inbound-queue/src/v2/converter.rs @@ -14,13 +14,15 @@ use xcm::{ prelude::{Junction::*, *}, MAX_XCM_DECODE_DEPTH, }; - use super::{message::*, traits::*}; use crate::{CallIndex, EthereumLocationsConverterFor}; 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)] @@ -152,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(), @@ -166,18 +168,24 @@ 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( - token: &H160, - network: u8, - eth_value: u128, - ) -> Result, ConvertMessageError> { + /// 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), }; - let bridge_owner = EthereumLocationsConverterFor::<[u8; 32]>::from_chain_id(&chain_id); + 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( + token: &H160, + network: super::message::Network, + eth_value: u128, + ) -> Result, ConvertMessageError> { + 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(); @@ -196,14 +204,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), } } @@ -299,29 +306,30 @@ 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 - // 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, }], ); 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![]; @@ -438,7 +446,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(); @@ -562,8 +569,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); } @@ -669,13 +676,10 @@ 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![ DepositAsset { assets: Wild(AllCounted(1).into()), beneficiary }, - SetTopic(message_id.into()), ]; let xcm: Xcm<()> = instructions.into(); let versioned_xcm = VersionedXcm::V5(xcm); @@ -697,7 +701,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()); @@ -716,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. @@ -740,10 +749,14 @@ 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!( + last, + Some(SetTopic(blake2_256(&(INBOUND_QUEUE_TOPIC_PREFIX, message.nonce).encode()))) + ); } #[test] @@ -778,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 diff --git a/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs b/bridges/snowbridge/primitives/inbound-queue/src/v2/message.rs index 12cadfb96f8b..d8898d126ce4 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), }; diff --git a/bridges/snowbridge/primitives/outbound-queue/src/lib.rs b/bridges/snowbridge/primitives/outbound-queue/src/lib.rs index 959d2c731624..0eb24e67130e 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 a0fb75beb2b7..5d4b3ef2e5b0 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 40559d8029e7..eae1ba3d51b0 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/mod.rs b/bridges/snowbridge/primitives/outbound-queue/src/v2/converter/mod.rs index 26dbd326a86b..c70839be7e45 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/verification/README.md b/bridges/snowbridge/primitives/verification/README.md index 0126be63aeba..22be52e5be82 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 6b3e02327723..e5d8f0e0a25a 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 @@ -954,7 +954,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/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 0b48c0ac67fb..f8e35e0ce6ba 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." - ); }); } 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 6705e7ed28b0..90a2102d16b2 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 } @@ -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] @@ -202,7 +202,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", @@ -212,7 +212,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/bridge_common_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_common_config.rs index e9e98be6ae07..b2604cc18509 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 d8c015b14efd..6475f3ac5690 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 @@ -13,6 +13,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + use crate::{ bridge_common_config::BridgeReward, xcm_config, 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 60810715cdc7..512691bdfae3 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 @@ -953,7 +953,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) } @@ -965,7 +965,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/prdoc/pr_6706.prdoc b/prdoc/pr_6706.prdoc index d04a2dceeea4..9fa470a50940 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/scripts/generate-umbrella.py b/scripts/generate-umbrella.py index 13b39a6172a9..12f5ae568686 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):