From 9701a7cb3198c8277646617ccf01991d196d4b28 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 31 Dec 2024 18:37:30 +0000 Subject: [PATCH 01/16] init --- parachain/Cargo.lock | 15 + parachain/Cargo.toml | 1 + parachain/pallets/omni-bridge/Cargo.toml | 35 ++ parachain/pallets/omni-bridge/src/lib.rs | 164 ++++++++ parachain/runtime/paseo/Cargo.toml | 508 ++++++++++++----------- parachain/runtime/paseo/src/lib.rs | 8 + 6 files changed, 479 insertions(+), 252 deletions(-) create mode 100644 parachain/pallets/omni-bridge/Cargo.toml create mode 100644 parachain/pallets/omni-bridge/src/lib.rs diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index 570f9b7e5c..dad8a17011 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -8505,6 +8505,20 @@ dependencies = [ "sp-api", ] +[[package]] +name = "pallet-omni-bridge" +version = "0.1.0" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-parachain-staking" version = "0.1.0" @@ -9305,6 +9319,7 @@ dependencies = [ "pallet-multisig", "pallet-omni-account", "pallet-omni-account-runtime-api", + "pallet-omni-bridge", "pallet-parachain-staking", "pallet-pool-proposal", "pallet-preimage", diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 1f7d120a9d..20f24e02e6 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -283,6 +283,7 @@ pallet-group = { path = "pallets/group", default-features = false } pallet-identity-management = { path = "pallets/identity-management", default-features = false } pallet-omni-account = { path = "pallets/omni-account", default-features = false } pallet-omni-account-runtime-api = { path = "pallets/omni-account/runtime-api", default-features = false } +pallet-omni-bridge = { path = "pallets/omni-bridge", default-features = false } pallet-parachain-staking = { path = "pallets/parachain-staking", default-features = false } pallet-score-staking = { path = "pallets/score-staking", default-features = false } pallet-teebag = { path = "pallets/teebag", default-features = false } diff --git a/parachain/pallets/omni-bridge/Cargo.toml b/parachain/pallets/omni-bridge/Cargo.toml new file mode 100644 index 0000000000..8f48736bb5 --- /dev/null +++ b/parachain/pallets/omni-bridge/Cargo.toml @@ -0,0 +1,35 @@ +[package] +authors = ['Trust Computing GmbH '] +version = "0.1.0" +edition = "2021" +homepage = 'https://litentry.com' +name = 'pallet-omni-bridge' + +[dependencies] +parity-scale-codec = { workspace = true } +scale-info = { workspace = true } + +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-runtime = { workspace = true } +sp-core = { workspace = true } +sp-std = { workspace = true } + +[dev-dependencies] +sp-io = { workspace = true, features = ["improved_panic_error_reporting"] } + +[features] +default = ["std"] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +std = [ + "parity-scale-codec/std", + "scale-info/std", + "sp-io/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", +] +try-runtime = ["frame-support/try-runtime"] diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs new file mode 100644 index 0000000000..101233b76c --- /dev/null +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -0,0 +1,164 @@ +// Copyright 2020-2024 Trust Computing GmbH. +// This file is part of Litentry. +// +// Litentry is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Litentry is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Litentry. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +use parity_scale_codec::Codec; +use sp_runtime::traits::AtLeast32BitUnsigned; +use sp_runtime::FixedPointOperand; +use frame_support::ensure; +use frame_system::ensure_root; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::ensure_signed; + use frame_system::pallet_prelude::OriginFor; + use scale_info::TypeInfo; + use scale_info::prelude::vec::Vec; + use sp_std::{fmt::Debug, prelude::*, vec}; + + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::without_storage_info] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// The units in which we record balances. + type Balance: Parameter + + Member + + AtLeast32BitUnsigned + + Codec + + Default + + Copy + + MaybeSerializeDeserialize + + Debug + + MaxEncodedLen + + TypeInfo + + FixedPointOperand; + + // origin to manage Relayer Admin + type SetAdminOrigin: EnsureOrigin; + } + + #[pallet::storage] + #[pallet::getter(fn admin)] + pub type Admin = StorageValue<_, T::AccountId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn relayer)] + pub type Relayer = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Relayer added + RelayerAdded(T::AccountId), + /// Relayer removed + RelayerRemoved(T::AccountId), + + /// Account paid in tokens, they will be paid out on the other side of the bridge. + PaidIn(T::Balance, Vec), + /// Tokens were paid out to the account after being paid in on the other side of the bridge. + PaidOut(T::Balance, T::AccountId), + + /// Admins was set + AdminSet { new_admin: Option }, + } + + #[pallet::error] + pub enum Error { + RequireAdminOrRoot, + UnknownRelayer, + } + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn pay_in( + _origin: OriginFor, + balance: T::Balance, + // contains recipient address + call_data: Vec, + ) -> DispatchResultWithPostInfo { + // check user has amount + // take tokens from user's account + Self::deposit_event(Event::PaidIn(balance, call_data)); + // todo: should pay + Ok(Pays::No.into()) + } + + #[pallet::call_index(1)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn pay_out(origin: OriginFor, balance: T::Balance, _recipient: T::AccountId) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + // check user is an relayer + // add tokens to user account + Self::deposit_event(Event::PaidOut(balance, who)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(2)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn add_relayer(origin: OriginFor, relayer: T::AccountId) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + Relayer::::insert(relayer.clone(), ()); + Self::deposit_event(Event::RelayerAdded(relayer)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(3)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn remove_relayer(origin: OriginFor, relayer: T::AccountId) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + ensure!(Relayer::::contains_key(&relayer), Error::::UnknownRelayer); + Relayer::::remove(relayer.clone()); + Self::deposit_event(Event::RelayerRemoved(relayer)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(4)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_admin( + origin: OriginFor, + new_admin: T::AccountId, + ) -> DispatchResultWithPostInfo { + T::SetAdminOrigin::ensure_origin(origin)?; + Admin::::put(new_admin.clone()); + Self::deposit_event(Event::AdminSet { new_admin: Some(new_admin) }); + Ok(Pays::No.into()) + } + } + + impl Pallet { + fn ensure_admin_or_root(origin: OriginFor) -> DispatchResult { + ensure!( + ensure_root(origin.clone()).is_ok() || Some(ensure_signed(origin)?) == Self::admin(), + Error::::RequireAdminOrRoot + ); + Ok(()) + } + } +} \ No newline at end of file diff --git a/parachain/runtime/paseo/Cargo.toml b/parachain/runtime/paseo/Cargo.toml index 2fb76e12e4..29a9b815ea 100644 --- a/parachain/runtime/paseo/Cargo.toml +++ b/parachain/runtime/paseo/Cargo.toml @@ -94,6 +94,7 @@ pallet-group = { workspace = true } pallet-identity-management = { workspace = true } pallet-omni-account = { workspace = true } pallet-omni-account-runtime-api = { workspace = true } +pallet-omni-bridge = { workspace = true } pallet-parachain-staking = { workspace = true } pallet-score-staking = { workspace = true } pallet-teebag = { workspace = true } @@ -152,260 +153,263 @@ substrate-wasm-builder = { workspace = true } default = ["std"] fast-runtime = [] runtime-benchmarks = [ - "cumulus-pallet-dmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-account-fix/runtime-benchmarks", - "pallet-asset-manager/runtime-benchmarks", - "pallet-assets-handler/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-bitacross/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-bridge-transfer/runtime-benchmarks", - "pallet-chain-bridge/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-conviction-voting/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-ethereum/runtime-benchmarks", - "pallet-evm-assertions/runtime-benchmarks", - "pallet-evm-precompile-assets-erc20/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", - "pallet-extrinsic-filter/runtime-benchmarks", - "pallet-group/runtime-benchmarks", - "pallet-identity-management/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-omni-account/runtime-benchmarks", - "pallet-parachain-staking/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-referenda/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-score-staking/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-teebag/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vc-management/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "pallet-whitelist/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "polkadot-runtime-parachains/runtime-benchmarks", - "runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "pallet-aiusd-convertor/runtime-benchmarks", - "pallet-collab-ai-common/runtime-benchmarks", - "pallet-curator/runtime-benchmarks", - "pallet-evm-precompile-aiusd-convertor/runtime-benchmarks", - "pallet-guardian/runtime-benchmarks", - "pallet-investing-pool/runtime-benchmarks", - "pallet-pool-proposal/runtime-benchmarks", + "cumulus-pallet-dmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-account-fix/runtime-benchmarks", + "pallet-asset-manager/runtime-benchmarks", + "pallet-assets-handler/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-bitacross/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-bridge-transfer/runtime-benchmarks", + "pallet-chain-bridge/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-conviction-voting/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", + "pallet-evm-assertions/runtime-benchmarks", + "pallet-evm-precompile-assets-erc20/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + "pallet-extrinsic-filter/runtime-benchmarks", + "pallet-group/runtime-benchmarks", + "pallet-identity-management/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-omni-account/runtime-benchmarks", + "pallet-parachain-staking/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-referenda/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-score-staking/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-teebag/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vc-management/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "pallet-whitelist/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "polkadot-runtime-parachains/runtime-benchmarks", + "runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "pallet-aiusd-convertor/runtime-benchmarks", + "pallet-collab-ai-common/runtime-benchmarks", + "pallet-curator/runtime-benchmarks", + "pallet-evm-precompile-aiusd-convertor/runtime-benchmarks", + "pallet-guardian/runtime-benchmarks", + "pallet-investing-pool/runtime-benchmarks", + "pallet-pool-proposal/runtime-benchmarks", + "pallet-omni-bridge/runtime-benchmarks" ] std = [ - "core-primitives/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking?/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-parachain-inherent/std", - "cumulus-primitives-timestamp/std", - "cumulus-primitives-utility/std", - "fp-evm/std", - "fp-rpc/std", - "fp-self-contained/std", - "frame-benchmarking?/std", - "frame-executive/std", - "frame-support/std", - "frame-system-benchmarking?/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "log/std", - "moonbeam-evm-tracer/std", - "moonbeam-rpc-primitives-debug/std", - "moonbeam-rpc-primitives-txpool/std", - "num_enum/std", - "pallet-account-fix/std", - "pallet-asset-manager/std", - "pallet-assets-handler/std", - "pallet-assets/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-bitacross/std", - "pallet-bounties/std", - "pallet-bridge-transfer/std", - "pallet-chain-bridge/std", - "pallet-collective/std", - "pallet-conviction-voting/std", - "pallet-democracy/std", - "pallet-ethereum/std", - "pallet-evm-assertions/std", - "pallet-evm-precompile-assets-erc20/std", - "pallet-evm-precompile-blake2/std", - "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-bridge-transfer/std", - "pallet-evm-precompile-dispatch/std", - "pallet-evm-precompile-ed25519/std", - "pallet-evm-precompile-modexp/std", - "pallet-evm-precompile-parachain-staking/std", - "pallet-evm-precompile-score-staking/std", - "pallet-evm-precompile-sha3fips/std", - "pallet-evm-precompile-simple/std", - "pallet-evm/std", - "pallet-extrinsic-filter/std", - "pallet-group/std", - "pallet-identity-management/std", - "pallet-identity/std", - "pallet-membership/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-omni-account-runtime-api/std", - "pallet-omni-account/std", - "pallet-parachain-staking/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-referenda/std", - "pallet-scheduler/std", - "pallet-score-staking/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-teebag/std", - "pallet-timestamp/std", - "pallet-tips/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "pallet-utility/std", - "pallet-vc-management/std", - "pallet-vesting/std", - "pallet-whitelist/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "parity-scale-codec/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std", - "polkadot-runtime-parachains/std", - "precompile-utils/std", - 'runtime-common/std', - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-io/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-state-machine/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "pallet-aiusd-convertor/std", - "pallet-collab-ai-common/std", - "pallet-curator/std", - "pallet-evm-precompile-aiusd-convertor/std", - "pallet-evm-precompile-curator/std", - "pallet-evm-precompile-guardian/std", - "pallet-evm-precompile-investing-pool/std", - "pallet-evm-precompile-pool-proposal/std", - "pallet-guardian/std", - "pallet-investing-pool/std", - "pallet-pool-proposal/std", + "core-primitives/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking?/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-parachain-inherent/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "frame-benchmarking?/std", + "frame-executive/std", + "frame-support/std", + "frame-system-benchmarking?/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/std", + "log/std", + "moonbeam-evm-tracer/std", + "moonbeam-rpc-primitives-debug/std", + "moonbeam-rpc-primitives-txpool/std", + "num_enum/std", + "pallet-account-fix/std", + "pallet-asset-manager/std", + "pallet-assets-handler/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-bitacross/std", + "pallet-bounties/std", + "pallet-bridge-transfer/std", + "pallet-chain-bridge/std", + "pallet-collective/std", + "pallet-conviction-voting/std", + "pallet-democracy/std", + "pallet-ethereum/std", + "pallet-evm-assertions/std", + "pallet-evm-precompile-assets-erc20/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-bridge-transfer/std", + "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-ed25519/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-parachain-staking/std", + "pallet-evm-precompile-score-staking/std", + "pallet-evm-precompile-sha3fips/std", + "pallet-evm-precompile-simple/std", + "pallet-evm/std", + "pallet-extrinsic-filter/std", + "pallet-group/std", + "pallet-identity-management/std", + "pallet-identity/std", + "pallet-membership/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-omni-account-runtime-api/std", + "pallet-omni-account/std", + "pallet-parachain-staking/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-referenda/std", + "pallet-scheduler/std", + "pallet-score-staking/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-teebag/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vc-management/std", + "pallet-vesting/std", + "pallet-whitelist/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "parity-scale-codec/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", + "polkadot-runtime-parachains/std", + "precompile-utils/std", + 'runtime-common/std', + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-state-machine/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "pallet-aiusd-convertor/std", + "pallet-collab-ai-common/std", + "pallet-curator/std", + "pallet-evm-precompile-aiusd-convertor/std", + "pallet-evm-precompile-curator/std", + "pallet-evm-precompile-guardian/std", + "pallet-evm-precompile-investing-pool/std", + "pallet-evm-precompile-pool-proposal/std", + "pallet-guardian/std", + "pallet-investing-pool/std", + "pallet-pool-proposal/std", + "pallet-omni-bridge/std" ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "fp-self-contained/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime", - "frame-try-runtime?/try-runtime", - "pallet-account-fix/try-runtime", - "pallet-asset-manager/try-runtime", - "pallet-assets-handler/try-runtime", - "pallet-assets/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-balances/try-runtime", - "pallet-bitacross/try-runtime", - "pallet-bounties/try-runtime", - "pallet-bridge-transfer/try-runtime", - "pallet-chain-bridge/try-runtime", - "pallet-collective/try-runtime", - "pallet-conviction-voting/try-runtime", - "pallet-democracy/try-runtime", - "pallet-ethereum/try-runtime", - "pallet-evm-assertions/try-runtime", - "pallet-evm/try-runtime", - "pallet-extrinsic-filter/try-runtime", - "pallet-group/try-runtime", - "pallet-identity-management/try-runtime", - "pallet-identity/try-runtime", - "pallet-membership/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-omni-account/try-runtime", - "pallet-parachain-staking/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-referenda/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-score-staking/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-teebag/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vc-management/try-runtime", - "pallet-vesting/try-runtime", - "pallet-whitelist/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "polkadot-runtime-parachains/try-runtime", - "runtime-common/try-runtime", - "sp-runtime/try-runtime", - "pallet-aiusd-convertor/try-runtime", - "pallet-collab-ai-common/try-runtime", - "pallet-curator/try-runtime", - "pallet-guardian/try-runtime", - "pallet-investing-pool/try-runtime", - "pallet-pool-proposal/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "fp-self-contained/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime", + "frame-try-runtime?/try-runtime", + "pallet-account-fix/try-runtime", + "pallet-asset-manager/try-runtime", + "pallet-assets-handler/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-bitacross/try-runtime", + "pallet-bounties/try-runtime", + "pallet-bridge-transfer/try-runtime", + "pallet-chain-bridge/try-runtime", + "pallet-collective/try-runtime", + "pallet-conviction-voting/try-runtime", + "pallet-democracy/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm-assertions/try-runtime", + "pallet-evm/try-runtime", + "pallet-extrinsic-filter/try-runtime", + "pallet-group/try-runtime", + "pallet-identity-management/try-runtime", + "pallet-identity/try-runtime", + "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-omni-account/try-runtime", + "pallet-parachain-staking/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-referenda/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-score-staking/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-teebag/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vc-management/try-runtime", + "pallet-vesting/try-runtime", + "pallet-whitelist/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "polkadot-runtime-parachains/try-runtime", + "runtime-common/try-runtime", + "sp-runtime/try-runtime", + "pallet-aiusd-convertor/try-runtime", + "pallet-collab-ai-common/try-runtime", + "pallet-curator/try-runtime", + "pallet-guardian/try-runtime", + "pallet-investing-pool/try-runtime", + "pallet-pool-proposal/try-runtime", + "pallet-omni-bridge/try-runtime" ] diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index 38402cc395..f336bd2811 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -1253,6 +1253,12 @@ impl pallet_omni_account::Config for Runtime { type Permission = OmniAccountPermission; } +impl pallet_omni_bridge::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type SetAdminOrigin = EnsureRootOrAllCouncil; +} + impl pallet_bitacross::Config for Runtime { type RuntimeEvent = RuntimeEvent; type TEECallOrigin = EnsureEnclaveSigner; @@ -1472,6 +1478,7 @@ construct_runtime! { AssetsHandler: pallet_assets_handler = 76, OmniAccount: pallet_omni_account = 84, + OmniBridge: pallet_omni_bridge = 85, // TEE Teebag: pallet_teebag = 93, @@ -1594,6 +1601,7 @@ impl Contains for NormalModeFilter { RuntimeCall::EvmAssertions(_) | RuntimeCall::ScoreStaking(_) | RuntimeCall::OmniAccount(_) | + RuntimeCall::OmniBridge(_) | // CollabAI RuntimeCall::Curator(_) | RuntimeCall::Guardian(_) | From 3dd71550f0b26073eb5cfd745beafe4f44fc47ca Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 31 Dec 2024 19:01:54 +0000 Subject: [PATCH 02/16] add workspace --- parachain/Cargo.lock | 1 - parachain/Cargo.toml | 1 + parachain/pallets/omni-bridge/Cargo.toml | 7 +++---- parachain/runtime/paseo/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index dad8a17011..3119d70785 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -8514,7 +8514,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-runtime", "sp-std", ] diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 20f24e02e6..114836e0fb 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -27,6 +27,7 @@ members = [ 'pallets/xcm-asset-manager', 'pallets/omni-account', 'pallets/omni-account/runtime-api', + 'pallets/omni-bridge', 'precompiles/assets-erc20', 'precompiles/bridge-transfer', 'precompiles/collab-ai/aiusd-convertor', diff --git a/parachain/pallets/omni-bridge/Cargo.toml b/parachain/pallets/omni-bridge/Cargo.toml index 8f48736bb5..ea66440c88 100644 --- a/parachain/pallets/omni-bridge/Cargo.toml +++ b/parachain/pallets/omni-bridge/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" homepage = 'https://litentry.com' name = 'pallet-omni-bridge' +repository = 'https://github.com/litentry/heima' [dependencies] parity-scale-codec = { workspace = true } @@ -15,9 +16,6 @@ sp-runtime = { workspace = true } sp-core = { workspace = true } sp-std = { workspace = true } -[dev-dependencies] -sp-io = { workspace = true, features = ["improved_panic_error_reporting"] } - [features] default = ["std"] runtime-benchmarks = [ @@ -27,7 +25,8 @@ runtime-benchmarks = [ std = [ "parity-scale-codec/std", "scale-info/std", - "sp-io/std", + "sp-core/std", + "sp-std/std", "sp-runtime/std", "frame-support/std", "frame-system/std", diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index f336bd2811..70581954b1 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -24,7 +24,7 @@ #[macro_use] extern crate frame_benchmarking; -use core_primitives::LITENTRY_PARA_ID; +use core_primitives::{LITENTRY_PARA_ID}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_primitives_core::AggregateMessageOrigin; use frame_support::{ From 23723db59b0f6a07862a425541e614b50cf740d4 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 31 Dec 2024 19:03:19 +0000 Subject: [PATCH 03/16] fmt --- parachain/runtime/paseo/Cargo.toml | 510 ++++++++++++++--------------- 1 file changed, 255 insertions(+), 255 deletions(-) diff --git a/parachain/runtime/paseo/Cargo.toml b/parachain/runtime/paseo/Cargo.toml index 29a9b815ea..1cce8452c3 100644 --- a/parachain/runtime/paseo/Cargo.toml +++ b/parachain/runtime/paseo/Cargo.toml @@ -153,263 +153,263 @@ substrate-wasm-builder = { workspace = true } default = ["std"] fast-runtime = [] runtime-benchmarks = [ - "cumulus-pallet-dmp-queue/runtime-benchmarks", - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-account-fix/runtime-benchmarks", - "pallet-asset-manager/runtime-benchmarks", - "pallet-assets-handler/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-bitacross/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-bridge-transfer/runtime-benchmarks", - "pallet-chain-bridge/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-conviction-voting/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-ethereum/runtime-benchmarks", - "pallet-evm-assertions/runtime-benchmarks", - "pallet-evm-precompile-assets-erc20/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", - "pallet-extrinsic-filter/runtime-benchmarks", - "pallet-group/runtime-benchmarks", - "pallet-identity-management/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-omni-account/runtime-benchmarks", - "pallet-parachain-staking/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-referenda/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-score-staking/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-teebag/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vc-management/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "pallet-whitelist/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "polkadot-runtime-parachains/runtime-benchmarks", - "runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", - "pallet-aiusd-convertor/runtime-benchmarks", - "pallet-collab-ai-common/runtime-benchmarks", - "pallet-curator/runtime-benchmarks", - "pallet-evm-precompile-aiusd-convertor/runtime-benchmarks", - "pallet-guardian/runtime-benchmarks", - "pallet-investing-pool/runtime-benchmarks", - "pallet-pool-proposal/runtime-benchmarks", - "pallet-omni-bridge/runtime-benchmarks" + "cumulus-pallet-dmp-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-account-fix/runtime-benchmarks", + "pallet-asset-manager/runtime-benchmarks", + "pallet-assets-handler/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-bitacross/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-bridge-transfer/runtime-benchmarks", + "pallet-chain-bridge/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-conviction-voting/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-ethereum/runtime-benchmarks", + "pallet-evm-assertions/runtime-benchmarks", + "pallet-evm-precompile-assets-erc20/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + "pallet-extrinsic-filter/runtime-benchmarks", + "pallet-group/runtime-benchmarks", + "pallet-identity-management/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-omni-account/runtime-benchmarks", + "pallet-parachain-staking/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-referenda/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-score-staking/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-teebag/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vc-management/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "pallet-whitelist/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "polkadot-runtime-parachains/runtime-benchmarks", + "runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", + "pallet-aiusd-convertor/runtime-benchmarks", + "pallet-collab-ai-common/runtime-benchmarks", + "pallet-curator/runtime-benchmarks", + "pallet-evm-precompile-aiusd-convertor/runtime-benchmarks", + "pallet-guardian/runtime-benchmarks", + "pallet-investing-pool/runtime-benchmarks", + "pallet-pool-proposal/runtime-benchmarks", + "pallet-omni-bridge/runtime-benchmarks" ] std = [ - "core-primitives/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking?/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-parachain-inherent/std", - "cumulus-primitives-timestamp/std", - "cumulus-primitives-utility/std", - "fp-evm/std", - "fp-rpc/std", - "fp-self-contained/std", - "frame-benchmarking?/std", - "frame-executive/std", - "frame-support/std", - "frame-system-benchmarking?/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime?/std", - "log/std", - "moonbeam-evm-tracer/std", - "moonbeam-rpc-primitives-debug/std", - "moonbeam-rpc-primitives-txpool/std", - "num_enum/std", - "pallet-account-fix/std", - "pallet-asset-manager/std", - "pallet-assets-handler/std", - "pallet-assets/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-bitacross/std", - "pallet-bounties/std", - "pallet-bridge-transfer/std", - "pallet-chain-bridge/std", - "pallet-collective/std", - "pallet-conviction-voting/std", - "pallet-democracy/std", - "pallet-ethereum/std", - "pallet-evm-assertions/std", - "pallet-evm-precompile-assets-erc20/std", - "pallet-evm-precompile-blake2/std", - "pallet-evm-precompile-bn128/std", - "pallet-evm-precompile-bridge-transfer/std", - "pallet-evm-precompile-dispatch/std", - "pallet-evm-precompile-ed25519/std", - "pallet-evm-precompile-modexp/std", - "pallet-evm-precompile-parachain-staking/std", - "pallet-evm-precompile-score-staking/std", - "pallet-evm-precompile-sha3fips/std", - "pallet-evm-precompile-simple/std", - "pallet-evm/std", - "pallet-extrinsic-filter/std", - "pallet-group/std", - "pallet-identity-management/std", - "pallet-identity/std", - "pallet-membership/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-omni-account-runtime-api/std", - "pallet-omni-account/std", - "pallet-parachain-staking/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-referenda/std", - "pallet-scheduler/std", - "pallet-score-staking/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-teebag/std", - "pallet-timestamp/std", - "pallet-tips/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "pallet-utility/std", - "pallet-vc-management/std", - "pallet-vesting/std", - "pallet-whitelist/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "parity-scale-codec/std", - "polkadot-parachain-primitives/std", - "polkadot-primitives/std", - "polkadot-runtime-common/std", - "polkadot-runtime-parachains/std", - "precompile-utils/std", - 'runtime-common/std', - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-io/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-state-machine/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", - "pallet-aiusd-convertor/std", - "pallet-collab-ai-common/std", - "pallet-curator/std", - "pallet-evm-precompile-aiusd-convertor/std", - "pallet-evm-precompile-curator/std", - "pallet-evm-precompile-guardian/std", - "pallet-evm-precompile-investing-pool/std", - "pallet-evm-precompile-pool-proposal/std", - "pallet-guardian/std", - "pallet-investing-pool/std", - "pallet-pool-proposal/std", - "pallet-omni-bridge/std" + "core-primitives/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking?/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-parachain-inherent/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "fp-evm/std", + "fp-rpc/std", + "fp-self-contained/std", + "frame-benchmarking?/std", + "frame-executive/std", + "frame-support/std", + "frame-system-benchmarking?/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/std", + "log/std", + "moonbeam-evm-tracer/std", + "moonbeam-rpc-primitives-debug/std", + "moonbeam-rpc-primitives-txpool/std", + "num_enum/std", + "pallet-account-fix/std", + "pallet-asset-manager/std", + "pallet-assets-handler/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-bitacross/std", + "pallet-bounties/std", + "pallet-bridge-transfer/std", + "pallet-chain-bridge/std", + "pallet-collective/std", + "pallet-conviction-voting/std", + "pallet-democracy/std", + "pallet-ethereum/std", + "pallet-evm-assertions/std", + "pallet-evm-precompile-assets-erc20/std", + "pallet-evm-precompile-blake2/std", + "pallet-evm-precompile-bn128/std", + "pallet-evm-precompile-bridge-transfer/std", + "pallet-evm-precompile-dispatch/std", + "pallet-evm-precompile-ed25519/std", + "pallet-evm-precompile-modexp/std", + "pallet-evm-precompile-parachain-staking/std", + "pallet-evm-precompile-score-staking/std", + "pallet-evm-precompile-sha3fips/std", + "pallet-evm-precompile-simple/std", + "pallet-evm/std", + "pallet-extrinsic-filter/std", + "pallet-group/std", + "pallet-identity-management/std", + "pallet-identity/std", + "pallet-membership/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-omni-account-runtime-api/std", + "pallet-omni-account/std", + "pallet-parachain-staking/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-referenda/std", + "pallet-scheduler/std", + "pallet-score-staking/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-teebag/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vc-management/std", + "pallet-vesting/std", + "pallet-whitelist/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "parity-scale-codec/std", + "polkadot-parachain-primitives/std", + "polkadot-primitives/std", + "polkadot-runtime-common/std", + "polkadot-runtime-parachains/std", + "precompile-utils/std", + 'runtime-common/std', + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-state-machine/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", + "pallet-aiusd-convertor/std", + "pallet-collab-ai-common/std", + "pallet-curator/std", + "pallet-evm-precompile-aiusd-convertor/std", + "pallet-evm-precompile-curator/std", + "pallet-evm-precompile-guardian/std", + "pallet-evm-precompile-investing-pool/std", + "pallet-evm-precompile-pool-proposal/std", + "pallet-guardian/std", + "pallet-investing-pool/std", + "pallet-pool-proposal/std", + "pallet-omni-bridge/std" ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "fp-self-contained/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime", - "frame-try-runtime?/try-runtime", - "pallet-account-fix/try-runtime", - "pallet-asset-manager/try-runtime", - "pallet-assets-handler/try-runtime", - "pallet-assets/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-balances/try-runtime", - "pallet-bitacross/try-runtime", - "pallet-bounties/try-runtime", - "pallet-bridge-transfer/try-runtime", - "pallet-chain-bridge/try-runtime", - "pallet-collective/try-runtime", - "pallet-conviction-voting/try-runtime", - "pallet-democracy/try-runtime", - "pallet-ethereum/try-runtime", - "pallet-evm-assertions/try-runtime", - "pallet-evm/try-runtime", - "pallet-extrinsic-filter/try-runtime", - "pallet-group/try-runtime", - "pallet-identity-management/try-runtime", - "pallet-identity/try-runtime", - "pallet-membership/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-omni-account/try-runtime", - "pallet-parachain-staking/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-referenda/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-score-staking/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-teebag/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vc-management/try-runtime", - "pallet-vesting/try-runtime", - "pallet-whitelist/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "polkadot-runtime-parachains/try-runtime", - "runtime-common/try-runtime", - "sp-runtime/try-runtime", - "pallet-aiusd-convertor/try-runtime", - "pallet-collab-ai-common/try-runtime", - "pallet-curator/try-runtime", - "pallet-guardian/try-runtime", - "pallet-investing-pool/try-runtime", - "pallet-pool-proposal/try-runtime", - "pallet-omni-bridge/try-runtime" + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-dmp-queue/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "fp-self-contained/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime", + "frame-try-runtime?/try-runtime", + "pallet-account-fix/try-runtime", + "pallet-asset-manager/try-runtime", + "pallet-assets-handler/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-bitacross/try-runtime", + "pallet-bounties/try-runtime", + "pallet-bridge-transfer/try-runtime", + "pallet-chain-bridge/try-runtime", + "pallet-collective/try-runtime", + "pallet-conviction-voting/try-runtime", + "pallet-democracy/try-runtime", + "pallet-ethereum/try-runtime", + "pallet-evm-assertions/try-runtime", + "pallet-evm/try-runtime", + "pallet-extrinsic-filter/try-runtime", + "pallet-group/try-runtime", + "pallet-identity-management/try-runtime", + "pallet-identity/try-runtime", + "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-omni-account/try-runtime", + "pallet-parachain-staking/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-referenda/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-score-staking/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-teebag/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vc-management/try-runtime", + "pallet-vesting/try-runtime", + "pallet-whitelist/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "polkadot-runtime-parachains/try-runtime", + "runtime-common/try-runtime", + "sp-runtime/try-runtime", + "pallet-aiusd-convertor/try-runtime", + "pallet-collab-ai-common/try-runtime", + "pallet-curator/try-runtime", + "pallet-guardian/try-runtime", + "pallet-investing-pool/try-runtime", + "pallet-pool-proposal/try-runtime", + "pallet-omni-bridge/try-runtime" ] From 7326c0a807b8a1d2c12b78cb01b80228a0e6fe01 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 31 Dec 2024 19:31:48 +0000 Subject: [PATCH 04/16] fix --- parachain/pallets/omni-bridge/src/lib.rs | 292 ++++++++++++----------- parachain/runtime/paseo/Cargo.toml | 6 +- parachain/runtime/paseo/src/lib.rs | 4 +- 3 files changed, 157 insertions(+), 145 deletions(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 101233b76c..3aa2b389b6 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -16,149 +16,161 @@ #![cfg_attr(not(feature = "std"), no_std)] +use frame_support::ensure; +use frame_system::ensure_root; use parity_scale_codec::Codec; use sp_runtime::traits::AtLeast32BitUnsigned; use sp_runtime::FixedPointOperand; -use frame_support::ensure; -use frame_system::ensure_root; +pub use pallet::*; #[frame_support::pallet] pub mod pallet { - use super::*; - use frame_support::pallet_prelude::*; - use frame_system::ensure_signed; - use frame_system::pallet_prelude::OriginFor; - use scale_info::TypeInfo; - use scale_info::prelude::vec::Vec; - use sp_std::{fmt::Debug, prelude::*, vec}; - - /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); - - #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] - #[pallet::without_storage_info] - pub struct Pallet(_); - - #[pallet::config] - pub trait Config: frame_system::Config { - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// The units in which we record balances. - type Balance: Parameter - + Member - + AtLeast32BitUnsigned - + Codec - + Default - + Copy - + MaybeSerializeDeserialize - + Debug - + MaxEncodedLen - + TypeInfo - + FixedPointOperand; - - // origin to manage Relayer Admin - type SetAdminOrigin: EnsureOrigin; - } - - #[pallet::storage] - #[pallet::getter(fn admin)] - pub type Admin = StorageValue<_, T::AccountId, OptionQuery>; - - #[pallet::storage] - #[pallet::getter(fn relayer)] - pub type Relayer = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - /// Relayer added - RelayerAdded(T::AccountId), - /// Relayer removed - RelayerRemoved(T::AccountId), - - /// Account paid in tokens, they will be paid out on the other side of the bridge. - PaidIn(T::Balance, Vec), - /// Tokens were paid out to the account after being paid in on the other side of the bridge. - PaidOut(T::Balance, T::AccountId), - - /// Admins was set - AdminSet { new_admin: Option }, - } - - #[pallet::error] - pub enum Error { - RequireAdminOrRoot, - UnknownRelayer, - } - - #[pallet::call] - impl Pallet { - #[pallet::call_index(0)] - #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn pay_in( - _origin: OriginFor, - balance: T::Balance, - // contains recipient address - call_data: Vec, - ) -> DispatchResultWithPostInfo { - // check user has amount - // take tokens from user's account - Self::deposit_event(Event::PaidIn(balance, call_data)); - // todo: should pay - Ok(Pays::No.into()) - } - - #[pallet::call_index(1)] - #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn pay_out(origin: OriginFor, balance: T::Balance, _recipient: T::AccountId) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - // check user is an relayer - // add tokens to user account - Self::deposit_event(Event::PaidOut(balance, who)); - Ok(Pays::No.into()) - } - - #[pallet::call_index(2)] - #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn add_relayer(origin: OriginFor, relayer: T::AccountId) -> DispatchResultWithPostInfo { - Self::ensure_admin_or_root(origin)?; - Relayer::::insert(relayer.clone(), ()); - Self::deposit_event(Event::RelayerAdded(relayer)); - Ok(Pays::No.into()) - } - - #[pallet::call_index(3)] - #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn remove_relayer(origin: OriginFor, relayer: T::AccountId) -> DispatchResultWithPostInfo { - Self::ensure_admin_or_root(origin)?; - ensure!(Relayer::::contains_key(&relayer), Error::::UnknownRelayer); - Relayer::::remove(relayer.clone()); - Self::deposit_event(Event::RelayerRemoved(relayer)); - Ok(Pays::No.into()) - } - - #[pallet::call_index(4)] - #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn set_admin( - origin: OriginFor, - new_admin: T::AccountId, - ) -> DispatchResultWithPostInfo { - T::SetAdminOrigin::ensure_origin(origin)?; - Admin::::put(new_admin.clone()); - Self::deposit_event(Event::AdminSet { new_admin: Some(new_admin) }); - Ok(Pays::No.into()) - } - } - - impl Pallet { - fn ensure_admin_or_root(origin: OriginFor) -> DispatchResult { - ensure!( - ensure_root(origin.clone()).is_ok() || Some(ensure_signed(origin)?) == Self::admin(), - Error::::RequireAdminOrRoot - ); - Ok(()) - } - } -} \ No newline at end of file + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::ensure_signed; + use frame_system::pallet_prelude::OriginFor; + use scale_info::prelude::vec::Vec; + use scale_info::TypeInfo; + use sp_std::{fmt::Debug, prelude::*, vec}; + + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::without_storage_info] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// The units in which we record balances. + type Balance: Parameter + + Member + + AtLeast32BitUnsigned + + Codec + + Default + + Copy + + MaybeSerializeDeserialize + + Debug + + MaxEncodedLen + + TypeInfo + + FixedPointOperand; + + // origin to manage Relayer Admin + type SetAdminOrigin: EnsureOrigin; + } + + #[pallet::storage] + #[pallet::getter(fn admin)] + pub type Admin = StorageValue<_, T::AccountId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn relayer)] + pub type Relayer = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Relayer added + RelayerAdded(T::AccountId), + /// Relayer removed + RelayerRemoved(T::AccountId), + + /// Account paid in tokens, they will be paid out on the other side of the bridge. + PaidIn(T::Balance, Vec), + /// Tokens were paid out to the account after being paid in on the other side of the bridge. + PaidOut(T::Balance, T::AccountId), + + /// Admins was set + AdminSet { new_admin: Option }, + } + + #[pallet::error] + pub enum Error { + RequireAdminOrRoot, + UnknownRelayer, + } + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn pay_in( + _origin: OriginFor, + balance: T::Balance, + // contains recipient address + call_data: Vec, + ) -> DispatchResultWithPostInfo { + // check user has amount + // take tokens from user's account + Self::deposit_event(Event::PaidIn(balance, call_data)); + // todo: should pay + Ok(Pays::No.into()) + } + + #[pallet::call_index(1)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn pay_out( + origin: OriginFor, + balance: T::Balance, + _recipient: T::AccountId, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + // check user is an relayer + // add tokens to user account + Self::deposit_event(Event::PaidOut(balance, who)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(2)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn add_relayer( + origin: OriginFor, + relayer: T::AccountId, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + Relayer::::insert(relayer.clone(), ()); + Self::deposit_event(Event::RelayerAdded(relayer)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(3)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn remove_relayer( + origin: OriginFor, + relayer: T::AccountId, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + ensure!(Relayer::::contains_key(&relayer), Error::::UnknownRelayer); + Relayer::::remove(relayer.clone()); + Self::deposit_event(Event::RelayerRemoved(relayer)); + Ok(Pays::No.into()) + } + + #[pallet::call_index(4)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_admin( + origin: OriginFor, + new_admin: T::AccountId, + ) -> DispatchResultWithPostInfo { + T::SetAdminOrigin::ensure_origin(origin)?; + Admin::::put(new_admin.clone()); + Self::deposit_event(Event::AdminSet { new_admin: Some(new_admin) }); + Ok(Pays::No.into()) + } + } + + impl Pallet { + fn ensure_admin_or_root(origin: OriginFor) -> DispatchResult { + ensure!( + ensure_root(origin.clone()).is_ok() + || Some(ensure_signed(origin)?) == Self::admin(), + Error::::RequireAdminOrRoot + ); + Ok(()) + } + } +} diff --git a/parachain/runtime/paseo/Cargo.toml b/parachain/runtime/paseo/Cargo.toml index 1cce8452c3..24c4656198 100644 --- a/parachain/runtime/paseo/Cargo.toml +++ b/parachain/runtime/paseo/Cargo.toml @@ -219,7 +219,7 @@ runtime-benchmarks = [ "pallet-guardian/runtime-benchmarks", "pallet-investing-pool/runtime-benchmarks", "pallet-pool-proposal/runtime-benchmarks", - "pallet-omni-bridge/runtime-benchmarks" + "pallet-omni-bridge/runtime-benchmarks", ] std = [ "core-primitives/std", @@ -343,7 +343,7 @@ std = [ "pallet-guardian/std", "pallet-investing-pool/std", "pallet-pool-proposal/std", - "pallet-omni-bridge/std" + "pallet-omni-bridge/std", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -411,5 +411,5 @@ try-runtime = [ "pallet-guardian/try-runtime", "pallet-investing-pool/try-runtime", "pallet-pool-proposal/try-runtime", - "pallet-omni-bridge/try-runtime" + "pallet-omni-bridge/try-runtime", ] diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index 70581954b1..1bef6a888b 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -24,7 +24,7 @@ #[macro_use] extern crate frame_benchmarking; -use core_primitives::{LITENTRY_PARA_ID}; +use core_primitives::LITENTRY_PARA_ID; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_primitives_core::AggregateMessageOrigin; use frame_support::{ @@ -1255,7 +1255,7 @@ impl pallet_omni_account::Config for Runtime { impl pallet_omni_bridge::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type Balance = Balance; + type Balance = u64; type SetAdminOrigin = EnsureRootOrAllCouncil; } From f7c9ffbce63a79e225c477da500838ff09861258 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Thu, 2 Jan 2025 17:54:31 +0000 Subject: [PATCH 05/16] initial impl --- parachain/Cargo.lock | 578 +++++++++--------- parachain/Cargo.toml | 1 + parachain/node/src/chain_specs/paseo.rs | 10 +- parachain/pallets/omni-bridge/Cargo.toml | 9 +- parachain/pallets/omni-bridge/src/lib.rs | 287 +++++++-- parachain/runtime/common/Cargo.toml | 6 + parachain/runtime/common/src/lib.rs | 28 + .../runtime/litentry/src/asset_config.rs | 9 +- parachain/runtime/paseo/Cargo.toml | 3 + parachain/runtime/paseo/src/asset_config.rs | 24 +- parachain/runtime/paseo/src/lib.rs | 12 +- 11 files changed, 598 insertions(+), 369 deletions(-) diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index 3119d70785..a211cc5aab 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -447,6 +447,28 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "assets-common" +version = "0.17.1" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "impl-trait-for-tuples", + "log", + "pallet-asset-conversion", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + [[package]] name = "async-channel" version = "1.9.0" @@ -739,7 +761,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "hash-db", "log", @@ -952,7 +974,7 @@ dependencies = [ [[package]] name = "bp-xcm-bridge-hub-router" version = "0.14.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -1720,7 +1742,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "clap", "parity-scale-codec", @@ -1737,7 +1759,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1760,7 +1782,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.17.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-client-collator", @@ -1805,7 +1827,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1835,7 +1857,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-proposer" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "anyhow", "async-trait", @@ -1850,7 +1872,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1876,7 +1898,7 @@ dependencies = [ [[package]] name = "cumulus-client-parachain-inherent" version = "0.11.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1898,7 +1920,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1924,7 +1946,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1961,7 +1983,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -1978,7 +2000,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1995,7 +2017,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.16.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -2031,7 +2053,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -2042,7 +2064,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -2055,7 +2077,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2070,7 +2092,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.16.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", @@ -2095,7 +2117,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-aura" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2108,7 +2130,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2124,7 +2146,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2140,7 +2162,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "sp-externalities", "sp-runtime-interface", @@ -2150,7 +2172,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.15.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "sp-inherents", @@ -2160,7 +2182,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.16.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2179,7 +2201,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2203,7 +2225,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2222,7 +2244,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "async-trait", @@ -2257,7 +2279,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2296,7 +2318,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -3400,7 +3422,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fork-tree" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", ] @@ -3527,7 +3549,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-support-procedural", @@ -3551,7 +3573,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "42.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "Inflector", "array-bytes", @@ -3601,7 +3623,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "14.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -3612,7 +3634,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3628,7 +3650,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "aquamarine", "frame-support", @@ -3658,7 +3680,7 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "docify", @@ -3673,7 +3695,7 @@ dependencies = [ [[package]] name = "frame-support" version = "37.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "aquamarine", "array-bytes", @@ -3714,7 +3736,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "30.0.4" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "Inflector", "cfg-expr", @@ -3733,7 +3755,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 3.1.0", @@ -3745,7 +3767,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro2", "quote", @@ -3755,7 +3777,7 @@ dependencies = [ [[package]] name = "frame-system" version = "37.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cfg-if", "docify", @@ -3775,7 +3797,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -3789,7 +3811,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "parity-scale-codec", @@ -3799,7 +3821,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "parity-scale-codec", @@ -6232,7 +6254,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "log", @@ -6251,7 +6273,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -7214,7 +7236,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7249,7 +7271,7 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7263,7 +7285,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7280,7 +7302,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7317,7 +7339,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -7333,7 +7355,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -7348,7 +7370,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -7361,7 +7383,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7384,7 +7406,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "aquamarine", "docify", @@ -7405,7 +7427,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -7420,7 +7442,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -7439,7 +7461,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -7479,7 +7501,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7529,7 +7551,7 @@ dependencies = [ [[package]] name = "pallet-broker" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "frame-benchmarking", @@ -7563,7 +7585,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7594,7 +7616,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7613,7 +7635,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7629,7 +7651,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7661,7 +7683,7 @@ dependencies = [ [[package]] name = "pallet-delegated-staking" version = "4.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -7674,7 +7696,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -7691,7 +7713,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7713,7 +7735,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7726,7 +7748,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8128,7 +8150,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8146,7 +8168,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8218,7 +8240,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "enumflags2", "frame-benchmarking", @@ -8255,7 +8277,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8274,7 +8296,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8309,7 +8331,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8325,7 +8347,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "40.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "environmental", "frame-benchmarking", @@ -8344,7 +8366,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8361,7 +8383,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8376,7 +8398,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8391,7 +8413,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -8409,7 +8431,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8429,7 +8451,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -8439,7 +8461,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -8455,7 +8477,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8545,7 +8567,7 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8581,7 +8603,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8597,7 +8619,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8611,7 +8633,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8629,7 +8651,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8643,7 +8665,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "assert_matches", "frame-benchmarking", @@ -8661,7 +8683,7 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -8675,7 +8697,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8713,7 +8735,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -8734,7 +8756,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8750,7 +8772,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8767,7 +8789,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8789,7 +8811,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -8800,7 +8822,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "sp-arithmetic", @@ -8809,7 +8831,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "sp-api", @@ -8819,7 +8841,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8835,7 +8857,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8881,7 +8903,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "36.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8900,7 +8922,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8918,7 +8940,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "37.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -8933,7 +8955,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "40.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -8949,7 +8971,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -8961,7 +8983,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "36.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-benchmarking", @@ -8979,7 +9001,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "37.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -9015,7 +9037,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -9029,7 +9051,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "36.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -9043,7 +9065,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "16.0.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -9067,7 +9089,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-benchmarking", "frame-support", @@ -9085,7 +9107,7 @@ dependencies = [ [[package]] name = "parachains-common" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", @@ -9243,6 +9265,7 @@ checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" name = "paseo-parachain-runtime" version = "0.1.0" dependencies = [ + "assets-common", "core-primitives", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -9535,7 +9558,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "polkadot-approval-distribution" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "futures 0.3.30", @@ -9555,7 +9578,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "always-assert", "futures 0.3.30", @@ -9571,7 +9594,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "17.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "derive_more", "fatality", @@ -9595,7 +9618,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "fatality", @@ -9628,7 +9651,7 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cfg-if", "clap", @@ -9656,7 +9679,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "fatality", @@ -9678,7 +9701,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -9689,7 +9712,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "17.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "derive_more", "fatality", @@ -9714,7 +9737,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -9728,7 +9751,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "futures-timer", @@ -9750,7 +9773,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "always-assert", "async-trait", @@ -9773,7 +9796,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "parity-scale-codec", @@ -9791,7 +9814,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "derive_more", @@ -9824,7 +9847,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "futures 0.3.30", @@ -9846,7 +9869,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "fatality", @@ -9866,7 +9889,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "polkadot-node-subsystem", @@ -9881,7 +9904,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "17.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -9904,7 +9927,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "polkadot-node-metrics", @@ -9918,7 +9941,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "futures-timer", @@ -9935,7 +9958,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "fatality", "futures 0.3.30", @@ -9954,7 +9977,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -9971,7 +9994,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-prospective-parachains" version = "16.1.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "fatality", "futures 0.3.30", @@ -9985,7 +10008,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "fatality", @@ -10003,7 +10026,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "always-assert", "array-bytes", @@ -10032,7 +10055,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "polkadot-node-primitives", @@ -10048,7 +10071,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-common" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cpu-time", "futures 0.3.30", @@ -10074,7 +10097,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "polkadot-node-metrics", @@ -10089,7 +10112,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "lazy_static", "log", @@ -10108,7 +10131,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bs58 0.5.1", "futures 0.3.30", @@ -10127,7 +10150,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-channel 1.9.0", "async-trait", @@ -10153,7 +10176,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "bounded-vec", @@ -10176,7 +10199,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -10186,7 +10209,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "17.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "bitvec", @@ -10216,7 +10239,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "17.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "derive_more", @@ -10252,7 +10275,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -10274,7 +10297,7 @@ dependencies = [ [[package]] name = "polkadot-parachain-primitives" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bounded-collections", "derive_more", @@ -10290,7 +10313,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "hex-literal", @@ -10316,7 +10339,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -10351,7 +10374,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "16.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitvec", "frame-benchmarking", @@ -10401,7 +10424,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bs58 0.5.1", "frame-benchmarking", @@ -10413,7 +10436,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "16.0.3" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -10460,7 +10483,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "frame-benchmarking", @@ -10578,7 +10601,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -10601,7 +10624,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -11653,7 +11676,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "binary-merkle-tree", "bitvec", @@ -11753,7 +11776,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "polkadot-primitives", @@ -11830,6 +11853,7 @@ dependencies = [ "pallet-message-queue", "pallet-multisig", "pallet-omni-account", + "pallet-omni-bridge", "pallet-teebag", "pallet-transaction-payment", "pallet-treasury", @@ -12136,7 +12160,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "sp-core", @@ -12147,7 +12171,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -12177,7 +12201,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "futures-timer", @@ -12199,7 +12223,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.42.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "sp-api", @@ -12214,7 +12238,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "docify", @@ -12241,7 +12265,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -12252,7 +12276,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.46.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "chrono", @@ -12293,7 +12317,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "fnv", "futures 0.3.30", @@ -12320,7 +12344,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "hash-db", "kvdb", @@ -12346,7 +12370,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -12370,7 +12394,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -12399,7 +12423,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "fork-tree", @@ -12435,7 +12459,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "jsonrpsee", @@ -12457,7 +12481,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -12493,7 +12517,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "jsonrpsee", @@ -12513,7 +12537,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "fork-tree", "parity-scale-codec", @@ -12526,7 +12550,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.29.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "ahash", "array-bytes", @@ -12570,7 +12594,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "finality-grandpa", "futures 0.3.30", @@ -12590,7 +12614,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -12613,7 +12637,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", @@ -12636,7 +12660,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "polkavm", "sc-allocator", @@ -12649,7 +12673,7 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "polkavm", @@ -12660,7 +12684,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "anyhow", "cfg-if", @@ -12678,7 +12702,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "ansi_term", "futures 0.3.30", @@ -12695,7 +12719,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "33.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "parking_lot 0.12.3", @@ -12709,7 +12733,7 @@ dependencies = [ [[package]] name = "sc-mixnet" version = "0.14.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "arrayvec 0.7.4", @@ -12738,7 +12762,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.44.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -12789,7 +12813,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -12807,7 +12831,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "ahash", "futures 0.3.30", @@ -12826,7 +12850,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -12847,7 +12871,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -12884,7 +12908,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "futures 0.3.30", @@ -12903,7 +12927,7 @@ dependencies = [ [[package]] name = "sc-network-types" version = "0.12.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bs58 0.5.1", "ed25519-dalek", @@ -12920,7 +12944,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "bytes", @@ -12954,7 +12978,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.18.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -12963,7 +12987,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "jsonrpsee", @@ -12995,7 +13019,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -13015,7 +13039,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "16.0.2" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "forwarded-header-value", "futures 0.3.30", @@ -13037,7 +13061,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "futures 0.3.30", @@ -13069,7 +13093,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.45.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "directories", @@ -13133,7 +13157,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.36.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "parity-scale-codec", @@ -13144,7 +13168,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.22.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "clap", "fs4", @@ -13157,7 +13181,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.44.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -13176,7 +13200,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "derive_more", "futures 0.3.30", @@ -13197,7 +13221,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "chrono", "futures 0.3.30", @@ -13217,7 +13241,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "ansi_term", "chrono", @@ -13247,7 +13271,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", @@ -13258,7 +13282,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -13285,7 +13309,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -13301,7 +13325,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-channel 1.9.0", "futures 0.3.30", @@ -13781,7 +13805,7 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "enumn", "parity-scale-codec", @@ -13988,7 +14012,7 @@ dependencies = [ [[package]] name = "sp-api" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "hash-db", @@ -14010,7 +14034,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "Inflector", "blake2 0.10.6", @@ -14024,7 +14048,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14036,7 +14060,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "integer-sqrt", @@ -14050,7 +14074,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14062,7 +14086,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "sp-api", "sp-inherents", @@ -14072,7 +14096,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "37.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "futures 0.3.30", "parity-scale-codec", @@ -14091,7 +14115,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "futures 0.3.30", @@ -14106,7 +14130,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "parity-scale-codec", @@ -14122,7 +14146,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "parity-scale-codec", @@ -14140,7 +14164,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "lazy_static", "parity-scale-codec", @@ -14160,7 +14184,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "finality-grandpa", "log", @@ -14177,7 +14201,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14188,7 +14212,7 @@ dependencies = [ [[package]] name = "sp-core" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "bitflags 1.3.2", @@ -14234,7 +14258,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "blake2b_simd", "byteorder", @@ -14247,7 +14271,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "quote", "sp-crypto-hashing", @@ -14257,7 +14281,7 @@ dependencies = [ [[package]] name = "sp-database" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "kvdb", "parking_lot 0.12.3", @@ -14266,7 +14290,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "proc-macro2", "quote", @@ -14276,7 +14300,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "environmental", "parity-scale-codec", @@ -14286,7 +14310,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.15.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14298,7 +14322,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -14311,7 +14335,7 @@ dependencies = [ [[package]] name = "sp-io" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bytes", "docify", @@ -14337,7 +14361,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "39.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "sp-core", "sp-runtime", @@ -14347,7 +14371,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.40.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", @@ -14358,7 +14382,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "thiserror", "zstd 0.12.4", @@ -14367,7 +14391,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -14377,7 +14401,7 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.12.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14388,7 +14412,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "log", "parity-scale-codec", @@ -14405,7 +14429,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14418,7 +14442,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "sp-api", "sp-core", @@ -14428,7 +14452,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "backtrace", "lazy_static", @@ -14438,7 +14462,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "32.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "rustc-hash", "serde", @@ -14448,7 +14472,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "39.0.3" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "either", @@ -14474,7 +14498,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -14493,7 +14517,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "Inflector", "expander", @@ -14506,7 +14530,7 @@ dependencies = [ [[package]] name = "sp-session" version = "35.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "scale-info", @@ -14520,7 +14544,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -14533,7 +14557,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.43.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "hash-db", "log", @@ -14553,7 +14577,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -14577,12 +14601,12 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" [[package]] name = "sp-storage" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "impl-serde", "parity-scale-codec", @@ -14594,7 +14618,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "parity-scale-codec", @@ -14606,7 +14630,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "tracing", @@ -14617,7 +14641,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "sp-api", "sp-runtime", @@ -14626,7 +14650,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "34.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "async-trait", "parity-scale-codec", @@ -14640,7 +14664,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "ahash", "hash-db", @@ -14663,7 +14687,7 @@ dependencies = [ [[package]] name = "sp-version" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "impl-serde", "parity-scale-codec", @@ -14680,7 +14704,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -14691,7 +14715,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "21.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -14703,7 +14727,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -14779,7 +14803,7 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "staging-parachain-info" version = "0.16.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14792,7 +14816,7 @@ dependencies = [ [[package]] name = "staging-xcm" version = "14.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "array-bytes", "bounded-collections", @@ -14810,7 +14834,7 @@ dependencies = [ [[package]] name = "staging-xcm-builder" version = "16.0.3" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", @@ -14831,7 +14855,7 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "environmental", "frame-benchmarking", @@ -14952,7 +14976,7 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -14977,7 +15001,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" [[package]] name = "substrate-fixed" @@ -14993,7 +15017,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "38.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "docify", "frame-system-rpc-runtime-api", @@ -15013,7 +15037,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.17.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "http-body-util", "hyper 1.5.1", @@ -15027,7 +15051,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "37.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -15054,7 +15078,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "build-helper", "cargo_metadata", @@ -15601,7 +15625,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "coarsetime", "polkadot-primitives", @@ -15612,7 +15636,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "expander", "proc-macro-crate 3.1.0", @@ -16419,7 +16443,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "binary-merkle-tree", "bitvec", @@ -16525,7 +16549,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "polkadot-primitives", @@ -16934,7 +16958,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "10.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "Inflector", "proc-macro2", @@ -16945,7 +16969,7 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" version = "0.3.1" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "parity-scale-codec", @@ -16959,7 +16983,7 @@ dependencies = [ [[package]] name = "xcm-simulator" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#f2081f6657f011634a483e3a4c91e54150c974c7" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=stable2407#fb9b95d64aa442a1ce6ffba51777243729a783c9" dependencies = [ "frame-support", "frame-system", diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 114836e0fb..3d7e8c27a3 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -254,6 +254,7 @@ cumulus-primitives-parachain-inherent = { git = 'https://github.com/paritytech/p pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false } parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false } parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false } +assets-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false } substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false } diff --git a/parachain/node/src/chain_specs/paseo.rs b/parachain/node/src/chain_specs/paseo.rs index d72874568d..c58585c25d 100644 --- a/parachain/node/src/chain_specs/paseo.rs +++ b/parachain/node/src/chain_specs/paseo.rs @@ -19,8 +19,8 @@ use core_primitives::PASEO_PARA_ID; use cumulus_primitives_core::ParaId; use paseo_parachain_runtime::{ AccountId, AuraId, Balance, BalancesConfig, BitacrossConfig, CouncilMembershipConfig, - DeveloperCommitteeMembershipConfig, ParachainInfoConfig, ParachainStakingConfig, - PolkadotXcmConfig, RuntimeGenesisConfig, SessionConfig, SudoConfig, + DeveloperCommitteeMembershipConfig, OmniBridgeConfig, ParachainInfoConfig, + ParachainStakingConfig, PolkadotXcmConfig, RuntimeGenesisConfig, SessionConfig, SudoConfig, TechnicalCommitteeMembershipConfig, TeebagConfig, TeebagOperationalMode, VCManagementConfig, WASM_BINARY, }; @@ -227,8 +227,12 @@ fn generate_genesis( admin: Some(root_key.clone()), mode: TeebagOperationalMode::Development, }, - bitacross: BitacrossConfig { admin: Some(root_key) }, + bitacross: BitacrossConfig { admin: Some(root_key.clone()) }, score_staking: Default::default(), + omni_bridge: OmniBridgeConfig { + admin: Some(root_key.clone()), + default_relayers: vec![root_key], + }, }; serde_json::to_value(&config).expect("Could not build genesis config") diff --git a/parachain/pallets/omni-bridge/Cargo.toml b/parachain/pallets/omni-bridge/Cargo.toml index ea66440c88..dbe343cec3 100644 --- a/parachain/pallets/omni-bridge/Cargo.toml +++ b/parachain/pallets/omni-bridge/Cargo.toml @@ -12,8 +12,8 @@ scale-info = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } -sp-runtime = { workspace = true } sp-core = { workspace = true } +sp-runtime = { workspace = true } sp-std = { workspace = true } [features] @@ -21,6 +21,7 @@ default = ["std"] runtime-benchmarks = [ "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", ] std = [ "parity-scale-codec/std", @@ -31,4 +32,8 @@ std = [ "frame-support/std", "frame-system/std", ] -try-runtime = ["frame-support/try-runtime"] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 3aa2b389b6..e813ccda25 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -16,22 +16,35 @@ #![cfg_attr(not(feature = "std"), no_std)] -use frame_support::ensure; -use frame_system::ensure_root; -use parity_scale_codec::Codec; -use sp_runtime::traits::AtLeast32BitUnsigned; -use sp_runtime::FixedPointOperand; +use frame_support::{ + pallet_prelude::*, + traits::{ + fungibles::{Balanced, Create, Mutate, Refund}, + tokens::{Balance, Fortitude, Precision, Preservation}, + AccountTouch, + }, + PalletId, +}; +use frame_system::{ensure_root, ensure_signed, pallet_prelude::*}; +use sp_runtime::traits::AccountIdConversion; pub use pallet::*; + +const MODULE_ID: PalletId = PalletId(*b"hm/ombrg"); + +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub enum ForeignChain { + Ethereum(u32), +} + +// We assume "chain + token_symbol" can uniquely identify a foreign asset +pub type ForeignAsset = (ForeignChain, Vec); +pub type Nonce = u64; + #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_system::ensure_signed; - use frame_system::pallet_prelude::OriginFor; - use scale_info::prelude::vec::Vec; - use scale_info::TypeInfo; - use sp_std::{fmt::Debug, prelude::*, vec}; + use sp_std::{prelude::*, vec}; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); @@ -46,18 +59,19 @@ pub mod pallet { /// The overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The units in which we record balances. - type Balance: Parameter - + Member - + AtLeast32BitUnsigned - + Codec - + Default - + Copy - + MaybeSerializeDeserialize - + Debug - + MaxEncodedLen - + TypeInfo - + FixedPointOperand; + /// Treasury account to receive the bridging fee + type TreasuryAccount: Get; + + /// The scalar type of balance of some asset + type Balance: Balance; + + type AssetKind: Parameter + MaxEncodedLen; + + type Assets: Create + + Mutate + + AccountTouch + + Balanced + + Refund; // origin to manage Relayer Admin type SetAdminOrigin: EnsureOrigin; @@ -71,61 +85,172 @@ pub mod pallet { #[pallet::getter(fn relayer)] pub type Relayer = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; + // A map from AssetKind to its metadata + // It's a simplified version of the standard asset metadata + // + // TODO: shall we have an assset registry to store this? + #[pallet::storage] + #[pallet::getter(fn asset_symbol)] + pub type AssetSymbol = + StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn pay_in_nonce)] + pub type PayInNonce = StorageValue<_, Nonce, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn supported_pay_in_pair)] + pub type SupportedPayInPair = + StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, ValueQuery>; + + // TODO: later we can allow pay the fee with other assets + #[pallet::storage] + #[pallet::getter(fn pay_in_fee)] + pub type PayInFee = StorageDoubleMap< + _, + Blake2_128Concat, + T::AssetKind, + Blake2_128Concat, + ForeignChain, + T::Balance, + OptionQuery, + >; + #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { + /// Admins was set + AdminSet { new_admin: Option }, /// Relayer added - RelayerAdded(T::AccountId), + RelayerAdded { relayer: T::AccountId }, /// Relayer removed - RelayerRemoved(T::AccountId), - + RelayerRemoved { relayer: T::AccountId }, + /// Some asset symbl is set + AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, + /// PayIn fee is set + PayInFeeSet { asset: T::AssetKind, dest_chain: ForeignChain, fee: T::Balance }, /// Account paid in tokens, they will be paid out on the other side of the bridge. - PaidIn(T::Balance, Vec), + PaidIn { + from: T::AccountId, + nonce: Nonce, + asset: T::AssetKind, + dest_asset: ForeignAsset, + dest_address: Vec, + amount: T::Balance, + }, /// Tokens were paid out to the account after being paid in on the other side of the bridge. - PaidOut(T::Balance, T::AccountId), - - /// Admins was set - AdminSet { new_admin: Option }, + PaidOut { to: T::AccountId, asset: T::AssetKind, amount: T::Balance }, } #[pallet::error] pub enum Error { RequireAdminOrRoot, - UnknownRelayer, + RequireRelayer, + AssetSymbolNotExist, + PayInNonceOverflow, + PayInPairNotSupported, + PayInFeeNotSet, + PayInAmountTooLow, + } + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub admin: Option, + pub default_relayers: Vec, + } + + impl Default for GenesisConfig { + fn default() -> Self { + Self { admin: None, default_relayers: vec![] } + } + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + if let Some(ref admin) = self.admin { + Admin::::put(admin); + } + for r in &self.default_relayers { + Relayer::::insert(r, ()); + } + } } #[pallet::call] impl Pallet { #[pallet::call_index(0)] - #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn pay_in( - _origin: OriginFor, - balance: T::Balance, - // contains recipient address - call_data: Vec, + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_admin( + origin: OriginFor, + new_admin: T::AccountId, ) -> DispatchResultWithPostInfo { - // check user has amount - // take tokens from user's account - Self::deposit_event(Event::PaidIn(balance, call_data)); - // todo: should pay + T::SetAdminOrigin::ensure_origin(origin)?; + Admin::::put(new_admin.clone()); + Self::deposit_event(Event::AdminSet { new_admin: Some(new_admin) }); Ok(Pays::No.into()) } #[pallet::call_index(1)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::Yes))] + pub fn pay_in( + origin: OriginFor, + asset_id: T::AssetKind, + dest_chain: ForeignChain, + dest_address: Vec, + amount: T::Balance, + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin)?; + let nonce = Self::next_pay_in_nonce()?; + let symbol = AssetSymbol::::get(&asset_id).ok_or(Error::::AssetSymbolNotExist)?; + let foreign_asset: ForeignAsset = (dest_chain.clone(), symbol); + ensure!( + SupportedPayInPair::::get(asset_id.clone()).contains(&foreign_asset), + Error::::PayInPairNotSupported + ); + let fee = PayInFee::::get(asset_id.clone(), dest_chain) + .ok_or(Error::::PayInFeeNotSet)?; + let burn_amount = T::Assets::burn_from( + asset_id.clone(), + &who, + amount, + Preservation::Expendable, + Precision::Exact, + Fortitude::Polite, + )?; + ensure!(burn_amount > fee, Error::::PayInAmountTooLow); + + // TODO: we could define a `OnChargeFee` trait and outsource the fee charging to runtime + T::Assets::mint_into(asset_id.clone(), &T::TreasuryAccount::get(), fee)?; + + Self::deposit_event(Event::PaidIn { + from: who, + nonce, + asset: asset_id, + dest_asset: foreign_asset, + dest_address, + amount: burn_amount - fee, + }); + Ok(().into()) + } + + #[pallet::call_index(2)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn pay_out( origin: OriginFor, - balance: T::Balance, - _recipient: T::AccountId, + to: T::AccountId, + asset_id: T::AssetKind, + amount: T::Balance, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - // check user is an relayer - // add tokens to user account - Self::deposit_event(Event::PaidOut(balance, who)); + ensure!(Self::is_relayer(&who), Error::::RequireRelayer); + + T::Assets::mint_into(asset_id.clone(), &to, amount)?; + Self::deposit_event(Event::PaidOut { to, asset: asset_id, amount }); Ok(Pays::No.into()) } - #[pallet::call_index(2)] + #[pallet::call_index(3)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn add_relayer( origin: OriginFor, @@ -133,32 +258,62 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; Relayer::::insert(relayer.clone(), ()); - Self::deposit_event(Event::RelayerAdded(relayer)); + Self::deposit_event(Event::RelayerAdded { relayer }); Ok(Pays::No.into()) } - #[pallet::call_index(3)] + #[pallet::call_index(4)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn remove_relayer( origin: OriginFor, relayer: T::AccountId, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - ensure!(Relayer::::contains_key(&relayer), Error::::UnknownRelayer); + ensure!(Self::is_relayer(&relayer), Error::::RequireRelayer); Relayer::::remove(relayer.clone()); - Self::deposit_event(Event::RelayerRemoved(relayer)); + Self::deposit_event(Event::RelayerRemoved { relayer }); Ok(Pays::No.into()) } - #[pallet::call_index(4)] + #[pallet::call_index(5)] + #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_pay_in_fee( + origin: OriginFor, + asset_id: T::AssetKind, + dest_chain: ForeignChain, + fee: T::Balance, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + PayInFee::::insert(asset_id.clone(), dest_chain.clone(), fee); + Self::deposit_event(Event::PayInFeeSet { asset: asset_id, dest_chain, fee }); + Ok(Pays::No.into()) + } + + #[pallet::call_index(6)] #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn set_admin( + pub fn create_asset( origin: OriginFor, - new_admin: T::AccountId, + asset_id: T::AssetKind, + is_sufficient: bool, + min_balance: T::Balance, + symbol: Vec, ) -> DispatchResultWithPostInfo { - T::SetAdminOrigin::ensure_origin(origin)?; - Admin::::put(new_admin.clone()); - Self::deposit_event(Event::AdminSet { new_admin: Some(new_admin) }); + Self::ensure_admin_or_root(origin.clone())?; + T::Assets::create(asset_id.clone(), Self::account_id(), is_sufficient, min_balance)?; + Self::set_asset_symbol(origin, asset_id, symbol)?; + Ok(Pays::No.into()) + } + + #[pallet::call_index(7)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_asset_symbol( + origin: OriginFor, + asset_id: T::AssetKind, + symbol: Vec, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + AssetSymbol::::insert(&asset_id, symbol.clone()); + Self::deposit_event(Event::AssetSymbolSet { asset: asset_id, symbol }); Ok(Pays::No.into()) } } @@ -172,5 +327,21 @@ pub mod pallet { ); Ok(()) } + + /// The derived AccountId for the pallet + pub fn account_id() -> T::AccountId { + MODULE_ID.into_account_truncating() + } + + pub fn is_relayer(who: &T::AccountId) -> bool { + Relayer::::contains_key(who) + } + + fn next_pay_in_nonce() -> Result> { + let nonce = Self::pay_in_nonce(); + let nonce = nonce.checked_add(1).ok_or(Error::::PayInNonceOverflow)?; + PayInNonce::::put(nonce); + Ok(nonce) + } } } diff --git a/parachain/runtime/common/Cargo.toml b/parachain/runtime/common/Cargo.toml index d77a81b179..7413fb56d0 100644 --- a/parachain/runtime/common/Cargo.toml +++ b/parachain/runtime/common/Cargo.toml @@ -49,6 +49,7 @@ pallet-asset-manager = { workspace = true } pallet-extrinsic-filter = { workspace = true } pallet-group = { workspace = true } pallet-omni-account = { workspace = true } +pallet-omni-bridge = { workspace = true } pallet-teebag = { workspace = true } [features] @@ -72,6 +73,7 @@ std = [ "pallet-message-queue/std", "pallet-multisig/std", "pallet-omni-account/std", + "pallet-omni-bridge/std", "pallet-teebag/std", "pallet-transaction-payment/std", "pallet-treasury/std", @@ -90,6 +92,8 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + "polkadot-parachain-primitives/std", + "scale-info/std", ] runtime-benchmarks = [ @@ -116,6 +120,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "xcm-executor/runtime-benchmarks", + "pallet-omni-bridge/runtime-benchmarks", ] try-runtime = [ @@ -140,6 +145,7 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-parachains/try-runtime", "sp-runtime/try-runtime", + "pallet-omni-bridge/try-runtime", ] tests = ["std", "xcm-simulator"] diff --git a/parachain/runtime/common/src/lib.rs b/parachain/runtime/common/src/lib.rs index e7f498b08e..1379667701 100644 --- a/parachain/runtime/common/src/lib.rs +++ b/parachain/runtime/common/src/lib.rs @@ -301,3 +301,31 @@ where } pub type EnsureOmniAccount = pallet_omni_account::EnsureOmniAccount; + +pub struct EnsureOmniBridgeRelayer(PhantomData); +impl EnsureOrigin for EnsureOmniBridgeRelayer +where + T: frame_system::Config + pallet_omni_bridge::Config, + ::AccountId: From<[u8; 32]>, + ::Hash: From<[u8; 32]>, +{ + type Success = T::AccountId; + fn try_origin(o: T::RuntimeOrigin) -> Result { + o.into().and_then(|o| match o { + frame_system::RawOrigin::Signed(who) + if pallet_omni_bridge::Relayer::::contains_key(&who) => + { + Ok(who) + }, + r => Err(T::RuntimeOrigin::from(r)), + }) + } + + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + let zero_account_id = + T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) + .expect("infinite length input; no invalid inputs for type; qed"); + Ok((RawOrigin::OmniAccount(zero_account_id)).into()) + } +} diff --git a/parachain/runtime/litentry/src/asset_config.rs b/parachain/runtime/litentry/src/asset_config.rs index 535a05c253..b47c56a1a4 100644 --- a/parachain/runtime/litentry/src/asset_config.rs +++ b/parachain/runtime/litentry/src/asset_config.rs @@ -14,9 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Litentry. If not, see . -use super::{ - weights, AccountId, AssetId, Balance, Balances, Runtime, RuntimeEvent, TreasuryPalletId, -}; +use super::{weights, AccountId, AssetId, Balance, Balances, Runtime, RuntimeEvent}; use crate::{ constants::currency::deposit, precompiles::ASSET_PRECOMPILE_ADDRESS_PREFIX, Decode, Encode, }; @@ -33,7 +31,6 @@ use runtime_common::{ }; use scale_info::TypeInfo; use sp_core::{ConstU128, H160}; -use sp_runtime::traits::AccountIdConversion; use sp_std::prelude::*; pub fn get_all_module_accounts() -> Vec { @@ -51,10 +48,6 @@ impl> pallet_assets::BenchmarkHelper. use super::{ - weights, AccountId, AssetId, Balance, Balances, Runtime, RuntimeEvent, TreasuryPalletId, + weights, AccountId, AssetId, Balance, Balances, EnsureRootOrAllTechnicalCommittee, Runtime, + RuntimeEvent, }; use crate::{ constants::currency::deposit, precompiles::ASSET_PRECOMPILE_ADDRESS_PREFIX, Decode, Encode, @@ -24,16 +25,11 @@ use frame_support::{ parameter_types, traits::{AsEnsureOriginWithArg, ConstU32, NeverEnsureOrigin}, }; -use frame_system::EnsureRoot; use pallet_evm_precompile_assets_erc20::AddressToAssetId; use parity_scale_codec::Compact; -use runtime_common::{ - currency::{DOLLARS, EXISTENTIAL_DEPOSIT}, - EnsureRootOrHalfCouncil, -}; +use runtime_common::currency::{DOLLARS, EXISTENTIAL_DEPOSIT}; use scale_info::TypeInfo; use sp_core::{ConstU128, H160}; -use sp_runtime::traits::AccountIdConversion; use sp_std::prelude::*; pub fn get_all_module_accounts() -> Vec { @@ -51,10 +47,6 @@ impl> pallet_assets::BenchmarkHelper>; - type ForceOrigin = EnsureRoot; + type CreateOrigin = AsEnsureOriginWithArg>; // will be created internally for now + type ForceOrigin = EnsureRootOrAllTechnicalCommittee; type AssetDeposit = AssetDeposit; type MetadataDepositBase = MetadataDepositBase; type MetadataDepositPerByte = MetadataDepositPerByte; @@ -102,7 +92,7 @@ impl pallet_assets::Config for Runtime { type StringLimit = AssetsStringLimit; type Freezer = (); type Extra = (); - type WeightInfo = pallet_assets::weights::SubstrateWeight; + type WeightInfo = (); type RemoveItemsLimit = ConstU32<1000>; type AssetIdParameter = Compact; type CallbackHandle = (); @@ -120,7 +110,7 @@ impl pallet_asset_manager::Config for Runtime { type Balance = Balance; type AssetId = AssetId; type ForeignAssetType = ForeignAssetType; // TODO - type ForeignAssetModifierOrigin = EnsureRootOrHalfCouncil; + type ForeignAssetModifierOrigin = EnsureRootOrAllTechnicalCommittee; type Currency = Balances; type WeightInfo = weights::pallet_asset_manager::WeightInfo; } diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index 1bef6a888b..c25067d415 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -32,7 +32,7 @@ use frame_support::{ genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ - fungible::{Balanced, Credit, HoldConsideration}, + fungible::{self, Balanced, Credit, HoldConsideration, NativeFromLeft, NativeOrWithId}, tokens::imbalance::ResolveTo, tokens::{PayFromAccount, UnityAssetBalanceConversion}, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, Contains, ContainsLengthBound, @@ -721,7 +721,7 @@ impl pallet_treasury::Config for Runtime { type BurnDestination = (); type SpendFunds = Bounties; type MaxApprovals = ConstU32<64>; - type AssetKind = (); // Only native asset is supported + type AssetKind = (); // Only native asset is supported - TODO: expand it to MultiAssets when required type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; type Paymaster = PayFromAccount>; @@ -1255,8 +1255,12 @@ impl pallet_omni_account::Config for Runtime { impl pallet_omni_bridge::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type Balance = u64; - type SetAdminOrigin = EnsureRootOrAllCouncil; + type Balance = Balance; + type AssetKind = NativeOrWithId; // No XCM assets for now + type Assets = + fungible::UnionOf, AccountId>; + type TreasuryAccount = TreasuryAccount; + type SetAdminOrigin = EnsureRootOrHalfCouncil; } impl pallet_bitacross::Config for Runtime { From 6bafa2e9e859624c5dfd6771a9e4c4179a8263bf Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Thu, 2 Jan 2025 18:01:47 +0000 Subject: [PATCH 06/16] some comment --- parachain/pallets/omni-bridge/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index e813ccda25..4927271969 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -34,7 +34,7 @@ const MODULE_ID: PalletId = PalletId(*b"hm/ombrg"); #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub enum ForeignChain { - Ethereum(u32), + Ethereum(u32), // chain id } // We assume "chain + token_symbol" can uniquely identify a foreign asset From e04970b2876a0d7df8c1da33d639347c7b785ace Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Fri, 3 Jan 2025 01:59:37 +0000 Subject: [PATCH 07/16] Add payout proposal --- parachain/pallets/omni-bridge/src/lib.rs | 290 ++++++++++++++++++++--- 1 file changed, 252 insertions(+), 38 deletions(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 4927271969..115db9161d 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -15,6 +15,7 @@ // along with Litentry. If not, see . #![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::too_many_arguments)] use frame_support::{ pallet_prelude::*, @@ -27,10 +28,12 @@ use frame_support::{ }; use frame_system::{ensure_root, ensure_signed, pallet_prelude::*}; use sp_runtime::traits::AccountIdConversion; +use sp_std::{prelude::*, vec}; pub use pallet::*; const MODULE_ID: PalletId = PalletId(*b"hm/ombrg"); +const DEFAULT_RELAYER_THRESHOLD: u32 = 1; #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub enum ForeignChain { @@ -41,10 +44,31 @@ pub enum ForeignChain { pub type ForeignAsset = (ForeignChain, Vec); pub type Nonce = u64; +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct PayInRequest { + pub asset: AssetKind, + pub dest_chain: ForeignChain, + pub dest_address: Vec, + pub amount: Balance, +} + +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct PayOutRequest { + pub to: AccountId, + pub asset: AssetKind, + pub amount: Balance, +} + +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct PayOutProposal { + pub req: PayOutRequest, + pub ayes: Vec, + pub nays: Vec, +} + #[frame_support::pallet] pub mod pallet { use super::*; - use sp_std::{prelude::*, vec}; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); @@ -83,7 +107,16 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn relayer)] - pub type Relayer = StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>; + pub type Relayer = CountedStorageMap<_, Twox64Concat, T::AccountId, (), OptionQuery>; + + #[pallet::type_value] + pub fn DefaultRelayerThresholdValue() -> u32 { + DEFAULT_RELAYER_THRESHOLD + } + + #[pallet::storage] + #[pallet::getter(fn relayer_threshold)] + pub type RelayerThreshold = StorageValue<_, u32, ValueQuery, DefaultRelayerThresholdValue>; // A map from AssetKind to its metadata // It's a simplified version of the standard asset metadata @@ -94,10 +127,6 @@ pub mod pallet { pub type AssetSymbol = StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, OptionQuery>; - #[pallet::storage] - #[pallet::getter(fn pay_in_nonce)] - pub type PayInNonce = StorageValue<_, Nonce, ValueQuery>; - #[pallet::storage] #[pallet::getter(fn supported_pay_in_pair)] pub type SupportedPayInPair = @@ -116,6 +145,51 @@ pub mod pallet { OptionQuery, >; + #[pallet::storage] + #[pallet::getter(fn pay_in_nonce)] + pub type PayInNonce = StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + + /// Per-relayer nonce for a given `ForeignChain`. + /// + /// Payout request with smaller or equal nonce has been processed by this specific relayer already + /// and thus should be ignored by this relayer. + /// + /// This nonce mechanism relies on the monotonically increased nonce submitted from relayers, so + /// relayers must submit payout requests in the same order as foreign chain emits the requests. + /// Out of order may cause loss of payout requests. + #[pallet::storage] + #[pallet::getter(fn relayer_pay_out_nonce)] + pub type RelayerPayOutNonce = StorageDoubleMap< + _, + Twox64Concat, + T::AccountId, + Twox64Concat, + ForeignChain, + Nonce, + ValueQuery, + >; + + /// Finalized (global) nonce for a given `ForeignChain`. + /// + /// Payout request with smaller or equal nonce has been finalized already and thus should be ignored + /// by all relayers. + #[pallet::storage] + #[pallet::getter(fn finalized_pay_out_nonce)] + pub type FinalizedPayOutNonce = + StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn pay_out_proposals)] + pub type PayOutProposals = StorageDoubleMap< + _, + Twox64Concat, + ForeignChain, + Twox64Concat, + Nonce, + PayOutProposal, + OptionQuery, + >; + #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { @@ -125,6 +199,8 @@ pub mod pallet { RelayerAdded { relayer: T::AccountId }, /// Relayer removed RelayerRemoved { relayer: T::AccountId }, + /// Relayer threshold set + RelayerThresholdSet { threshold: u32 }, /// Some asset symbl is set AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, /// PayIn fee is set @@ -138,19 +214,51 @@ pub mod pallet { dest_address: Vec, amount: T::Balance, }, - /// Tokens were paid out to the account after being paid in on the other side of the bridge. - PaidOut { to: T::AccountId, asset: T::AssetKind, amount: T::Balance }, + /// Some payout request is proposed and awaits other relayers' votes + PayOutProposed { + who: T::AccountId, // relayer + aye: bool, + to: T::AccountId, + nonce: Nonce, + asset: T::AssetKind, + source_asset: ForeignAsset, // to track bridging same type of token from different chains + source_address: Vec, // TODO: tracking purpose - might not be necessary + amount: T::Balance, + }, + /// Some payout request is rejected + PayOutRejected { + to: T::AccountId, + nonce: Nonce, + asset: T::AssetKind, + source_asset: ForeignAsset, // to track bridging same type of token from different chains + source_address: Vec, // TODO: tracking purpose - might not be necessary + amount: T::Balance, + }, + /// Some payout request is successfully executed + PaidOut { + to: T::AccountId, + nonce: Nonce, + asset: T::AssetKind, + source_asset: ForeignAsset, // to track bridging same type of token from different chains + source_address: Vec, // TODO: tracking purpose - might not be necessary + amount: T::Balance, + }, } #[pallet::error] pub enum Error { RequireAdminOrRoot, RequireRelayer, + ThresholdInvalid, AssetSymbolNotExist, + AssetSymbolInvalid, PayInNonceOverflow, PayInPairNotSupported, PayInFeeNotSet, PayInAmountTooLow, + PayOutNonceAlreadyProcessedByRelayer, + PayOutNonceAlreadyFinalized, + PayOutRequestMismatch, } #[pallet::genesis_config] @@ -195,25 +303,23 @@ pub mod pallet { #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::Yes))] pub fn pay_in( origin: OriginFor, - asset_id: T::AssetKind, - dest_chain: ForeignChain, - dest_address: Vec, - amount: T::Balance, + req: PayInRequest, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - let nonce = Self::next_pay_in_nonce()?; - let symbol = AssetSymbol::::get(&asset_id).ok_or(Error::::AssetSymbolNotExist)?; - let foreign_asset: ForeignAsset = (dest_chain.clone(), symbol); + let nonce = Self::next_pay_in_nonce(&req.dest_chain)?; + let symbol = + AssetSymbol::::get(&req.asset).ok_or(Error::::AssetSymbolNotExist)?; + let foreign_asset: ForeignAsset = (req.dest_chain.clone(), symbol); ensure!( - SupportedPayInPair::::get(asset_id.clone()).contains(&foreign_asset), + SupportedPayInPair::::get(req.asset.clone()).contains(&foreign_asset), Error::::PayInPairNotSupported ); - let fee = PayInFee::::get(asset_id.clone(), dest_chain) + let fee = PayInFee::::get(req.asset.clone(), req.dest_chain) .ok_or(Error::::PayInFeeNotSet)?; let burn_amount = T::Assets::burn_from( - asset_id.clone(), + req.asset.clone(), &who, - amount, + req.amount, Preservation::Expendable, Precision::Exact, Fortitude::Polite, @@ -221,14 +327,14 @@ pub mod pallet { ensure!(burn_amount > fee, Error::::PayInAmountTooLow); // TODO: we could define a `OnChargeFee` trait and outsource the fee charging to runtime - T::Assets::mint_into(asset_id.clone(), &T::TreasuryAccount::get(), fee)?; + T::Assets::mint_into(req.asset.clone(), &T::TreasuryAccount::get(), fee)?; Self::deposit_event(Event::PaidIn { from: who, nonce, - asset: asset_id, + asset: req.asset, dest_asset: foreign_asset, - dest_address, + dest_address: req.dest_address, amount: burn_amount - fee, }); Ok(().into()) @@ -236,17 +342,85 @@ pub mod pallet { #[pallet::call_index(2)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn pay_out( + pub fn propose_pay_out( origin: OriginFor, + source_asset: ForeignAsset, + source_address: Vec, + nonce: Nonce, to: T::AccountId, - asset_id: T::AssetKind, + asset: T::AssetKind, amount: T::Balance, + aye: bool, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::RequireRelayer); + let symbol = AssetSymbol::::get(&asset).ok_or(Error::::AssetSymbolNotExist)?; + ensure!(symbol == source_asset.1, Error::::AssetSymbolInvalid); + // we can't require nonce == finalized_pay_out_nonce + 1, as a relayer could be way ahead + // of finalized payout nonce + ensure!( + nonce > FinalizedPayOutNonce::::get(&source_asset.0), + Error::::PayOutNonceAlreadyFinalized + ); + ensure!( + nonce > RelayerPayOutNonce::::get(&who, &source_asset.0), + Error::::PayOutNonceAlreadyProcessedByRelayer + ); + + let threshold = Self::relayer_threshold(); + let total = Relayer::::count(); + + if threshold == 1 && aye { + // update per-relayer payout nonce + RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); + // immediately do the payout + Self::do_pay_out(source_asset, source_address, nonce, to, asset, amount)?; + } else { + let req = PayOutRequest { to: to.clone(), asset: asset.clone(), amount }; + let mut prop = match PayOutProposals::::get(&source_asset.0, nonce) { + Some(p) => p, + None => PayOutProposal { req: req.clone(), ayes: vec![], nays: vec![] }, + }; + + // TODO: what if the faulty relayer creates the entry first? + // righteous relayers won't have a chance to fix it + ensure!(req == prop.req, Error::::PayOutRequestMismatch); + + // TODO: what if this relayer voted already? + if aye { + prop.ayes.push(who.clone()); + } else { + prop.nays.push(who.clone()); + } + // update per-relayer payout nonce + RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); + + // Try to finalize + if prop.ayes.len() >= threshold as usize { + Self::do_pay_out(source_asset, source_address, nonce, to, asset, amount)?; + } else if total >= threshold && prop.nays.len() as u32 + threshold > total { + Self::deposit_event(Event::PayOutRejected { + to, + nonce, + asset, + source_asset, + source_address, + amount, + }); + } else { + Self::deposit_event(Event::PayOutProposed { + who: who.clone(), + aye, + to, + nonce, + asset, + source_asset, + source_address, + amount, + }); + } + } - T::Assets::mint_into(asset_id.clone(), &to, amount)?; - Self::deposit_event(Event::PaidOut { to, asset: asset_id, amount }); Ok(Pays::No.into()) } @@ -279,13 +453,13 @@ pub mod pallet { #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn set_pay_in_fee( origin: OriginFor, - asset_id: T::AssetKind, + asset: T::AssetKind, dest_chain: ForeignChain, fee: T::Balance, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - PayInFee::::insert(asset_id.clone(), dest_chain.clone(), fee); - Self::deposit_event(Event::PayInFeeSet { asset: asset_id, dest_chain, fee }); + PayInFee::::insert(asset.clone(), dest_chain.clone(), fee); + Self::deposit_event(Event::PayInFeeSet { asset, dest_chain, fee }); Ok(Pays::No.into()) } @@ -293,14 +467,14 @@ pub mod pallet { #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn create_asset( origin: OriginFor, - asset_id: T::AssetKind, + asset: T::AssetKind, is_sufficient: bool, min_balance: T::Balance, symbol: Vec, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin.clone())?; - T::Assets::create(asset_id.clone(), Self::account_id(), is_sufficient, min_balance)?; - Self::set_asset_symbol(origin, asset_id, symbol)?; + T::Assets::create(asset.clone(), Self::account_id(), is_sufficient, min_balance)?; + Self::set_asset_symbol(origin, asset, symbol)?; Ok(Pays::No.into()) } @@ -308,12 +482,25 @@ pub mod pallet { #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn set_asset_symbol( origin: OriginFor, - asset_id: T::AssetKind, + asset: T::AssetKind, symbol: Vec, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - AssetSymbol::::insert(&asset_id, symbol.clone()); - Self::deposit_event(Event::AssetSymbolSet { asset: asset_id, symbol }); + AssetSymbol::::insert(&asset, symbol.clone()); + Self::deposit_event(Event::AssetSymbolSet { asset, symbol }); + Ok(Pays::No.into()) + } + + #[pallet::call_index(8)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn set_relayer_threshold( + origin: OriginFor, + threshold: u32, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + ensure!(threshold > 0, Error::::ThresholdInvalid); + RelayerThreshold::::put(threshold); + Self::deposit_event(Event::RelayerThresholdSet { threshold }); Ok(Pays::No.into()) } } @@ -337,11 +524,38 @@ pub mod pallet { Relayer::::contains_key(who) } - fn next_pay_in_nonce() -> Result> { - let nonce = Self::pay_in_nonce(); + fn next_pay_in_nonce(chain: &ForeignChain) -> Result> { + let nonce = Self::pay_in_nonce(chain); let nonce = nonce.checked_add(1).ok_or(Error::::PayInNonceOverflow)?; - PayInNonce::::put(nonce); + PayInNonce::::insert(chain, nonce); Ok(nonce) } + + fn do_pay_out( + source_asset: ForeignAsset, + source_address: Vec, + nonce: Nonce, + to: T::AccountId, + asset: T::AssetKind, + amount: T::Balance, + ) -> DispatchResult { + // update finalized payout nonce + FinalizedPayOutNonce::::insert(&source_asset.0, nonce); + // do actual payout + T::Assets::mint_into(asset.clone(), &to, amount)?; + // remove it from proposal pool if exists + if PayOutProposals::::get(&source_asset.0, nonce).is_some() { + PayOutProposals::::remove(&source_asset.0, nonce) + } + Self::deposit_event(Event::PaidOut { + to, + nonce, + asset, + source_asset, + source_address, + amount, + }); + Ok(()) + } } } From a2abed4445883ac604b9dae61bf65f5a62c94958 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Fri, 3 Jan 2025 02:03:02 +0000 Subject: [PATCH 08/16] comment --- parachain/pallets/omni-bridge/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 115db9161d..157f4f71cb 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -44,6 +44,7 @@ pub enum ForeignChain { pub type ForeignAsset = (ForeignChain, Vec); pub type Nonce = u64; +// payin request by user (from user to foreign chain) - better name? #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct PayInRequest { pub asset: AssetKind, @@ -52,6 +53,7 @@ pub struct PayInRequest { pub amount: Balance, } +// payout request by relayer (from foreign chain to user) - better name? #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct PayOutRequest { pub to: AccountId, From aed7566f607ee98e0d34d96ea09073cdc1f465bb Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Fri, 3 Jan 2025 19:10:07 +0000 Subject: [PATCH 09/16] add more ext --- parachain/pallets/omni-bridge/src/lib.rs | 54 +++++++++++++++++++++--- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 157f4f71cb..c096eee195 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -130,9 +130,16 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, OptionQuery>; #[pallet::storage] - #[pallet::getter(fn supported_pay_in_pair)] - pub type SupportedPayInPair = - StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, ValueQuery>; + #[pallet::getter(fn pay_in_pair)] + pub type PayInPair = StorageDoubleMap< + _, + Blake2_128Concat, + T::AssetKind, + Blake2_128Concat, + ForeignAsset, + (), + OptionQuery, + >; // TODO: later we can allow pay the fee with other assets #[pallet::storage] @@ -203,6 +210,10 @@ pub mod pallet { RelayerRemoved { relayer: T::AccountId }, /// Relayer threshold set RelayerThresholdSet { threshold: u32 }, + /// Some pay in pair is added + PayInPairAdded { asset: T::AssetKind, foreign_asset: ForeignAsset }, + /// Some pay in pair is removed + PayInPairRemoved { asset: T::AssetKind, foreign_asset: ForeignAsset }, /// Some asset symbl is set AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, /// PayIn fee is set @@ -255,7 +266,8 @@ pub mod pallet { AssetSymbolNotExist, AssetSymbolInvalid, PayInNonceOverflow, - PayInPairNotSupported, + PayInPairNotAllowed, + PayInPairNotExist, PayInFeeNotSet, PayInAmountTooLow, PayOutNonceAlreadyProcessedByRelayer, @@ -313,8 +325,8 @@ pub mod pallet { AssetSymbol::::get(&req.asset).ok_or(Error::::AssetSymbolNotExist)?; let foreign_asset: ForeignAsset = (req.dest_chain.clone(), symbol); ensure!( - SupportedPayInPair::::get(req.asset.clone()).contains(&foreign_asset), - Error::::PayInPairNotSupported + PayInPair::::get(&req.asset, &foreign_asset).is_some(), + Error::::PayInPairNotAllowed ); let fee = PayInFee::::get(req.asset.clone(), req.dest_chain) .ok_or(Error::::PayInFeeNotSet)?; @@ -505,6 +517,36 @@ pub mod pallet { Self::deposit_event(Event::RelayerThresholdSet { threshold }); Ok(Pays::No.into()) } + + #[pallet::call_index(9)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn add_pay_in_pair( + origin: OriginFor, + asset: T::AssetKind, + foreign_asset: ForeignAsset, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + PayInPair::::insert(&asset, &foreign_asset, ()); + Self::deposit_event(Event::PayInPairAdded { asset, foreign_asset }); + Ok(Pays::No.into()) + } + + #[pallet::call_index(10)] + #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] + pub fn remove_pay_in_pair( + origin: OriginFor, + asset: T::AssetKind, + foreign_asset: ForeignAsset, + ) -> DispatchResultWithPostInfo { + Self::ensure_admin_or_root(origin)?; + ensure!( + PayInPair::::get(&asset, &foreign_asset).is_some(), + Error::::PayInPairNotExist + ); + PayInPair::::remove(&asset, &foreign_asset); + Self::deposit_event(Event::PayInPairRemoved { asset, foreign_asset }); + Ok(Pays::No.into()) + } } impl Pallet { From 5075f7a4ceb6531a8a12252fd771ba8551bb9cf8 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Fri, 3 Jan 2025 21:31:50 +0000 Subject: [PATCH 10/16] fix bugs --- parachain/pallets/omni-bridge/src/lib.rs | 76 +++++++++++++++--------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index c096eee195..da27658a28 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -205,9 +205,9 @@ pub mod pallet { /// Admins was set AdminSet { new_admin: Option }, /// Relayer added - RelayerAdded { relayer: T::AccountId }, + RelayerAdded { who: T::AccountId }, /// Relayer removed - RelayerRemoved { relayer: T::AccountId }, + RelayerRemoved { who: T::AccountId }, /// Relayer threshold set RelayerThresholdSet { threshold: u32 }, /// Some pay in pair is added @@ -218,6 +218,10 @@ pub mod pallet { AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, /// PayIn fee is set PayInFeeSet { asset: T::AssetKind, dest_chain: ForeignChain, fee: T::Balance }, + /// The payout nonce for a specific relayer is updated + RelayerPayOutNonceUpdated { who: T::AccountId, source_chain: ForeignChain, nonce: Nonce }, + /// The payout nonce for global finalization is updated + FinalizedPayOutNonceUpdated { source_chain: ForeignChain, nonce: Nonce }, /// Account paid in tokens, they will be paid out on the other side of the bridge. PaidIn { from: T::AccountId, @@ -385,10 +389,9 @@ pub mod pallet { let total = Relayer::::count(); if threshold == 1 && aye { - // update per-relayer payout nonce - RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); - // immediately do the payout - Self::do_pay_out(source_asset, source_address, nonce, to, asset, amount)?; + // immediately do and finalize the payout + Self::do_pay_out(source_asset.clone(), source_address, nonce, to, asset, amount)?; + Self::finalize_pay_out(source_asset.0.clone(), nonce); } else { let req = PayOutRequest { to: to.clone(), asset: asset.clone(), amount }; let mut prop = match PayOutProposals::::get(&source_asset.0, nonce) { @@ -406,47 +409,61 @@ pub mod pallet { } else { prop.nays.push(who.clone()); } - // update per-relayer payout nonce - RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); - // Try to finalize if prop.ayes.len() >= threshold as usize { - Self::do_pay_out(source_asset, source_address, nonce, to, asset, amount)?; + // prop is approved, do and finalize the pay out + Self::do_pay_out( + source_asset.clone(), + source_address, + nonce, + to, + asset, + amount, + )?; + Self::finalize_pay_out(source_asset.0.clone(), nonce); } else if total >= threshold && prop.nays.len() as u32 + threshold > total { + // prop is rejected, finalize the pay out Self::deposit_event(Event::PayOutRejected { to, nonce, asset, - source_asset, + source_asset: source_asset.clone(), source_address, amount, }); + Self::finalize_pay_out(source_asset.0.clone(), nonce); } else { + // prop is pending, we probably need to wait for tallother relayers Self::deposit_event(Event::PayOutProposed { who: who.clone(), aye, to, nonce, asset, - source_asset, + source_asset: source_asset.clone(), source_address, amount, }); } } + // update per-relayer payout nonce + RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); + Self::deposit_event(Event::RelayerPayOutNonceUpdated { + who, + source_chain: source_asset.0, + nonce, + }); + Ok(Pays::No.into()) } #[pallet::call_index(3)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn add_relayer( - origin: OriginFor, - relayer: T::AccountId, - ) -> DispatchResultWithPostInfo { + pub fn add_relayer(origin: OriginFor, who: T::AccountId) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - Relayer::::insert(relayer.clone(), ()); - Self::deposit_event(Event::RelayerAdded { relayer }); + Relayer::::insert(who.clone(), ()); + Self::deposit_event(Event::RelayerAdded { who }); Ok(Pays::No.into()) } @@ -454,12 +471,12 @@ pub mod pallet { #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn remove_relayer( origin: OriginFor, - relayer: T::AccountId, + who: T::AccountId, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - ensure!(Self::is_relayer(&relayer), Error::::RequireRelayer); - Relayer::::remove(relayer.clone()); - Self::deposit_event(Event::RelayerRemoved { relayer }); + ensure!(Self::is_relayer(&who), Error::::RequireRelayer); + Relayer::::remove(who.clone()); + Self::deposit_event(Event::RelayerRemoved { who }); Ok(Pays::No.into()) } @@ -575,6 +592,15 @@ pub mod pallet { Ok(nonce) } + fn finalize_pay_out(source_chain: ForeignChain, nonce: Nonce) { + FinalizedPayOutNonce::::insert(&source_chain, nonce); + // remove it from proposal pool if exists + if PayOutProposals::::get(&source_chain, nonce).is_some() { + PayOutProposals::::remove(&source_chain, nonce); + } + Self::deposit_event(Event::FinalizedPayOutNonceUpdated { source_chain, nonce }); + } + fn do_pay_out( source_asset: ForeignAsset, source_address: Vec, @@ -583,14 +609,8 @@ pub mod pallet { asset: T::AssetKind, amount: T::Balance, ) -> DispatchResult { - // update finalized payout nonce - FinalizedPayOutNonce::::insert(&source_asset.0, nonce); // do actual payout T::Assets::mint_into(asset.clone(), &to, amount)?; - // remove it from proposal pool if exists - if PayOutProposals::::get(&source_asset.0, nonce).is_some() { - PayOutProposals::::remove(&source_asset.0, nonce) - } Self::deposit_event(Event::PaidOut { to, nonce, From 21542a86f7e668b807e472c83b3da5945f35a987 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Sat, 4 Jan 2025 21:51:27 +0000 Subject: [PATCH 11/16] init tests --- parachain/Cargo.lock | 5 + parachain/pallets/omni-bridge/Cargo.toml | 8 + parachain/pallets/omni-bridge/src/lib.rs | 8 + parachain/pallets/omni-bridge/src/mock.rs | 231 +++++++++++++++++++++ parachain/pallets/omni-bridge/src/tests.rs | 144 +++++++++++++ 5 files changed, 396 insertions(+) create mode 100644 parachain/pallets/omni-bridge/src/mock.rs create mode 100644 parachain/pallets/omni-bridge/src/tests.rs diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index a211cc5aab..2fd46a398c 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -8533,9 +8533,14 @@ version = "0.1.0" dependencies = [ "frame-support", "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-core", + "sp-io", + "sp-keyring", "sp-runtime", "sp-std", ] diff --git a/parachain/pallets/omni-bridge/Cargo.toml b/parachain/pallets/omni-bridge/Cargo.toml index dbe343cec3..a156836d6e 100644 --- a/parachain/pallets/omni-bridge/Cargo.toml +++ b/parachain/pallets/omni-bridge/Cargo.toml @@ -16,6 +16,14 @@ sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } +[dev-dependencies] +sp-keyring = { workspace = true } +sp-io = { workspace = true, features = ["std"] } +frame-system = { workspace = true, features = ["std"] } +pallet-assets = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } + [features] default = ["std"] runtime-benchmarks = [ diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index da27658a28..4ab59f20d6 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -32,6 +32,12 @@ use sp_std::{prelude::*, vec}; pub use pallet::*; +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + const MODULE_ID: PalletId = PalletId(*b"hm/ombrg"); const DEFAULT_RELAYER_THRESHOLD: u32 = 1; @@ -45,6 +51,8 @@ pub type ForeignAsset = (ForeignChain, Vec); pub type Nonce = u64; // payin request by user (from user to foreign chain) - better name? +// note the asset symbol is retrieved by lookup, not as parameter, it +// prevents mismatch between given and registered asset symbol #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct PayInRequest { pub asset: AssetKind, diff --git a/parachain/pallets/omni-bridge/src/mock.rs b/parachain/pallets/omni-bridge/src/mock.rs new file mode 100644 index 0000000000..609517ff16 --- /dev/null +++ b/parachain/pallets/omni-bridge/src/mock.rs @@ -0,0 +1,231 @@ +// Copyright 2020-2024 Trust Computing GmbH. +// This file is part of Litentry. +// +// Litentry is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Litentry is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Litentry. If not, see . + +use crate::{self as pallet_omni_bridge, ForeignAsset, ForeignChain, PayInRequest, PayOutRequest}; +pub use frame_support::{ + assert_ok, derive_impl, parameter_types, + traits::{ + fungible::{self, NativeFromLeft, NativeOrWithId}, + AsEnsureOriginWithArg, ConstU32, ConstU64, + }, +}; +use sp_keyring::AccountKeyring; +use sp_runtime::{ + traits::{IdentifyAccount, IdentityLookup, Verify}, + BuildStorage, +}; + +pub type Signature = sp_runtime::MultiSignature; +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; +pub type Balance = u64; +pub type AssetId = u32; + +pub const TEST_ASSET: AssetId = 1; + +pub fn alice() -> AccountId { + AccountKeyring::Alice.to_account_id() +} + +pub fn bob() -> AccountId { + AccountKeyring::Bob.to_account_id() +} + +pub fn charlie() -> AccountId { + AccountKeyring::Charlie.to_account_id() +} + +pub fn dave() -> AccountId { + AccountKeyring::Dave.to_account_id() +} + +pub fn native_pay_in_request() -> PayInRequest, Balance> { + new_pay_in_request(NativeOrWithId::Native, 10) +} + +pub fn asset_pay_in_request() -> PayInRequest, Balance> { + new_pay_in_request(NativeOrWithId::WithId(TEST_ASSET), 10) +} + +pub fn native_symbol() -> Vec { + b"HEI".to_vec() +} + +pub fn asset_symbol() -> Vec { + b"TST".to_vec() +} + +pub fn foreign_chain() -> ForeignChain { + ForeignChain::Ethereum(0) +} + +pub fn native_pay_out_request() -> PayOutRequest, Balance> { + new_pay_out_request(NativeOrWithId::Native, 10) +} + +pub fn asset_pay_out_request() -> PayOutRequest, Balance> { + new_pay_out_request(NativeOrWithId::WithId(TEST_ASSET), 10) +} + +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + Balances: pallet_balances, + Timestamp: pallet_timestamp, + Assets: pallet_assets, + OmniBridge: pallet_omni_bridge, + } +); + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Test { + type AccountId = AccountId; + type Block = frame_system::mocking::MockBlock; + type AccountData = pallet_balances::AccountData; + type Lookup = IdentityLookup; +} + +parameter_types! { + pub const ExistentialDeposit: Balance = 1; +} + +#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] +impl pallet_balances::Config for Test { + type Balance = Balance; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; +} + +impl pallet_timestamp::Config for Test { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = ConstU64<10000>; + type WeightInfo = (); +} + +impl pallet_assets::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetId = AssetId; + type AssetIdParameter = AssetId; + type Currency = Balances; + type CreateOrigin = AsEnsureOriginWithArg>; + type ForceOrigin = frame_system::EnsureRoot; + type AssetDeposit = ConstU64<1>; + type AssetAccountDeposit = ConstU64<10>; + type MetadataDepositBase = ConstU64<1>; + type MetadataDepositPerByte = ConstU64<1>; + type ApprovalDeposit = ConstU64<1>; + type StringLimit = ConstU32<50>; + type Freezer = (); + type WeightInfo = (); + type CallbackHandle = (); + type Extra = (); + type RemoveItemsLimit = ConstU32<5>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + +parameter_types! { + pub TreasuryAccount: AccountId = dave(); // Dave as the treasury +} + +// Keep it same as real runtime +impl pallet_omni_bridge::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type AssetKind = NativeOrWithId; + type Assets = + fungible::UnionOf, AccountId>; + type TreasuryAccount = TreasuryAccount; + type SetAdminOrigin = frame_system::EnsureRoot; +} + +pub fn new_test_ext(should_init: bool) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![(alice(), 50), (bob(), 50), (charlie(), 50)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext: sp_io::TestExternalities = t.into(); + ext.execute_with(|| { + System::set_block_number(1); + assert_ok!(OmniBridge::set_admin(RuntimeOrigin::root(), alice())); + assert_ok!(OmniBridge::add_relayer(RuntimeOrigin::signed(alice()), alice())); + assert_ok!(OmniBridge::add_relayer(RuntimeOrigin::signed(alice()), bob())); + assert_ok!(OmniBridge::add_relayer(RuntimeOrigin::signed(alice()), charlie())); + assert_ok!(Assets::force_create(RuntimeOrigin::root(), TEST_ASSET, bob(), true, 1)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(bob()), TEST_ASSET, alice(), 100)); + assert_ok!(Assets::mint(RuntimeOrigin::signed(bob()), TEST_ASSET, bob(), 100)); + + if should_init { + assert_ok!(OmniBridge::set_asset_symbol( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + native_symbol() + )); + assert_ok!(OmniBridge::add_pay_in_pair( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + (foreign_chain(), native_symbol()) + )); + assert_ok!(OmniBridge::set_pay_in_fee( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + foreign_chain(), + 2 + )); + assert_ok!(OmniBridge::set_asset_symbol( + RuntimeOrigin::signed(alice()), + NativeOrWithId::WithId(TEST_ASSET), + asset_symbol() + )); + assert_ok!(OmniBridge::add_pay_in_pair( + RuntimeOrigin::signed(alice()), + NativeOrWithId::WithId(TEST_ASSET), + (foreign_chain(), asset_symbol()) + )); + assert_ok!(OmniBridge::set_pay_in_fee( + RuntimeOrigin::signed(alice()), + NativeOrWithId::WithId(TEST_ASSET), + foreign_chain(), + 3 + )); + } + }); + ext +} + +pub fn new_pay_in_request( + asset: NativeOrWithId, + amount: Balance, +) -> PayInRequest, Balance> { + PayInRequest { + asset, + dest_chain: ForeignChain::Ethereum(0), + dest_address: [1u8; 20].to_vec(), + amount, + } +} + +pub fn new_pay_out_request( + asset: NativeOrWithId, + amount: Balance, +) -> PayOutRequest, Balance> { + PayOutRequest { amount, to: alice(), asset } +} diff --git a/parachain/pallets/omni-bridge/src/tests.rs b/parachain/pallets/omni-bridge/src/tests.rs new file mode 100644 index 0000000000..98de0bfca1 --- /dev/null +++ b/parachain/pallets/omni-bridge/src/tests.rs @@ -0,0 +1,144 @@ +// Copyright 2020-2024 Trust Computing GmbH. +// This file is part of Litentry. +// +// Litentry is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Litentry is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Litentry. If not, see . + +use crate::{mock::*, *}; +use frame_support::{assert_noop, assert_ok}; + +#[test] +fn default_threshold_works() { + new_test_ext(false).execute_with(|| { + assert_eq!(OmniBridge::relayer_threshold(), 1); + }); +} + +#[test] +fn pay_in_with_no_symbol_fails() { + new_test_ext(false).execute_with(|| { + assert_noop!( + OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), + Error::::AssetSymbolNotExist + ); + }); +} + +#[test] +fn pay_in_with_pay_in_pair_not_listed_fails() { + new_test_ext(false).execute_with(|| { + assert_ok!(OmniBridge::set_asset_symbol( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + native_symbol() + )); + assert_noop!( + OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), + Error::::PayInPairNotAllowed + ); + }); +} + +#[test] +fn pay_in_with_pay_in_fee_not_set_fails() { + new_test_ext(false).execute_with(|| { + assert_ok!(OmniBridge::set_asset_symbol( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + native_symbol() + )); + assert_ok!(OmniBridge::add_pay_in_pair( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + (foreign_chain(), native_symbol()) + )); + assert_noop!( + OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), + Error::::PayInFeeNotSet + ); + }); +} + +#[test] +fn pay_in_with_too_low_pay_in_amount_fails() { + new_test_ext(false).execute_with(|| { + assert_ok!(OmniBridge::set_asset_symbol( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + native_symbol() + )); + assert_ok!(OmniBridge::add_pay_in_pair( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + (foreign_chain(), native_symbol()) + )); + assert_ok!(OmniBridge::set_pay_in_fee( + RuntimeOrigin::signed(alice()), + NativeOrWithId::Native, + foreign_chain(), + 11 // the requested pay-in amount can't cover the fee + )); + assert_noop!( + OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), + Error::::PayInAmountTooLow + ); + }); +} + +#[test] +fn pay_in_with_insufficient_funds_fails() { + new_test_ext(true).execute_with(|| { + let pay_in_request = new_pay_in_request(NativeOrWithId::Native, 51); + assert_noop!( + OmniBridge::pay_in(RuntimeOrigin::signed(alice()), pay_in_request), + DispatchError::Token(sp_runtime::TokenError::FundsUnavailable) + ); + }); +} + +#[test] +fn pay_in_works() { + new_test_ext(true).execute_with(|| { + assert_ok!(OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request())); + System::assert_last_event( + Event::PaidIn { + from: alice(), + nonce: 1, + asset: NativeOrWithId::Native, + dest_asset: (foreign_chain(), native_symbol()), + dest_address: [1u8; 20].to_vec(), + amount: 8, // 10(amount) - 2(fee) + } + .into(), + ); + + assert_ok!(OmniBridge::pay_in(RuntimeOrigin::signed(alice()), asset_pay_in_request())); + System::assert_last_event( + Event::PaidIn { + from: alice(), + nonce: 2, // increased + asset: NativeOrWithId::WithId(TEST_ASSET), + dest_asset: (foreign_chain(), asset_symbol()), + dest_address: [1u8; 20].to_vec(), + amount: 7, // 10(amount) - 3(fee) + } + .into(), + ); + + assert_eq!(Balances::free_balance(dave()), 2); // native pay-in fee + assert_eq!(Assets::balance(TEST_ASSET, dave()), 3); // asset pay-in fee + + assert_eq!(Balances::free_balance(alice()), 40); + assert_eq!(Assets::balance(TEST_ASSET, alice()), 90); + }); +} From c107667f273388be5d589f7a78f51b983f749534 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Sun, 5 Jan 2025 20:13:44 +0000 Subject: [PATCH 12/16] add tests --- parachain/pallets/omni-bridge/src/lib.rs | 295 ++++++------ parachain/pallets/omni-bridge/src/mock.rs | 2 +- parachain/pallets/omni-bridge/src/tests.rs | 493 +++++++++++++++++++++ 3 files changed, 659 insertions(+), 131 deletions(-) diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index 4ab59f20d6..e9616acbea 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -70,10 +70,41 @@ pub struct PayOutRequest { } #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub struct PayOutProposal { - pub req: PayOutRequest, +pub struct PayOutVote { pub ayes: Vec, pub nays: Vec, + pub status: VoteStatus, +} + +#[derive(PartialEq, Eq, Clone, Encode, Default, Decode, RuntimeDebug, TypeInfo)] +pub enum VoteStatus { + #[default] + Pending, + Passed, + Failed, +} + +impl PayOutVote { + /// Try to finalize the vote, return the updated status + pub fn try_finalize(&mut self, threshold: u32, total: u32) -> VoteStatus { + if self.ayes.len() >= threshold as usize { + self.status = VoteStatus::Passed; + VoteStatus::Passed + } else if total >= threshold && self.nays.len() as u32 + threshold > total { + self.status = VoteStatus::Failed; + VoteStatus::Failed + } else { + VoteStatus::Pending + } + } + + pub fn is_finalized(&self) -> bool { + self.status == VoteStatus::Passed || self.status == VoteStatus::Failed + } + + pub fn has_voted(&self, who: &AccountId) -> bool { + self.ayes.contains(who) || self.nays.contains(who) + } } #[frame_support::pallet] @@ -166,44 +197,41 @@ pub mod pallet { #[pallet::getter(fn pay_in_nonce)] pub type PayInNonce = StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; - /// Per-relayer nonce for a given `ForeignChain`. - /// - /// Payout request with smaller or equal nonce has been processed by this specific relayer already - /// and thus should be ignored by this relayer. + /// Finalized nonce for a given `ForeignChain` - we track this to avoid storing finalized + /// requests in the chain storage indefinitely. /// - /// This nonce mechanism relies on the monotonically increased nonce submitted from relayers, so - /// relayers must submit payout requests in the same order as foreign chain emits the requests. - /// Out of order may cause loss of payout requests. - #[pallet::storage] - #[pallet::getter(fn relayer_pay_out_nonce)] - pub type RelayerPayOutNonce = StorageDoubleMap< - _, - Twox64Concat, - T::AccountId, - Twox64Concat, - ForeignChain, - Nonce, - ValueQuery, - >; - - /// Finalized (global) nonce for a given `ForeignChain`. + /// Payout request whose nonce is smaller or equal to this nonce, should be considered finalized + /// and can thus be removed from storage. /// - /// Payout request with smaller or equal nonce has been finalized already and thus should be ignored - /// by all relayers. + /// This nonce should only be pumped if **all** previous requests are finalized too. #[pallet::storage] #[pallet::getter(fn finalized_pay_out_nonce)] pub type FinalizedPayOutNonce = StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + /// Finalized (highest) nonce for a vote, it should always be greater than or equal to FinalizedPayOutNonce + /// It doesn't mean all votes with smaller nonce are finalized, it just provides an upper bound + /// when bumping FinalizedPayOutNonce #[pallet::storage] - #[pallet::getter(fn pay_out_proposals)] - pub type PayOutProposals = StorageDoubleMap< + #[pallet::getter(fn finalized_vote_nonce)] + pub type FinalizedVoteNonce = + StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn pay_out_votes)] + pub type PayOutVotes = StorageDoubleMap< _, Twox64Concat, - ForeignChain, + (ForeignChain, Nonce), Twox64Concat, - Nonce, - PayOutProposal, + // Theoretically there should be only 1 request per (ForeignChain, Nonce), + // but buggy/faulty relayer might report a different request + // + // We key this item to rectify such case if the majority of relayers behaves correctly. + // + // We could have used PayOutRequest hash but `PayOutRequest` isn't much more complicated. + PayOutRequest, + PayOutVote, OptionQuery, >; @@ -226,10 +254,10 @@ pub mod pallet { AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, /// PayIn fee is set PayInFeeSet { asset: T::AssetKind, dest_chain: ForeignChain, fee: T::Balance }, - /// The payout nonce for a specific relayer is updated - RelayerPayOutNonceUpdated { who: T::AccountId, source_chain: ForeignChain, nonce: Nonce }, /// The payout nonce for global finalization is updated FinalizedPayOutNonceUpdated { source_chain: ForeignChain, nonce: Nonce }, + /// The finalized vote nonce is updated + FinalizedVoteNonceUpdated { source_chain: ForeignChain, nonce: Nonce }, /// Account paid in tokens, they will be paid out on the other side of the bridge. PaidIn { from: T::AccountId, @@ -239,16 +267,13 @@ pub mod pallet { dest_address: Vec, amount: T::Balance, }, - /// Some payout request is proposed and awaits other relayers' votes - PayOutProposed { + /// Some payout request is voted + PayOutVoted { who: T::AccountId, // relayer - aye: bool, - to: T::AccountId, + source_chain: ForeignChain, nonce: Nonce, - asset: T::AssetKind, - source_asset: ForeignAsset, // to track bridging same type of token from different chains - source_address: Vec, // TODO: tracking purpose - might not be necessary - amount: T::Balance, + req: PayOutRequest, + aye: bool, }, /// Some payout request is rejected PayOutRejected { @@ -282,9 +307,10 @@ pub mod pallet { PayInPairNotExist, PayInFeeNotSet, PayInAmountTooLow, - PayOutNonceAlreadyProcessedByRelayer, - PayOutNonceAlreadyFinalized, - PayOutRequestMismatch, + PayOutNonceFinalized, + PayOutVoteFinalized, + PayOutVoteCommitted, + FinalizedPayOutNonceOverflow, } #[pallet::genesis_config] @@ -373,96 +399,70 @@ pub mod pallet { source_asset: ForeignAsset, source_address: Vec, nonce: Nonce, - to: T::AccountId, - asset: T::AssetKind, - amount: T::Balance, + req: PayOutRequest, aye: bool, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::RequireRelayer); - let symbol = AssetSymbol::::get(&asset).ok_or(Error::::AssetSymbolNotExist)?; + let symbol = + AssetSymbol::::get(&req.asset).ok_or(Error::::AssetSymbolNotExist)?; ensure!(symbol == source_asset.1, Error::::AssetSymbolInvalid); // we can't require nonce == finalized_pay_out_nonce + 1, as a relayer could be way ahead // of finalized payout nonce ensure!( nonce > FinalizedPayOutNonce::::get(&source_asset.0), - Error::::PayOutNonceAlreadyFinalized - ); - ensure!( - nonce > RelayerPayOutNonce::::get(&who, &source_asset.0), - Error::::PayOutNonceAlreadyProcessedByRelayer + Error::::PayOutNonceFinalized ); - let threshold = Self::relayer_threshold(); - let total = Relayer::::count(); + // vote + let mut vote = match PayOutVotes::::get(&(source_asset.0.clone(), nonce), &req) { + Some(v) => v, + None => PayOutVote { ayes: vec![], nays: vec![], status: VoteStatus::Pending }, + }; - if threshold == 1 && aye { - // immediately do and finalize the payout - Self::do_pay_out(source_asset.clone(), source_address, nonce, to, asset, amount)?; - Self::finalize_pay_out(source_asset.0.clone(), nonce); - } else { - let req = PayOutRequest { to: to.clone(), asset: asset.clone(), amount }; - let mut prop = match PayOutProposals::::get(&source_asset.0, nonce) { - Some(p) => p, - None => PayOutProposal { req: req.clone(), ayes: vec![], nays: vec![] }, - }; - - // TODO: what if the faulty relayer creates the entry first? - // righteous relayers won't have a chance to fix it - ensure!(req == prop.req, Error::::PayOutRequestMismatch); - - // TODO: what if this relayer voted already? - if aye { - prop.ayes.push(who.clone()); - } else { - prop.nays.push(who.clone()); - } + ensure!(!vote.is_finalized(), Error::::PayOutVoteFinalized); + ensure!(!vote.has_voted(&who), Error::::PayOutVoteCommitted); - if prop.ayes.len() >= threshold as usize { - // prop is approved, do and finalize the pay out - Self::do_pay_out( - source_asset.clone(), - source_address, - nonce, - to, - asset, - amount, - )?; - Self::finalize_pay_out(source_asset.0.clone(), nonce); - } else if total >= threshold && prop.nays.len() as u32 + threshold > total { - // prop is rejected, finalize the pay out - Self::deposit_event(Event::PayOutRejected { - to, - nonce, - asset, - source_asset: source_asset.clone(), - source_address, - amount, - }); - Self::finalize_pay_out(source_asset.0.clone(), nonce); - } else { - // prop is pending, we probably need to wait for tallother relayers - Self::deposit_event(Event::PayOutProposed { - who: who.clone(), - aye, - to, - nonce, - asset, - source_asset: source_asset.clone(), - source_address, - amount, - }); - } + if aye { + vote.ayes.push(who.clone()); + } else { + vote.nays.push(who.clone()); } - // update per-relayer payout nonce - RelayerPayOutNonce::::insert(&who, &source_asset.0, nonce); - Self::deposit_event(Event::RelayerPayOutNonceUpdated { - who, - source_chain: source_asset.0, + Self::deposit_event(Event::PayOutVoted { + who: who.clone(), + source_chain: source_asset.0.clone(), nonce, + req: req.clone(), + aye, }); + // try to finalise + let threshold = Self::relayer_threshold(); + let total = Relayer::::count(); + + let status = vote.try_finalize(threshold, total); + PayOutVotes::::insert(&(source_asset.0.clone(), nonce), &req, vote.clone()); + + match status { + VoteStatus::Passed => { + Self::do_pay_out(source_asset.clone(), source_address, nonce, &req)? + }, + VoteStatus::Failed => Self::deposit_event(Event::PayOutRejected { + to: req.to.clone(), + nonce, + asset: req.asset.clone(), + source_asset: source_asset.clone(), + source_address, + amount: req.amount, + }), + _ => (), + } + + if vote.is_finalized() { + Self::do_post_finalize(&source_asset.0, nonce, &req)?; + } + Ok(Pays::No.into()) } @@ -600,34 +600,69 @@ pub mod pallet { Ok(nonce) } - fn finalize_pay_out(source_chain: ForeignChain, nonce: Nonce) { - FinalizedPayOutNonce::::insert(&source_chain, nonce); - // remove it from proposal pool if exists - if PayOutProposals::::get(&source_chain, nonce).is_some() { - PayOutProposals::::remove(&source_chain, nonce); - } - Self::deposit_event(Event::FinalizedPayOutNonceUpdated { source_chain, nonce }); - } - fn do_pay_out( source_asset: ForeignAsset, source_address: Vec, nonce: Nonce, - to: T::AccountId, - asset: T::AssetKind, - amount: T::Balance, + req: &PayOutRequest, ) -> DispatchResult { // do actual payout - T::Assets::mint_into(asset.clone(), &to, amount)?; + T::Assets::mint_into(req.asset.clone(), &req.to, req.amount)?; Self::deposit_event(Event::PaidOut { - to, + to: req.to.clone(), nonce, - asset, + asset: req.asset.clone(), source_asset, source_address, - amount, + amount: req.amount, }); Ok(()) } + + fn do_post_finalize( + source_chain: &ForeignChain, + nonce: Nonce, + req: &PayOutRequest, + ) -> DispatchResult { + if nonce > Self::finalized_vote_nonce(source_chain) { + FinalizedVoteNonce::::insert(source_chain, nonce); + Self::deposit_event(Event::FinalizedVoteNonceUpdated { + source_chain: source_chain.clone(), + nonce, + }); + } + // Try to bump FinalizedPayOutNonce until a non-finalized vote + // TODO: weight-related: shall we set a max diff to avoid infinite/too many loops? + let mut n = Self::finalized_pay_out_nonce(source_chain); + while n < Self::finalized_vote_nonce(source_chain) { + let next_n = n.checked_add(1).ok_or(Error::::FinalizedPayOutNonceOverflow)?; + // we are lenient that we don't require `vote` to exist - in practice, it would mean + // some relayer didn't follow monotonically increasing pay out nonce (for some reason) + // + // TODO: shall we look for all possible values of `PayOutRequest`? + if let Some(vote) = PayOutVotes::::get((source_chain, next_n), req) { + if vote.is_finalized() { + // this vote can be removed + // TODO: shall we remove votes with all possible PayOutRequests? + PayOutVotes::::remove((source_chain, next_n), req); + n = next_n; + } else { + // nothing to do + break; + } + } else { + break; + } + } + + if n > Self::finalized_pay_out_nonce(source_chain) { + FinalizedPayOutNonce::::insert(source_chain, n); + Self::deposit_event(Event::FinalizedPayOutNonceUpdated { + source_chain: source_chain.clone(), + nonce: n, + }); + } + Ok(()) + } } } diff --git a/parachain/pallets/omni-bridge/src/mock.rs b/parachain/pallets/omni-bridge/src/mock.rs index 609517ff16..819cd30188 100644 --- a/parachain/pallets/omni-bridge/src/mock.rs +++ b/parachain/pallets/omni-bridge/src/mock.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Litentry. If not, see . -use crate::{self as pallet_omni_bridge, ForeignAsset, ForeignChain, PayInRequest, PayOutRequest}; +use crate::{self as pallet_omni_bridge, ForeignChain, PayInRequest, PayOutRequest}; pub use frame_support::{ assert_ok, derive_impl, parameter_types, traits::{ diff --git a/parachain/pallets/omni-bridge/src/tests.rs b/parachain/pallets/omni-bridge/src/tests.rs index 98de0bfca1..1d621929aa 100644 --- a/parachain/pallets/omni-bridge/src/tests.rs +++ b/parachain/pallets/omni-bridge/src/tests.rs @@ -21,6 +21,8 @@ use frame_support::{assert_noop, assert_ok}; fn default_threshold_works() { new_test_ext(false).execute_with(|| { assert_eq!(OmniBridge::relayer_threshold(), 1); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 0); }); } @@ -142,3 +144,494 @@ fn pay_in_works() { assert_eq!(Assets::balance(TEST_ASSET, alice()), 90); }); } + +#[test] +fn pay_out_with_not_relayer_fails() { + new_test_ext(true).execute_with(|| { + assert_noop!( + OmniBridge::propose_pay_out( + RuntimeOrigin::signed(dave()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + true, + ), + Error::::RequireRelayer + ); + }); +} + +#[test] +fn pay_out_with_wrong_symbol_fails() { + new_test_ext(true).execute_with(|| { + assert_noop!( + OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), asset_symbol()), // wrong symbol + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + true, + ), + Error::::AssetSymbolInvalid + ); + }); +} + +#[test] +fn pay_out_with_threshold_1_works() { + new_test_ext(true).execute_with(|| { + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + true, + )); + assert_eq!(Balances::free_balance(alice()), 60); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 1); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + System::assert_has_event( + Event::PayOutVoted { + who: alice(), + source_chain: foreign_chain(), + nonce: 1, + req: native_pay_out_request(), + aye: true, + } + .into(), + ); + System::assert_has_event( + Event::PaidOut { + to: alice(), + nonce: 1, + asset: NativeOrWithId::Native, + source_asset: (foreign_chain(), native_symbol()), + source_address: [1u8; 20].to_vec(), + amount: 10, + } + .into(), + ); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), asset_symbol()), + [1u8; 20].to_vec(), + 2, + asset_pay_out_request(), + true, + )); + assert_eq!(Assets::balance(TEST_ASSET, alice()), 110); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), None); + + // alice relaying the same request will error out + assert_noop!( + OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), asset_symbol()), + [1u8; 20].to_vec(), + 2, + asset_pay_out_request(), + true, + ), + Error::::PayOutNonceFinalized + ); + + // bob requests with nay + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 3, + native_pay_out_request(), + false, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 3), native_pay_out_request()), + Some(PayOutVote { ayes: vec![], nays: vec![bob()], status: VoteStatus::Pending }) + ); + + // charlie approves it + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 3, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 3), native_pay_out_request()), None,); + assert_eq!(Balances::free_balance(alice()), 70); + System::assert_has_event( + Event::PaidOut { + to: alice(), + nonce: 3, + asset: NativeOrWithId::Native, + source_asset: (foreign_chain(), native_symbol()), + source_address: [1u8; 20].to_vec(), + amount: 10, + } + .into(), + ); + + // charlie sends request with non-consecutive nonce (3 -> 6), which is allowed here, + // but it probably implies some internal error with charlie + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 6, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); // blocked at 3 + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); // updated + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), + Some(PayOutVote { ayes: vec![charlie()], nays: vec![], status: VoteStatus::Passed }) + ); + assert_eq!(Balances::free_balance(alice()), 80); + + // alice sends request with nonce 4 + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 4, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 4); // updated to 4 + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); // unchanged + assert_eq!(Balances::free_balance(alice()), 90); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), + Some(PayOutVote { ayes: vec![charlie()], nays: vec![], status: VoteStatus::Passed }) + ); + + // bob sends request with nonce 5 + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 5, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 6); // updated to 6 + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); + assert_eq!(Balances::free_balance(alice()), 100); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), None,); + }); +} + +#[test] +fn pay_out_with_threshold_2_works() { + new_test_ext(true).execute_with(|| { + assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(Balances::free_balance(alice()), 50); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) + ); + System::assert_has_event( + Event::PayOutVoted { + who: alice(), + source_chain: foreign_chain(), + nonce: 1, + req: native_pay_out_request(), + aye: true, + } + .into(), + ); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + false, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(Balances::free_balance(alice()), 50); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + Some(PayOutVote { + ayes: vec![alice()], + nays: vec![bob()], + status: VoteStatus::Pending, + }) + ); + System::assert_has_event( + Event::PayOutVoted { + who: bob(), + source_chain: foreign_chain(), + nonce: 1, + req: native_pay_out_request(), + aye: false, + } + .into(), + ); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); + assert_eq!(Balances::free_balance(alice()), 60); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + System::assert_has_event( + Event::PayOutVoted { + who: charlie(), + source_chain: foreign_chain(), + nonce: 1, + req: native_pay_out_request(), + aye: true, + } + .into(), + ); + System::assert_has_event( + Event::PaidOut { + to: alice(), + nonce: 1, + asset: NativeOrWithId::Native, + source_asset: (foreign_chain(), native_symbol()), + source_address: [1u8; 20].to_vec(), + amount: 10, + } + .into(), + ); + + // alice requests with nonce 2, but a different request (with bob and charlie) + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), asset_symbol()), + [1u8; 20].to_vec(), + 2, + asset_pay_out_request(), + true, + )); + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 2, + native_pay_out_request(), + true, + )); + + // both requests are recorded in different vote entries + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), + Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) + ); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 2), native_pay_out_request()), + Some(PayOutVote { ayes: vec![bob()], nays: vec![], status: VoteStatus::Pending }) + ); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 2, + native_pay_out_request(), + true, + )); + + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); // updated to 2 + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); + assert_eq!(Balances::free_balance(alice()), 70); + assert_eq!(Assets::balance(TEST_ASSET, alice()), 100); + // native payout request is removed, but asset payout request still exists (and never gets removed) + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 2), native_pay_out_request()), None); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), + Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) + ); + }); +} + +#[test] +fn pay_out_with_threshold_2_fail_fast_works() { + new_test_ext(true).execute_with(|| { + assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + false, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(Balances::free_balance(alice()), 50); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + Some(PayOutVote { ayes: vec![], nays: vec![alice()], status: VoteStatus::Pending }) + ); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + false, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); + assert_eq!(Balances::free_balance(alice()), 50); + assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + System::assert_has_event( + Event::PayOutRejected { + to: alice(), + nonce: 1, + asset: NativeOrWithId::Native, + source_asset: (foreign_chain(), native_symbol()), + source_address: [1u8; 20].to_vec(), + amount: 10, + } + .into(), + ); + }); +} + +// this test: +// - alice relays payout request 1, 2, 3 - all with aye +// - charlie relays payout request 1 with nay, 2 and 3 with aye +// - bob relays payout request with 1 with nay later +#[test] +fn pay_out_with_ahead_of_relayer_works() { + new_test_ext(true).execute_with(|| { + assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); + for i in 1..4 { + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(alice()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + i, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(Balances::free_balance(alice()), 50); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), + Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) + ); + } + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + false, + )); + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + Some(PayOutVote { + ayes: vec![alice()], + nays: vec![charlie()], + status: VoteStatus::Pending, + }) + ); + + for i in 2..4 { + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(charlie()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + i, + native_pay_out_request(), + true, + )); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); // not updated + // request with nonce 2 and 3 should be passed and executed + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), + Some(PayOutVote { + ayes: vec![alice(), charlie()], + nays: vec![], + status: VoteStatus::Passed, + }) + ); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), i); + System::assert_has_event( + Event::FinalizedVoteNonceUpdated { source_chain: foreign_chain(), nonce: i }.into(), + ); + } + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + Some(PayOutVote { + ayes: vec![alice()], + nays: vec![charlie()], + status: VoteStatus::Pending, + }) + ); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); + assert_eq!(Balances::free_balance(alice()), 70); + + assert_ok!(OmniBridge::propose_pay_out( + RuntimeOrigin::signed(bob()), + (foreign_chain(), native_symbol()), + [1u8; 20].to_vec(), + 1, + native_pay_out_request(), + false, + )); + assert_eq!(Balances::free_balance(alice()), 70); + assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); + assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); // updated to 3 + for i in 1..4 { + assert_eq!( + OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), + None + ); + } + System::assert_has_event( + Event::FinalizedPayOutNonceUpdated { source_chain: foreign_chain(), nonce: 3 }.into(), + ); + System::assert_has_event( + Event::PayOutRejected { + to: alice(), + nonce: 1, + asset: NativeOrWithId::Native, + source_asset: (foreign_chain(), native_symbol()), + source_address: [1u8; 20].to_vec(), + amount: 10, + } + .into(), + ); + }); +} From da5ab6bcee5e318f815cb6cb847b4005d09a0668 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 7 Jan 2025 00:59:02 +0000 Subject: [PATCH 13/16] refactor omni-bridge --- parachain/Cargo.lock | 1 + parachain/pallets/omni-bridge/Cargo.toml | 3 + parachain/pallets/omni-bridge/src/lib.rs | 352 ++++++++------- parachain/pallets/omni-bridge/src/mock.rs | 60 +-- parachain/pallets/omni-bridge/src/tests.rs | 494 ++++++++++----------- parachain/runtime/common/src/lib.rs | 2 +- 6 files changed, 484 insertions(+), 428 deletions(-) diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index 2fd46a398c..02235b331a 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -8533,6 +8533,7 @@ version = "0.1.0" dependencies = [ "frame-support", "frame-system", + "hex", "pallet-assets", "pallet-balances", "pallet-timestamp", diff --git a/parachain/pallets/omni-bridge/Cargo.toml b/parachain/pallets/omni-bridge/Cargo.toml index a156836d6e..8377f5f642 100644 --- a/parachain/pallets/omni-bridge/Cargo.toml +++ b/parachain/pallets/omni-bridge/Cargo.toml @@ -13,6 +13,7 @@ scale-info = { workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } +sp-io = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -23,6 +24,7 @@ frame-system = { workspace = true, features = ["std"] } pallet-assets = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } +hex = { workspace = true } [features] default = ["std"] @@ -35,6 +37,7 @@ std = [ "parity-scale-codec/std", "scale-info/std", "sp-core/std", + "sp-io/std", "sp-std/std", "sp-runtime/std", "frame-support/std", diff --git a/parachain/pallets/omni-bridge/src/lib.rs b/parachain/pallets/omni-bridge/src/lib.rs index e9616acbea..0a1e70da25 100644 --- a/parachain/pallets/omni-bridge/src/lib.rs +++ b/parachain/pallets/omni-bridge/src/lib.rs @@ -27,6 +27,8 @@ use frame_support::{ PalletId, }; use frame_system::{ensure_root, ensure_signed, pallet_prelude::*}; +use sp_core::H256; +use sp_io::hashing::blake2_256; use sp_runtime::traits::AccountIdConversion; use sp_std::{prelude::*, vec}; @@ -41,34 +43,57 @@ mod tests; const MODULE_ID: PalletId = PalletId(*b"hm/ombrg"); const DEFAULT_RELAYER_THRESHOLD: u32 = 1; +// TODO: maybe using xcm Location is better +// but we'd need enums for all foreign types, or use GeneralIndex #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub enum ForeignChain { - Ethereum(u32), // chain id +pub enum ChainType { + Heima, // this chain + Ethereum(u32), // with chain id +} + +// We assume "chain + asset-id" can uniquely identify an asset that can +// be bridged out/in +#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct ChainAsset { + pub chain: ChainType, + pub asset: AssetKind, +} + +impl ChainAsset { + pub fn to_resource_id(&self) -> ResourceId { + self.using_encoded(blake2_256) + } } -// We assume "chain + token_symbol" can uniquely identify a foreign asset -pub type ForeignAsset = (ForeignChain, Vec); pub type Nonce = u64; +pub type ResourceId = [u8; 32]; // to be compatible with chainsafe's contract +pub type PayOutRequestHash = H256; // payin request by user (from user to foreign chain) - better name? -// note the asset symbol is retrieved by lookup, not as parameter, it -// prevents mismatch between given and registered asset symbol #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct PayInRequest { pub asset: AssetKind, - pub dest_chain: ForeignChain, - pub dest_address: Vec, + pub dest_chain: ChainType, + pub dest_account: Vec, pub amount: Balance, } // payout request by relayer (from foreign chain to user) - better name? #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub struct PayOutRequest { - pub to: AccountId, - pub asset: AssetKind, +pub struct PayOutRequest { + pub source_chain: ChainType, + pub nonce: Nonce, + pub resource_id: ResourceId, + pub dest_account: AccountId, pub amount: Balance, } +impl PayOutRequest { + pub fn hash(&self) -> PayOutRequestHash { + self.using_encoded(blake2_256).into() + } +} + #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct PayOutVote { pub ayes: Vec, @@ -147,8 +172,9 @@ pub mod pallet { pub type Admin = StorageValue<_, T::AccountId, OptionQuery>; #[pallet::storage] - #[pallet::getter(fn relayer)] - pub type Relayer = CountedStorageMap<_, Twox64Concat, T::AccountId, (), OptionQuery>; + #[pallet::getter(fn relayers)] + pub type Relayers = + CountedStorageMap<_, Twox64Concat, T::AccountId, (), OptionQuery>; #[pallet::type_value] pub fn DefaultRelayerThresholdValue() -> u32 { @@ -159,26 +185,15 @@ pub mod pallet { #[pallet::getter(fn relayer_threshold)] pub type RelayerThreshold = StorageValue<_, u32, ValueQuery, DefaultRelayerThresholdValue>; - // A map from AssetKind to its metadata - // It's a simplified version of the standard asset metadata - // - // TODO: shall we have an assset registry to store this? #[pallet::storage] #[pallet::getter(fn asset_symbol)] - pub type AssetSymbol = - StorageMap<_, Blake2_128Concat, T::AssetKind, Vec, OptionQuery>; + pub type ResourceIds = + StorageMap<_, Twox64Concat, ResourceId, ChainAsset, OptionQuery>; #[pallet::storage] #[pallet::getter(fn pay_in_pair)] - pub type PayInPair = StorageDoubleMap< - _, - Blake2_128Concat, - T::AssetKind, - Blake2_128Concat, - ForeignAsset, - (), - OptionQuery, - >; + pub type PayInPair = + StorageMap<_, Blake2_128Concat, (T::AssetKind, ChainType), (), OptionQuery>; // TODO: later we can allow pay the fee with other assets #[pallet::storage] @@ -188,16 +203,16 @@ pub mod pallet { Blake2_128Concat, T::AssetKind, Blake2_128Concat, - ForeignChain, + ChainType, T::Balance, OptionQuery, >; #[pallet::storage] #[pallet::getter(fn pay_in_nonce)] - pub type PayInNonce = StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + pub type PayInNonce = StorageMap<_, Twox64Concat, ChainType, Nonce, ValueQuery>; - /// Finalized nonce for a given `ForeignChain` - we track this to avoid storing finalized + /// Finalized nonce for a given `ChainType` - we track this to avoid storing finalized /// requests in the chain storage indefinitely. /// /// Payout request whose nonce is smaller or equal to this nonce, should be considered finalized @@ -207,7 +222,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn finalized_pay_out_nonce)] pub type FinalizedPayOutNonce = - StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + StorageMap<_, Twox64Concat, ChainType, Nonce, ValueQuery>; /// Finalized (highest) nonce for a vote, it should always be greater than or equal to FinalizedPayOutNonce /// It doesn't mean all votes with smaller nonce are finalized, it just provides an upper bound @@ -215,23 +230,32 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn finalized_vote_nonce)] pub type FinalizedVoteNonce = - StorageMap<_, Twox64Concat, ForeignChain, Nonce, ValueQuery>; + StorageMap<_, Twox64Concat, ChainType, Nonce, ValueQuery>; #[pallet::storage] - #[pallet::getter(fn pay_out_votes)] - pub type PayOutVotes = StorageDoubleMap< + #[pallet::getter(fn pay_out_hashes)] + pub type PayOutHashes = StorageDoubleMap< _, Twox64Concat, - (ForeignChain, Nonce), + ChainType, Twox64Concat, - // Theoretically there should be only 1 request per (ForeignChain, Nonce), - // but buggy/faulty relayer might report a different request - // - // We key this item to rectify such case if the majority of relayers behaves correctly. - // - // We could have used PayOutRequest hash but `PayOutRequest` isn't much more complicated. - PayOutRequest, - PayOutVote, + Nonce, + Vec, + OptionQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn pay_out_votes)] + pub type PayOutVotes = + StorageMap<_, Blake2_128Concat, PayOutRequestHash, PayOutVote, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn pay_out_requests)] + pub type PayOutRequests = StorageMap< + _, + Blake2_128Concat, + PayOutRequestHash, + PayOutRequest, OptionQuery, >; @@ -247,50 +271,56 @@ pub mod pallet { /// Relayer threshold set RelayerThresholdSet { threshold: u32 }, /// Some pay in pair is added - PayInPairAdded { asset: T::AssetKind, foreign_asset: ForeignAsset }, + PayInPairAdded { asset: T::AssetKind, dest_chain: ChainType }, /// Some pay in pair is removed - PayInPairRemoved { asset: T::AssetKind, foreign_asset: ForeignAsset }, - /// Some asset symbl is set - AssetSymbolSet { asset: T::AssetKind, symbol: Vec }, + PayInPairRemoved { asset: T::AssetKind, dest_chain: ChainType }, + /// Some resource id is set + ResourceIdSet { resource_id: ResourceId, chain_asset: ChainAsset }, + /// Some resource id is removed + ResourceIdRemoved { resource_id: ResourceId }, /// PayIn fee is set - PayInFeeSet { asset: T::AssetKind, dest_chain: ForeignChain, fee: T::Balance }, + PayInFeeSet { asset: T::AssetKind, dest_chain: ChainType, fee: T::Balance }, /// The payout nonce for global finalization is updated - FinalizedPayOutNonceUpdated { source_chain: ForeignChain, nonce: Nonce }, + FinalizedPayOutNonceUpdated { source_chain: ChainType, nonce: Nonce }, /// The finalized vote nonce is updated - FinalizedVoteNonceUpdated { source_chain: ForeignChain, nonce: Nonce }, - /// Account paid in tokens, they will be paid out on the other side of the bridge. + FinalizedVoteNonceUpdated { source_chain: ChainType, nonce: Nonce }, + /// Someone paid in tokens, they will be paid out on the other side of the bridge + /// This event together with payout events don't have nested structure to: + /// 1. have a clearer display + /// 2. apply any required adjustments (e.g. amount) PaidIn { - from: T::AccountId, + source_account: T::AccountId, nonce: Nonce, asset: T::AssetKind, - dest_asset: ForeignAsset, - dest_address: Vec, + resource_id: ResourceId, + dest_chain: ChainType, + dest_account: Vec, amount: T::Balance, }, /// Some payout request is voted PayOutVoted { who: T::AccountId, // relayer - source_chain: ForeignChain, + source_chain: ChainType, nonce: Nonce, - req: PayOutRequest, + asset: T::AssetKind, + dest_account: T::AccountId, + amount: T::Balance, aye: bool, }, /// Some payout request is rejected PayOutRejected { - to: T::AccountId, + source_chain: ChainType, nonce: Nonce, asset: T::AssetKind, - source_asset: ForeignAsset, // to track bridging same type of token from different chains - source_address: Vec, // TODO: tracking purpose - might not be necessary + dest_account: T::AccountId, amount: T::Balance, }, /// Some payout request is successfully executed PaidOut { - to: T::AccountId, + source_chain: ChainType, nonce: Nonce, asset: T::AssetKind, - source_asset: ForeignAsset, // to track bridging same type of token from different chains - source_address: Vec, // TODO: tracking purpose - might not be necessary + dest_account: T::AccountId, amount: T::Balance, }, } @@ -300,8 +330,8 @@ pub mod pallet { RequireAdminOrRoot, RequireRelayer, ThresholdInvalid, - AssetSymbolNotExist, - AssetSymbolInvalid, + ChainTypeInvalid, + ResourceIdNotExist, PayInNonceOverflow, PayInPairNotAllowed, PayInPairNotExist, @@ -332,7 +362,7 @@ pub mod pallet { Admin::::put(admin); } for r in &self.default_relayers { - Relayer::::insert(r, ()); + Relayers::::insert(r, ()); } } } @@ -359,14 +389,16 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; let nonce = Self::next_pay_in_nonce(&req.dest_chain)?; - let symbol = - AssetSymbol::::get(&req.asset).ok_or(Error::::AssetSymbolNotExist)?; - let foreign_asset: ForeignAsset = (req.dest_chain.clone(), symbol); ensure!( - PayInPair::::get(&req.asset, &foreign_asset).is_some(), + PayInPair::::get((&req.asset, &req.dest_chain)).is_some(), Error::::PayInPairNotAllowed ); - let fee = PayInFee::::get(req.asset.clone(), req.dest_chain) + + // Note the resource_id is always calculated from this chain + let resource_id = + ChainAsset { asset: req.asset.clone(), chain: ChainType::Heima }.to_resource_id(); + + let fee = PayInFee::::get(&req.asset, &req.dest_chain) .ok_or(Error::::PayInFeeNotSet)?; let burn_amount = T::Assets::burn_from( req.asset.clone(), @@ -382,11 +414,12 @@ pub mod pallet { T::Assets::mint_into(req.asset.clone(), &T::TreasuryAccount::get(), fee)?; Self::deposit_event(Event::PaidIn { - from: who, + source_account: who, nonce, asset: req.asset, - dest_asset: foreign_asset, - dest_address: req.dest_address, + resource_id, + dest_chain: req.dest_chain, + dest_account: req.dest_account, amount: burn_amount - fee, }); Ok(().into()) @@ -394,28 +427,26 @@ pub mod pallet { #[pallet::call_index(2)] #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn propose_pay_out( + pub fn request_pay_out( origin: OriginFor, - source_asset: ForeignAsset, - source_address: Vec, - nonce: Nonce, - req: PayOutRequest, + req: PayOutRequest, aye: bool, ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::RequireRelayer); - let symbol = - AssetSymbol::::get(&req.asset).ok_or(Error::::AssetSymbolNotExist)?; - ensure!(symbol == source_asset.1, Error::::AssetSymbolInvalid); - // we can't require nonce == finalized_pay_out_nonce + 1, as a relayer could be way ahead - // of finalized payout nonce + ensure!(req.source_chain != ChainType::Heima, Error::::ChainTypeInvalid); ensure!( - nonce > FinalizedPayOutNonce::::get(&source_asset.0), + req.nonce > FinalizedPayOutNonce::::get(&req.source_chain), Error::::PayOutNonceFinalized ); + let hash = req.hash(); + let chain_asset = + ResourceIds::::get(req.resource_id).ok_or(Error::::ResourceIdNotExist)?; + ensure!(chain_asset.chain == ChainType::Heima, Error::::ChainTypeInvalid); + // vote - let mut vote = match PayOutVotes::::get(&(source_asset.0.clone(), nonce), &req) { + let mut vote = match PayOutVotes::::get(hash) { Some(v) => v, None => PayOutVote { ayes: vec![], nays: vec![], status: VoteStatus::Pending }, }; @@ -431,36 +462,51 @@ pub mod pallet { Self::deposit_event(Event::PayOutVoted { who: who.clone(), - source_chain: source_asset.0.clone(), - nonce, - req: req.clone(), + source_chain: req.source_chain.clone(), + nonce: req.nonce, + asset: chain_asset.asset.clone(), + dest_account: req.dest_account.clone(), + amount: req.amount, aye, }); // try to finalise let threshold = Self::relayer_threshold(); - let total = Relayer::::count(); + let total = Relayers::::count(); let status = vote.try_finalize(threshold, total); - PayOutVotes::::insert(&(source_asset.0.clone(), nonce), &req, vote.clone()); + PayOutVotes::::insert(hash, vote.clone()); + PayOutRequests::::insert(hash, req.clone()); + let mut hashes = match PayOutHashes::::get(&req.source_chain, req.nonce) { + Some(hashes) => hashes, + None => vec![hash], + }; + + if !hashes.contains(&hash) { + hashes.push(hash); + } + PayOutHashes::::insert(&req.source_chain, req.nonce, hashes); match status { - VoteStatus::Passed => { - Self::do_pay_out(source_asset.clone(), source_address, nonce, &req)? - }, + VoteStatus::Passed => Self::do_pay_out( + req.source_chain.clone(), + req.nonce, + chain_asset.asset.clone(), + req.dest_account.clone(), + req.amount, + )?, VoteStatus::Failed => Self::deposit_event(Event::PayOutRejected { - to: req.to.clone(), - nonce, - asset: req.asset.clone(), - source_asset: source_asset.clone(), - source_address, + source_chain: req.source_chain.clone(), + nonce: req.nonce, + asset: chain_asset.asset, + dest_account: req.dest_account.clone(), amount: req.amount, }), _ => (), } if vote.is_finalized() { - Self::do_post_finalize(&source_asset.0, nonce, &req)?; + Self::do_post_finalize(&req)?; } Ok(Pays::No.into()) @@ -470,7 +516,7 @@ pub mod pallet { #[pallet::weight((T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] pub fn add_relayer(origin: OriginFor, who: T::AccountId) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - Relayer::::insert(who.clone(), ()); + Relayers::::insert(&who, ()); Self::deposit_event(Event::RelayerAdded { who }); Ok(Pays::No.into()) } @@ -483,7 +529,7 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; ensure!(Self::is_relayer(&who), Error::::RequireRelayer); - Relayer::::remove(who.clone()); + Relayers::::remove(&who); Self::deposit_event(Event::RelayerRemoved { who }); Ok(Pays::No.into()) } @@ -493,40 +539,38 @@ pub mod pallet { pub fn set_pay_in_fee( origin: OriginFor, asset: T::AssetKind, - dest_chain: ForeignChain, + dest_chain: ChainType, fee: T::Balance, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - PayInFee::::insert(asset.clone(), dest_chain.clone(), fee); + PayInFee::::insert(&asset, &dest_chain, fee); Self::deposit_event(Event::PayInFeeSet { asset, dest_chain, fee }); Ok(Pays::No.into()) } #[pallet::call_index(6)] #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn create_asset( + pub fn set_resource_id( origin: OriginFor, - asset: T::AssetKind, - is_sufficient: bool, - min_balance: T::Balance, - symbol: Vec, + resource_id: ResourceId, + chain_asset: ChainAsset, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin.clone())?; - T::Assets::create(asset.clone(), Self::account_id(), is_sufficient, min_balance)?; - Self::set_asset_symbol(origin, asset, symbol)?; + ResourceIds::::insert(resource_id, chain_asset.clone()); + Self::deposit_event(Event::ResourceIdSet { resource_id, chain_asset }); Ok(Pays::No.into()) } #[pallet::call_index(7)] #[pallet::weight((2 * T::DbWeight::get().write, DispatchClass::Normal, Pays::No))] - pub fn set_asset_symbol( + pub fn remove_resource_id( origin: OriginFor, - asset: T::AssetKind, - symbol: Vec, + resource_id: ResourceId, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - AssetSymbol::::insert(&asset, symbol.clone()); - Self::deposit_event(Event::AssetSymbolSet { asset, symbol }); + ensure!(ResourceIds::::contains_key(resource_id), Error::::ResourceIdNotExist); + ResourceIds::::remove(resource_id); + Self::deposit_event(Event::ResourceIdRemoved { resource_id }); Ok(Pays::No.into()) } @@ -548,11 +592,11 @@ pub mod pallet { pub fn add_pay_in_pair( origin: OriginFor, asset: T::AssetKind, - foreign_asset: ForeignAsset, + dest_chain: ChainType, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; - PayInPair::::insert(&asset, &foreign_asset, ()); - Self::deposit_event(Event::PayInPairAdded { asset, foreign_asset }); + PayInPair::::insert((&asset, &dest_chain), ()); + Self::deposit_event(Event::PayInPairAdded { asset, dest_chain }); Ok(Pays::No.into()) } @@ -561,15 +605,15 @@ pub mod pallet { pub fn remove_pay_in_pair( origin: OriginFor, asset: T::AssetKind, - foreign_asset: ForeignAsset, + dest_chain: ChainType, ) -> DispatchResultWithPostInfo { Self::ensure_admin_or_root(origin)?; ensure!( - PayInPair::::get(&asset, &foreign_asset).is_some(), + PayInPair::::get((&asset, &dest_chain)).is_some(), Error::::PayInPairNotExist ); - PayInPair::::remove(&asset, &foreign_asset); - Self::deposit_event(Event::PayInPairRemoved { asset, foreign_asset }); + PayInPair::::remove((&asset, &dest_chain)); + Self::deposit_event(Event::PayInPairRemoved { asset, dest_chain }); Ok(Pays::No.into()) } } @@ -590,10 +634,10 @@ pub mod pallet { } pub fn is_relayer(who: &T::AccountId) -> bool { - Relayer::::contains_key(who) + Relayers::::contains_key(who) } - fn next_pay_in_nonce(chain: &ForeignChain) -> Result> { + fn next_pay_in_nonce(chain: &ChainType) -> Result> { let nonce = Self::pay_in_nonce(chain); let nonce = nonce.checked_add(1).ok_or(Error::::PayInNonceOverflow)?; PayInNonce::::insert(chain, nonce); @@ -601,50 +645,48 @@ pub mod pallet { } fn do_pay_out( - source_asset: ForeignAsset, - source_address: Vec, + source_chain: ChainType, nonce: Nonce, - req: &PayOutRequest, + asset: T::AssetKind, + dest_account: T::AccountId, + amount: T::Balance, ) -> DispatchResult { // do actual payout - T::Assets::mint_into(req.asset.clone(), &req.to, req.amount)?; + T::Assets::mint_into(asset.clone(), &dest_account, amount)?; Self::deposit_event(Event::PaidOut { - to: req.to.clone(), + source_chain, nonce, - asset: req.asset.clone(), - source_asset, - source_address, - amount: req.amount, + asset, + dest_account, + amount, }); Ok(()) } - fn do_post_finalize( - source_chain: &ForeignChain, - nonce: Nonce, - req: &PayOutRequest, - ) -> DispatchResult { - if nonce > Self::finalized_vote_nonce(source_chain) { - FinalizedVoteNonce::::insert(source_chain, nonce); + fn do_post_finalize(req: &PayOutRequest) -> DispatchResult { + if req.nonce > Self::finalized_vote_nonce(&req.source_chain) { + FinalizedVoteNonce::::insert(&req.source_chain, req.nonce); Self::deposit_event(Event::FinalizedVoteNonceUpdated { - source_chain: source_chain.clone(), - nonce, + source_chain: req.source_chain.clone(), + nonce: req.nonce, }); } // Try to bump FinalizedPayOutNonce until a non-finalized vote // TODO: weight-related: shall we set a max diff to avoid infinite/too many loops? - let mut n = Self::finalized_pay_out_nonce(source_chain); - while n < Self::finalized_vote_nonce(source_chain) { + let mut n = Self::finalized_pay_out_nonce(&req.source_chain); + while n < Self::finalized_vote_nonce(&req.source_chain) { let next_n = n.checked_add(1).ok_or(Error::::FinalizedPayOutNonceOverflow)?; // we are lenient that we don't require `vote` to exist - in practice, it would mean // some relayer didn't follow monotonically increasing pay out nonce (for some reason) - // - // TODO: shall we look for all possible values of `PayOutRequest`? - if let Some(vote) = PayOutVotes::::get((source_chain, next_n), req) { - if vote.is_finalized() { - // this vote can be removed - // TODO: shall we remove votes with all possible PayOutRequests? - PayOutVotes::::remove((source_chain, next_n), req); + if let Some(hashes) = PayOutHashes::::get(&req.source_chain, next_n) { + if hashes.iter().any(|h| { + PayOutVotes::::get(h).map_or_else(|| false, |v| v.is_finalized()) + }) { + for h in hashes { + PayOutVotes::::remove(h); + PayOutRequests::::remove(h); + } + PayOutHashes::::remove(&req.source_chain, next_n); n = next_n; } else { // nothing to do @@ -655,10 +697,10 @@ pub mod pallet { } } - if n > Self::finalized_pay_out_nonce(source_chain) { - FinalizedPayOutNonce::::insert(source_chain, n); + if n > Self::finalized_pay_out_nonce(&req.source_chain) { + FinalizedPayOutNonce::::insert(&req.source_chain, n); Self::deposit_event(Event::FinalizedPayOutNonceUpdated { - source_chain: source_chain.clone(), + source_chain: req.source_chain.clone(), nonce: n, }); } diff --git a/parachain/pallets/omni-bridge/src/mock.rs b/parachain/pallets/omni-bridge/src/mock.rs index 819cd30188..f55a3c0354 100644 --- a/parachain/pallets/omni-bridge/src/mock.rs +++ b/parachain/pallets/omni-bridge/src/mock.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Litentry. If not, see . -use crate::{self as pallet_omni_bridge, ForeignChain, PayInRequest, PayOutRequest}; +use crate::{ + self as pallet_omni_bridge, ChainAsset, ChainType, Nonce, PayInRequest, PayOutRequest, + ResourceId, +}; pub use frame_support::{ assert_ok, derive_impl, parameter_types, traits::{ @@ -59,24 +62,24 @@ pub fn asset_pay_in_request() -> PayInRequest, Balance> new_pay_in_request(NativeOrWithId::WithId(TEST_ASSET), 10) } -pub fn native_symbol() -> Vec { - b"HEI".to_vec() +pub fn new_chain_asset(asset: NativeOrWithId) -> ChainAsset> { + ChainAsset { chain: ChainType::Heima, asset } } -pub fn asset_symbol() -> Vec { - b"TST".to_vec() +pub fn native_resource_id() -> ResourceId { + new_chain_asset(NativeOrWithId::Native).to_resource_id() } -pub fn foreign_chain() -> ForeignChain { - ForeignChain::Ethereum(0) +pub fn asset_resource_id() -> ResourceId { + new_chain_asset(NativeOrWithId::WithId(TEST_ASSET)).to_resource_id() } -pub fn native_pay_out_request() -> PayOutRequest, Balance> { - new_pay_out_request(NativeOrWithId::Native, 10) +pub fn native_pay_out_request(nonce: Nonce) -> PayOutRequest { + new_pay_out_request(nonce, NativeOrWithId::Native, 10) } -pub fn asset_pay_out_request() -> PayOutRequest, Balance> { - new_pay_out_request(NativeOrWithId::WithId(TEST_ASSET), 10) +pub fn asset_pay_out_request(nonce: Nonce) -> PayOutRequest { + new_pay_out_request(nonce, NativeOrWithId::WithId(TEST_ASSET), 10) } frame_support::construct_runtime!( @@ -174,36 +177,36 @@ pub fn new_test_ext(should_init: bool) -> sp_io::TestExternalities { assert_ok!(Assets::mint(RuntimeOrigin::signed(bob()), TEST_ASSET, bob(), 100)); if should_init { - assert_ok!(OmniBridge::set_asset_symbol( + assert_ok!(OmniBridge::set_resource_id( RuntimeOrigin::signed(alice()), - NativeOrWithId::Native, - native_symbol() + new_chain_asset(NativeOrWithId::Native).to_resource_id(), + new_chain_asset(NativeOrWithId::Native) )); assert_ok!(OmniBridge::add_pay_in_pair( RuntimeOrigin::signed(alice()), NativeOrWithId::Native, - (foreign_chain(), native_symbol()) + ChainType::Ethereum(0) )); assert_ok!(OmniBridge::set_pay_in_fee( RuntimeOrigin::signed(alice()), NativeOrWithId::Native, - foreign_chain(), + ChainType::Ethereum(0), 2 )); - assert_ok!(OmniBridge::set_asset_symbol( + assert_ok!(OmniBridge::set_resource_id( RuntimeOrigin::signed(alice()), - NativeOrWithId::WithId(TEST_ASSET), - asset_symbol() + new_chain_asset(NativeOrWithId::WithId(TEST_ASSET)).to_resource_id(), + new_chain_asset(NativeOrWithId::WithId(TEST_ASSET)) )); assert_ok!(OmniBridge::add_pay_in_pair( RuntimeOrigin::signed(alice()), NativeOrWithId::WithId(TEST_ASSET), - (foreign_chain(), asset_symbol()) + ChainType::Ethereum(0) )); assert_ok!(OmniBridge::set_pay_in_fee( RuntimeOrigin::signed(alice()), NativeOrWithId::WithId(TEST_ASSET), - foreign_chain(), + ChainType::Ethereum(0), 3 )); } @@ -217,15 +220,22 @@ pub fn new_pay_in_request( ) -> PayInRequest, Balance> { PayInRequest { asset, - dest_chain: ForeignChain::Ethereum(0), - dest_address: [1u8; 20].to_vec(), + dest_chain: ChainType::Ethereum(0), + dest_account: [1u8; 20].to_vec(), amount, } } pub fn new_pay_out_request( + nonce: Nonce, asset: NativeOrWithId, amount: Balance, -) -> PayOutRequest, Balance> { - PayOutRequest { amount, to: alice(), asset } +) -> PayOutRequest { + PayOutRequest { + source_chain: ChainType::Ethereum(0), + nonce, + resource_id: new_chain_asset(asset).to_resource_id(), + dest_account: alice(), + amount, + } } diff --git a/parachain/pallets/omni-bridge/src/tests.rs b/parachain/pallets/omni-bridge/src/tests.rs index 1d621929aa..561812b753 100644 --- a/parachain/pallets/omni-bridge/src/tests.rs +++ b/parachain/pallets/omni-bridge/src/tests.rs @@ -21,17 +21,11 @@ use frame_support::{assert_noop, assert_ok}; fn default_threshold_works() { new_test_ext(false).execute_with(|| { assert_eq!(OmniBridge::relayer_threshold(), 1); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 0); - }); -} - -#[test] -fn pay_in_with_no_symbol_fails() { - new_test_ext(false).execute_with(|| { - assert_noop!( - OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), - Error::::AssetSymbolNotExist + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 0); + assert_eq!( + hex::encode(native_resource_id()), + "9ee6dfb61a2fb903df487c401663825643bb825d41695e63df8af6162ab145a6".to_string() ); }); } @@ -39,11 +33,6 @@ fn pay_in_with_no_symbol_fails() { #[test] fn pay_in_with_pay_in_pair_not_listed_fails() { new_test_ext(false).execute_with(|| { - assert_ok!(OmniBridge::set_asset_symbol( - RuntimeOrigin::signed(alice()), - NativeOrWithId::Native, - native_symbol() - )); assert_noop!( OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), Error::::PayInPairNotAllowed @@ -54,15 +43,10 @@ fn pay_in_with_pay_in_pair_not_listed_fails() { #[test] fn pay_in_with_pay_in_fee_not_set_fails() { new_test_ext(false).execute_with(|| { - assert_ok!(OmniBridge::set_asset_symbol( - RuntimeOrigin::signed(alice()), - NativeOrWithId::Native, - native_symbol() - )); assert_ok!(OmniBridge::add_pay_in_pair( RuntimeOrigin::signed(alice()), NativeOrWithId::Native, - (foreign_chain(), native_symbol()) + ChainType::Ethereum(0) )); assert_noop!( OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request()), @@ -73,21 +57,11 @@ fn pay_in_with_pay_in_fee_not_set_fails() { #[test] fn pay_in_with_too_low_pay_in_amount_fails() { - new_test_ext(false).execute_with(|| { - assert_ok!(OmniBridge::set_asset_symbol( - RuntimeOrigin::signed(alice()), - NativeOrWithId::Native, - native_symbol() - )); - assert_ok!(OmniBridge::add_pay_in_pair( - RuntimeOrigin::signed(alice()), - NativeOrWithId::Native, - (foreign_chain(), native_symbol()) - )); + new_test_ext(true).execute_with(|| { assert_ok!(OmniBridge::set_pay_in_fee( RuntimeOrigin::signed(alice()), NativeOrWithId::Native, - foreign_chain(), + ChainType::Ethereum(0), 11 // the requested pay-in amount can't cover the fee )); assert_noop!( @@ -114,11 +88,12 @@ fn pay_in_works() { assert_ok!(OmniBridge::pay_in(RuntimeOrigin::signed(alice()), native_pay_in_request())); System::assert_last_event( Event::PaidIn { - from: alice(), + source_account: alice(), nonce: 1, asset: NativeOrWithId::Native, - dest_asset: (foreign_chain(), native_symbol()), - dest_address: [1u8; 20].to_vec(), + resource_id: native_resource_id(), + dest_chain: ChainType::Ethereum(0), + dest_account: [1u8; 20].to_vec(), amount: 8, // 10(amount) - 2(fee) } .into(), @@ -127,11 +102,12 @@ fn pay_in_works() { assert_ok!(OmniBridge::pay_in(RuntimeOrigin::signed(alice()), asset_pay_in_request())); System::assert_last_event( Event::PaidIn { - from: alice(), + source_account: alice(), nonce: 2, // increased asset: NativeOrWithId::WithId(TEST_ASSET), - dest_asset: (foreign_chain(), asset_symbol()), - dest_address: [1u8; 20].to_vec(), + resource_id: asset_resource_id(), + dest_chain: ChainType::Ethereum(0), + dest_account: [1u8; 20].to_vec(), amount: 7, // 10(amount) - 3(fee) } .into(), @@ -149,12 +125,9 @@ fn pay_in_works() { fn pay_out_with_not_relayer_fails() { new_test_ext(true).execute_with(|| { assert_noop!( - OmniBridge::propose_pay_out( + OmniBridge::request_pay_out( RuntimeOrigin::signed(dave()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), true, ), Error::::RequireRelayer @@ -163,18 +136,13 @@ fn pay_out_with_not_relayer_fails() { } #[test] -fn pay_out_with_wrong_symbol_fails() { +fn pay_out_with_wrong_source_chain_fails() { new_test_ext(true).execute_with(|| { + let mut req = native_pay_out_request(1); + req.source_chain = ChainType::Heima; assert_noop!( - OmniBridge::propose_pay_out( - RuntimeOrigin::signed(alice()), - (foreign_chain(), asset_symbol()), // wrong symbol - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), - true, - ), - Error::::AssetSymbolInvalid + OmniBridge::request_pay_out(RuntimeOrigin::signed(alice()), req, true,), + Error::::ChainTypeInvalid ); }); } @@ -182,102 +150,104 @@ fn pay_out_with_wrong_symbol_fails() { #[test] fn pay_out_with_threshold_1_works() { new_test_ext(true).execute_with(|| { - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), true, )); + let hash1 = native_pay_out_request(1).hash(); assert_eq!(Balances::free_balance(alice()), 60); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 1); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 1); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 1); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), None); + assert_eq!(OmniBridge::pay_out_votes(hash1), None); + assert_eq!(OmniBridge::pay_out_requests(hash1), None); + System::assert_has_event( Event::PayOutVoted { who: alice(), - source_chain: foreign_chain(), + source_chain: ChainType::Ethereum(0), nonce: 1, - req: native_pay_out_request(), + asset: NativeOrWithId::Native, + dest_account: alice(), + amount: 10, aye: true, } .into(), ); System::assert_has_event( Event::PaidOut { - to: alice(), + source_chain: ChainType::Ethereum(0), nonce: 1, asset: NativeOrWithId::Native, - source_asset: (foreign_chain(), native_symbol()), - source_address: [1u8; 20].to_vec(), + dest_account: alice(), amount: 10, } .into(), ); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), asset_symbol()), - [1u8; 20].to_vec(), - 2, - asset_pay_out_request(), + asset_pay_out_request(2), true, )); + let hash2 = asset_pay_out_request(2).hash(); assert_eq!(Assets::balance(TEST_ASSET, alice()), 110); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), None); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 2); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 2); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 2), None); + assert_eq!(OmniBridge::pay_out_votes(hash2), None); + assert_eq!(OmniBridge::pay_out_requests(hash2), None); // alice relaying the same request will error out assert_noop!( - OmniBridge::propose_pay_out( + OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), asset_symbol()), - [1u8; 20].to_vec(), - 2, - asset_pay_out_request(), + asset_pay_out_request(2), true, ), Error::::PayOutNonceFinalized ); // bob requests with nay - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 3, - native_pay_out_request(), + native_pay_out_request(3), false, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); + let hash3 = native_pay_out_request(3).hash(); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 2); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 2); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 3), Some(vec![hash3])); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 3), native_pay_out_request()), + OmniBridge::pay_out_votes(hash3), Some(PayOutVote { ayes: vec![], nays: vec![bob()], status: VoteStatus::Pending }) ); + assert_eq!(OmniBridge::pay_out_requests(hash3), Some(native_pay_out_request(3))); // charlie approves it - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 3, - native_pay_out_request(), + native_pay_out_request(3), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 3), native_pay_out_request()), None,); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 3); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 3); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 2), None); + assert_eq!(OmniBridge::pay_out_votes(hash3), None); + assert_eq!(OmniBridge::pay_out_requests(hash3), None); + assert_eq!(Balances::free_balance(alice()), 70); System::assert_has_event( Event::PaidOut { - to: alice(), + source_chain: ChainType::Ethereum(0), nonce: 3, asset: NativeOrWithId::Native, - source_asset: (foreign_chain(), native_symbol()), - source_address: [1u8; 20].to_vec(), + dest_account: alice(), amount: 10, } .into(), @@ -285,58 +255,78 @@ fn pay_out_with_threshold_1_works() { // charlie sends request with non-consecutive nonce (3 -> 6), which is allowed here, // but it probably implies some internal error with charlie - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 6, - native_pay_out_request(), + native_pay_out_request(6), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); // blocked at 3 - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); // updated - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); + let hash4 = native_pay_out_request(4).hash(); + let hash5 = native_pay_out_request(5).hash(); + let hash6 = native_pay_out_request(6).hash(); + + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 3); // blocked at 3 + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 6); // updated + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 4), None); + assert_eq!(OmniBridge::pay_out_votes(hash4), None); + assert_eq!(OmniBridge::pay_out_requests(hash4), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 5), None); + assert_eq!(OmniBridge::pay_out_votes(hash5), None); + assert_eq!(OmniBridge::pay_out_requests(hash5), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 6), Some(vec![hash6])); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), + OmniBridge::pay_out_votes(hash6), Some(PayOutVote { ayes: vec![charlie()], nays: vec![], status: VoteStatus::Passed }) ); + assert_eq!(OmniBridge::pay_out_requests(hash6), Some(native_pay_out_request(6))); + assert_eq!(Balances::free_balance(alice()), 80); // alice sends request with nonce 4 - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 4, - native_pay_out_request(), + native_pay_out_request(4), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 4); // updated to 4 - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); // unchanged - assert_eq!(Balances::free_balance(alice()), 90); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 4); // updated to 4 + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 6); // unchanged + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 4), None); + assert_eq!(OmniBridge::pay_out_votes(hash4), None); + assert_eq!(OmniBridge::pay_out_requests(hash4), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 5), None); + assert_eq!(OmniBridge::pay_out_votes(hash5), None); + assert_eq!(OmniBridge::pay_out_requests(hash5), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 6), Some(vec![hash6])); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), + OmniBridge::pay_out_votes(hash6), Some(PayOutVote { ayes: vec![charlie()], nays: vec![], status: VoteStatus::Passed }) ); + assert_eq!(OmniBridge::pay_out_requests(hash6), Some(native_pay_out_request(6))); + + assert_eq!(Balances::free_balance(alice()), 90); // bob sends request with nonce 5 - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 5, - native_pay_out_request(), + native_pay_out_request(5), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 6); // updated to 6 - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 6); + + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 6); // updated to 6 + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 6); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 4), None); + assert_eq!(OmniBridge::pay_out_votes(hash4), None); + assert_eq!(OmniBridge::pay_out_requests(hash4), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 5), None); + assert_eq!(OmniBridge::pay_out_votes(hash5), None); + assert_eq!(OmniBridge::pay_out_requests(hash5), None); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 6), None); + assert_eq!(OmniBridge::pay_out_votes(hash6), None); + assert_eq!(OmniBridge::pay_out_requests(hash6), None); + assert_eq!(Balances::free_balance(alice()), 100); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 4), native_pay_out_request()), None,); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 5), native_pay_out_request()), None,); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 6), native_pay_out_request()), None,); }); } @@ -344,140 +334,148 @@ fn pay_out_with_threshold_1_works() { fn pay_out_with_threshold_2_works() { new_test_ext(true).execute_with(|| { assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + let hash1 = native_pay_out_request(1).hash(); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); assert_eq!(Balances::free_balance(alice()), 50); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), Some(vec![hash1])); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + OmniBridge::pay_out_votes(hash1), Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) ); + assert_eq!(OmniBridge::pay_out_requests(hash1), Some(native_pay_out_request(1))); System::assert_has_event( Event::PayOutVoted { who: alice(), - source_chain: foreign_chain(), + source_chain: ChainType::Ethereum(0), nonce: 1, - req: native_pay_out_request(), + asset: NativeOrWithId::Native, + dest_account: alice(), + amount: 10, aye: true, } .into(), ); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), false, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); assert_eq!(Balances::free_balance(alice()), 50); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), Some(vec![hash1])); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + OmniBridge::pay_out_votes(hash1), Some(PayOutVote { ayes: vec![alice()], nays: vec![bob()], status: VoteStatus::Pending, }) ); + assert_eq!(OmniBridge::pay_out_requests(hash1), Some(native_pay_out_request(1))); System::assert_has_event( Event::PayOutVoted { who: bob(), - source_chain: foreign_chain(), + source_chain: ChainType::Ethereum(0), nonce: 1, - req: native_pay_out_request(), + asset: NativeOrWithId::Native, + dest_account: alice(), + amount: 10, aye: false, } .into(), ); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 1); assert_eq!(Balances::free_balance(alice()), 60); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), None); + assert_eq!(OmniBridge::pay_out_votes(hash1), None); + assert_eq!(OmniBridge::pay_out_requests(hash1), None); System::assert_has_event( Event::PayOutVoted { who: charlie(), - source_chain: foreign_chain(), + source_chain: ChainType::Ethereum(0), nonce: 1, - req: native_pay_out_request(), + asset: NativeOrWithId::Native, + dest_account: alice(), + amount: 10, aye: true, } .into(), ); System::assert_has_event( Event::PaidOut { - to: alice(), + source_chain: ChainType::Ethereum(0), nonce: 1, asset: NativeOrWithId::Native, - source_asset: (foreign_chain(), native_symbol()), - source_address: [1u8; 20].to_vec(), + dest_account: alice(), amount: 10, } .into(), ); // alice requests with nonce 2, but a different request (with bob and charlie) - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), asset_symbol()), - [1u8; 20].to_vec(), - 2, - asset_pay_out_request(), + asset_pay_out_request(2), true, )); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 2, - native_pay_out_request(), + native_pay_out_request(2), true, )); - // both requests are recorded in different vote entries + let hash2_asset = asset_pay_out_request(2).hash(); + let hash2_native = native_pay_out_request(2).hash(); + + // both requests are recorded assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), + OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 2), + Some(vec![hash2_asset, hash2_native]) + ); + assert_eq!( + OmniBridge::pay_out_votes(hash2_asset), Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) ); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 2), native_pay_out_request()), + OmniBridge::pay_out_votes(hash2_native), Some(PayOutVote { ayes: vec![bob()], nays: vec![], status: VoteStatus::Pending }) ); + assert_eq!(OmniBridge::pay_out_requests(hash2_asset), Some(asset_pay_out_request(2))); + assert_eq!(OmniBridge::pay_out_requests(hash2_native), Some(native_pay_out_request(2))); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 2, - native_pay_out_request(), + native_pay_out_request(2), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 2); // updated to 2 - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 2); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 2); // updated to 2 + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 2); + assert_eq!(Balances::free_balance(alice()), 70); assert_eq!(Assets::balance(TEST_ASSET, alice()), 100); - // native payout request is removed, but asset payout request still exists (and never gets removed) - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 2), native_pay_out_request()), None); - assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 2), asset_pay_out_request()), - Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) - ); + + // should be fully cleaned up + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 2), None); + assert_eq!(OmniBridge::pay_out_votes(hash2_asset), None); + assert_eq!(OmniBridge::pay_out_votes(hash2_native), None); + assert_eq!(OmniBridge::pay_out_requests(hash2_asset), None); + assert_eq!(OmniBridge::pay_out_requests(hash2_native), None); }); } @@ -485,39 +483,33 @@ fn pay_out_with_threshold_2_works() { fn pay_out_with_threshold_2_fail_fast_works() { new_test_ext(true).execute_with(|| { assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); - assert_ok!(OmniBridge::propose_pay_out( + let hash1 = native_pay_out_request(1).hash(); + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), false, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); assert_eq!(Balances::free_balance(alice()), 50); - assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), - Some(PayOutVote { ayes: vec![], nays: vec![alice()], status: VoteStatus::Pending }) - ); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), false, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 1); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 1); assert_eq!(Balances::free_balance(alice()), 50); - assert_eq!(OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), None); + + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), None); + assert_eq!(OmniBridge::pay_out_votes(hash1), None); + assert_eq!(OmniBridge::pay_out_requests(hash1), None); + System::assert_has_event( Event::PayOutRejected { - to: alice(), + source_chain: ChainType::Ethereum(0), nonce: 1, asset: NativeOrWithId::Native, - source_asset: (foreign_chain(), native_symbol()), - source_address: [1u8; 20].to_vec(), + dest_account: alice(), amount: 10, } .into(), @@ -532,34 +524,40 @@ fn pay_out_with_threshold_2_fail_fast_works() { #[test] fn pay_out_with_ahead_of_relayer_works() { new_test_ext(true).execute_with(|| { + use std::collections::HashMap; + + let mut hashes = HashMap::new(); + for i in 1..4 { + hashes.insert(i, native_pay_out_request(i).hash()); + } + assert_ok!(OmniBridge::set_relayer_threshold(RuntimeOrigin::root(), 2)); for i in 1..4 { - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(alice()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - i, - native_pay_out_request(), + native_pay_out_request(i), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); assert_eq!(Balances::free_balance(alice()), 50); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), + OmniBridge::pay_out_votes(hashes[&i]), Some(PayOutVote { ayes: vec![alice()], nays: vec![], status: VoteStatus::Pending }) ); + assert_eq!(OmniBridge::pay_out_requests(hashes[&i]), Some(native_pay_out_request(i))); + assert_eq!( + OmniBridge::pay_out_hashes(ChainType::Ethereum(0), i), + Some(vec![hashes[&i]]) + ); } - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), false, )); assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + OmniBridge::pay_out_votes(hashes[&1]), Some(PayOutVote { ayes: vec![alice()], nays: vec![charlie()], @@ -568,67 +566,69 @@ fn pay_out_with_ahead_of_relayer_works() { ); for i in 2..4 { - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(charlie()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - i, - native_pay_out_request(), + native_pay_out_request(i), true, )); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 0); // not updated - // request with nonce 2 and 3 should be passed and executed + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 0); // not updated + // request with nonce 2 and 3 should be passed and executed assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), + OmniBridge::pay_out_votes(hashes[&i]), Some(PayOutVote { ayes: vec![alice(), charlie()], nays: vec![], status: VoteStatus::Passed, }) ); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), i); + assert_eq!( + OmniBridge::pay_out_hashes(ChainType::Ethereum(0), i), + Some(vec![hashes[&i]]) + ); + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), i); System::assert_has_event( - Event::FinalizedVoteNonceUpdated { source_chain: foreign_chain(), nonce: i }.into(), + Event::FinalizedVoteNonceUpdated { source_chain: ChainType::Ethereum(0), nonce: i } + .into(), ); } assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), 1), native_pay_out_request()), + OmniBridge::pay_out_votes(hashes[&1]), Some(PayOutVote { ayes: vec![alice()], nays: vec![charlie()], status: VoteStatus::Pending, }) ); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), 1), Some(vec![hashes[&1]])); + + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 3); assert_eq!(Balances::free_balance(alice()), 70); - assert_ok!(OmniBridge::propose_pay_out( + assert_ok!(OmniBridge::request_pay_out( RuntimeOrigin::signed(bob()), - (foreign_chain(), native_symbol()), - [1u8; 20].to_vec(), - 1, - native_pay_out_request(), + native_pay_out_request(1), false, )); assert_eq!(Balances::free_balance(alice()), 70); - assert_eq!(OmniBridge::finalized_vote_nonce(foreign_chain()), 3); - assert_eq!(OmniBridge::finalized_pay_out_nonce(foreign_chain()), 3); // updated to 3 + assert_eq!(OmniBridge::finalized_vote_nonce(ChainType::Ethereum(0)), 3); + assert_eq!(OmniBridge::finalized_pay_out_nonce(ChainType::Ethereum(0)), 3); // updated to 3 + + // should be fully cleaned up for i in 1..4 { - assert_eq!( - OmniBridge::pay_out_votes((foreign_chain(), i), native_pay_out_request()), - None - ); + assert_eq!(OmniBridge::pay_out_hashes(ChainType::Ethereum(0), i), None); + assert_eq!(OmniBridge::pay_out_votes(hashes[&i]), None); + assert_eq!(OmniBridge::pay_out_requests(hashes[&i]), None); } System::assert_has_event( - Event::FinalizedPayOutNonceUpdated { source_chain: foreign_chain(), nonce: 3 }.into(), + Event::FinalizedPayOutNonceUpdated { source_chain: ChainType::Ethereum(0), nonce: 3 } + .into(), ); System::assert_has_event( Event::PayOutRejected { - to: alice(), + source_chain: ChainType::Ethereum(0), nonce: 1, asset: NativeOrWithId::Native, - source_asset: (foreign_chain(), native_symbol()), - source_address: [1u8; 20].to_vec(), + dest_account: alice(), amount: 10, } .into(), diff --git a/parachain/runtime/common/src/lib.rs b/parachain/runtime/common/src/lib.rs index 1379667701..2fb346c6b5 100644 --- a/parachain/runtime/common/src/lib.rs +++ b/parachain/runtime/common/src/lib.rs @@ -313,7 +313,7 @@ where fn try_origin(o: T::RuntimeOrigin) -> Result { o.into().and_then(|o| match o { frame_system::RawOrigin::Signed(who) - if pallet_omni_bridge::Relayer::::contains_key(&who) => + if pallet_omni_bridge::Relayers::::contains_key(&who) => { Ok(who) }, From 3637f3c45b061384c46fce9f3fa567e3467d5124 Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 7 Jan 2025 10:07:12 +0000 Subject: [PATCH 14/16] fix benchmarks --- parachain/runtime/common/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/parachain/runtime/common/src/lib.rs b/parachain/runtime/common/src/lib.rs index 2fb346c6b5..1c048a33f3 100644 --- a/parachain/runtime/common/src/lib.rs +++ b/parachain/runtime/common/src/lib.rs @@ -313,7 +313,7 @@ where fn try_origin(o: T::RuntimeOrigin) -> Result { o.into().and_then(|o| match o { frame_system::RawOrigin::Signed(who) - if pallet_omni_bridge::Relayers::::contains_key(&who) => + if pallet_omni_bridge::Relayers::::get(&who).is_some() => { Ok(who) }, @@ -323,9 +323,7 @@ where #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin() -> Result { - let zero_account_id = - T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) - .expect("infinite length input; no invalid inputs for type; qed"); - Ok((RawOrigin::OmniAccount(zero_account_id)).into()) + let zero_account_id: T::AccountId = [0u8; 32].into(); + Ok((frame_system::RawOrigin::Signed(zero_account_id)).into()) } } From f78b16f2f2abe63af8b7cf3ec9cca231d715f55e Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Tue, 7 Jan 2025 13:43:40 +0000 Subject: [PATCH 15/16] bump versions --- parachain/runtime/litentry/src/lib.rs | 2 +- parachain/runtime/paseo/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parachain/runtime/litentry/src/lib.rs b/parachain/runtime/litentry/src/lib.rs index 80e06926d1..6f51241314 100644 --- a/parachain/runtime/litentry/src/lib.rs +++ b/parachain/runtime/litentry/src/lib.rs @@ -230,7 +230,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("litentry-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9220, + spec_version: 9222, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index c25067d415..53a4302ca9 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -233,7 +233,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("paseo-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9221, + spec_version: 9222, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 6444c2db87972cf07f7eddfbfdd5a2e59f50b08d Mon Sep 17 00:00:00 2001 From: Kailai Wang Date: Wed, 8 Jan 2025 19:37:51 +0000 Subject: [PATCH 16/16] bump versions --- parachain/runtime/litentry/src/lib.rs | 2 +- parachain/runtime/paseo/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parachain/runtime/litentry/src/lib.rs b/parachain/runtime/litentry/src/lib.rs index 8582b182d8..94d830f6bd 100644 --- a/parachain/runtime/litentry/src/lib.rs +++ b/parachain/runtime/litentry/src/lib.rs @@ -232,7 +232,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("litentry-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9222, + spec_version: 9223, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index 8a7f540e02..b476273f2d 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -235,7 +235,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("paseo-parachain"), authoring_version: 1, // same versioning-mechanism as polkadot: use last digit for minor updates - spec_version: 9222, + spec_version: 9223, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,