Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Prepare polkadot v0.9.36 for Darwinia-2.0 #242

Merged
merged 10 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
483 changes: 417 additions & 66 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions modules/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ scale-info = { version = "2.1", default-features = false, features = ["derive"]
bp-message-dispatch = { default-features = false, path = "../../primitives/message-dispatch" }
bp-runtime = { default-features = false, path = "../../primitives/runtime" }
# paritytech
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
pallet-root-testing = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
boundless-forest marked this conversation as resolved.
Show resolved Hide resolved
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[features]
default = ["std"]
Expand All @@ -35,6 +36,7 @@ std = [
# paritytech
"frame-support/std",
"frame-system/std",
"pallet-root-testing/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
Expand Down
7 changes: 5 additions & 2 deletions modules/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ mod tests {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
RootTesting: pallet_root_testing,
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Dispatch: call_dispatch::{Pallet, Call, Event<T>},
}
Expand All @@ -554,6 +555,8 @@ mod tests {
pub const AvailableBlockRatio: Perbill = Perbill::one();
}

impl pallet_root_testing::Config for TestRuntime {}

impl frame_system::Config for TestRuntime {
type AccountData = ();
type AccountId = AccountId;
Expand Down Expand Up @@ -618,7 +621,7 @@ mod tests {
call: &RuntimeCall,
) -> Result<(), TransactionValidityError> {
match call {
RuntimeCall::System(frame_system::Call::fill_block { .. }) =>
RuntimeCall::RootTesting(pallet_root_testing::Call::fill_block { .. }) =>
Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),
_ => Ok(()),
}
Expand Down Expand Up @@ -887,7 +890,7 @@ mod tests {
let id = [0; 4];
let relayer_account = 1;

let call = RuntimeCall::System(frame_system::Call::fill_block {
let call = RuntimeCall::RootTesting(pallet_root_testing::Call::fill_block {
ratio: Perbill::from_percent(75),
});
let weight = call.get_dispatch_info().weight;
Expand Down
18 changes: 9 additions & 9 deletions modules/fee-market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ version = "0.1.0"
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
# paritytech
frame-benchmarking = { optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33", default-features = false }
frame-benchmarking = { optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36", default-features = false }
# darwinia-bridges-substrate
bp-messages = { default-features = false, path = "../../primitives/messages" }
bp-runtime = { default-features = false, path = "../../primitives/runtime" }

[dev-dependencies]
bitvec = { version = "1" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
pallet-bridge-messages = { path = "../messages" }

[features]
Expand Down
7 changes: 7 additions & 0 deletions modules/fee-market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ pub mod pallet {
/// Any accounts can enroll to be a relayer by lock collateral. The relay fee is optional,
/// the default value is MinimumRelayFee in runtime. (Update market needed)
/// Note: One account can enroll only once.
#[pallet::call_index(0)]
#[pallet::weight(<T as Config<I>>::WeightInfo::enroll_and_lock_collateral())]
pub fn enroll_and_lock_collateral(
origin: OriginFor<T>,
Expand Down Expand Up @@ -292,6 +293,7 @@ pub mod pallet {
}

/// Increase relayer's locked collateral
#[pallet::call_index(1)]
#[pallet::weight(<T as Config<I>>::WeightInfo::increase_locked_collateral())]
pub fn increase_locked_collateral(
origin: OriginFor<T>,
Expand Down Expand Up @@ -329,6 +331,7 @@ pub mod pallet {
}

/// Decrease relayer's locked collateral
#[pallet::call_index(2)]
#[pallet::weight(<T as Config<I>>::WeightInfo::decrease_locked_collateral())]
pub fn decrease_locked_collateral(
origin: OriginFor<T>,
Expand Down Expand Up @@ -373,6 +376,7 @@ pub mod pallet {
}

/// Update relay fee for enrolled relayer. (Update market needed)
#[pallet::call_index(3)]
#[pallet::weight(<T as Config<I>>::WeightInfo::update_relay_fee())]
pub fn update_relay_fee(origin: OriginFor<T>, new_fee: BalanceOf<T, I>) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -393,6 +397,7 @@ pub mod pallet {
}

/// Cancel enrolled relayer(Update market needed)
#[pallet::call_index(4)]
#[pallet::weight(<T as Config<I>>::WeightInfo::cancel_enrollment())]
pub fn cancel_enrollment(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand Down Expand Up @@ -420,6 +425,7 @@ pub mod pallet {
)
}

#[pallet::call_index(5)]
#[pallet::weight(<T as Config<I>>::WeightInfo::set_slash_protect())]
pub fn set_slash_protect(
origin: OriginFor<T>,
Expand All @@ -431,6 +437,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(6)]
#[pallet::weight(<T as Config<I>>::WeightInfo::set_assigned_relayers_number())]
pub fn set_assigned_relayers_number(origin: OriginFor<T>, number: u32) -> DispatchResult {
ensure_root(origin)?;
Expand Down
18 changes: 9 additions & 9 deletions modules/grandpa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ bp-header-chain = { default-features = false, path = "../../primitives/header-ch
bp-runtime = { default-features = false, path = "../../primitives/runtime" }
bp-test-utils = { optional = true, default-features = false, path = "../../primitives/test-utils" }
# paritytech
frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-finality-grandpa = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-trie = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-finality-grandpa = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-trie = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[dev-dependencies]
# paritytech
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[features]
default = ["std"]
Expand Down
4 changes: 4 additions & 0 deletions modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ pub mod pallet {
///
/// If successful in verification, it will write the target header to the underlying storage
/// pallet.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::submit_finality_proof(
justification.commit.precommits.len().try_into().unwrap_or(u32::MAX),
justification.votes_ancestries.len().try_into().unwrap_or(u32::MAX),
Expand Down Expand Up @@ -245,6 +246,7 @@ pub mod pallet {
/// This function is only allowed to be called from a trusted origin and writes to storage
/// with practically no checks in terms of the validity of the data. It is important that
/// you ensure that valid data is being passed in.
#[pallet::call_index(1)]
#[pallet::weight((T::DbWeight::get().reads_writes(2, 5), DispatchClass::Operational))]
pub fn initialize(
origin: OriginFor<T>,
Expand All @@ -268,6 +270,7 @@ pub mod pallet {
/// Change `PalletOwner`.
///
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(2)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_owner(origin: OriginFor<T>, new_owner: Option<T::AccountId>) -> DispatchResult {
<Self as OwnedBridgeModule<_>>::set_owner(origin, new_owner)
Expand All @@ -276,6 +279,7 @@ pub mod pallet {
/// Halt or resume all pallet operations.
///
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(3)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_operating_mode(
origin: OriginFor<T>,
Expand Down
5 changes: 2 additions & 3 deletions modules/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::{
weights::Weight,
};
use frame_system::mocking::*;
use sp_core::sr25519::Signature;
use sp_core::{sr25519::Signature, ConstU64};
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, IdentityLookup},
Expand Down Expand Up @@ -55,7 +55,6 @@ frame_support::construct_runtime! {
}

frame_support::parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
Expand All @@ -64,7 +63,7 @@ impl frame_system::Config for TestRuntime {
type AccountData = ();
type AccountId = AccountId;
type BaseCallFilter = Everything;
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type BlockLength = ();
type BlockNumber = u64;
type BlockWeights = ();
Expand Down
16 changes: 8 additions & 8 deletions modules/messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ bp-message-dispatch = { default-features = false, path = "../../primitives/messa
bp-messages = { default-features = false, path = "../../primitives/messages" }
bp-runtime = { default-features = false, path = "../../primitives/runtime" }
# paritytech
frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
frame-benchmarking = { optional = true, default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[dev-dependencies]
# darwinia-network
bp-test-utils = { path = "../../primitives/test-utils" }
# paritytech
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.33" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }

[features]
default = ["std"]
Expand Down
4 changes: 4 additions & 0 deletions modules/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ pub mod pallet {
/// Change `PalletOwner`.
///
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(0)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_owner(origin: OriginFor<T>, new_owner: Option<T::AccountId>) -> DispatchResult {
<Self as OwnedBridgeModule<_>>::set_owner(origin, new_owner)
Expand All @@ -239,6 +240,7 @@ pub mod pallet {
/// Halt or resume all/some pallet operations.
///
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(1)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_operating_mode(
origin: OriginFor<T>,
Expand All @@ -253,6 +255,7 @@ pub mod pallet {
///
/// The weight is: single read for permissions check + 2 writes for parameter value and
/// event.
#[pallet::call_index(2)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 2), DispatchClass::Operational))]
pub fn update_pallet_parameter(
origin: OriginFor<T>,
Expand All @@ -265,6 +268,7 @@ pub mod pallet {
}

/// Send message over lane.
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::send_message_weight(payload, T::DbWeight::get()))]
pub fn send_message(
origin: OriginFor<T>,
Expand Down
10 changes: 3 additions & 7 deletions modules/messages/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use frame_support::{
weights::{RuntimeDbWeight, Weight},
};
use frame_system::mocking::*;
use sp_core::H256;
use sp_core::{ConstU64, H256};
use sp_runtime::{
testing::Header as SubstrateHeader,
traits::{BlakeTwo256, IdentityLookup},
Expand Down Expand Up @@ -128,7 +128,6 @@ frame_support::construct_runtime! {
}

parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
Expand All @@ -138,7 +137,7 @@ impl frame_system::Config for TestRuntime {
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountId;
type BaseCallFilter = frame_support::traits::Everything;
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type BlockLength = ();
type BlockNumber = u64;
type BlockWeights = ();
Expand All @@ -161,14 +160,11 @@ impl frame_system::Config for TestRuntime {
type Version = ();
}

parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Config for TestRuntime {
type AccountStore = frame_system::Pallet<TestRuntime>;
type Balance = Balance;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<1>;
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = ();
Expand Down
Loading