Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

To polkadot-v0.9.37 #266

Merged
merged 25 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2,214 changes: 1,483 additions & 731 deletions Cargo.lock

Large diffs are not rendered by default.

596 changes: 298 additions & 298 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fc-cli = { workspace = true }
fc-consensus = { workspace = true }
fc-db = { workspace = true }
fc-mapping-sync = { workspace = true }
fc-rpc = { features = ["rpc_binary_search_estimate"], workspace = true }
fc-rpc = { features = ["rpc-binary-search-estimate"], workspace = true }
fc-rpc-core = { workspace = true }
fp-evm = { workspace = true }
fp-rpc = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,24 +614,28 @@ pub fn run() -> Result<()> {
let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;

#[cfg(feature = "crab-native")]
if chain_spec.is_crab() {
return runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<CrabRuntimeExecutor>>(), task_manager))
});
}

#[cfg(feature = "darwinia-native")]
if chain_spec.is_darwinia() {
return runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<DarwiniaRuntimeExecutor>>(), task_manager))
});
}

#[cfg(feature = "pangolin-native")]
if chain_spec.is_pangolin() {
return runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<PangolinRuntimeExecutor>>(), task_manager))
});
}

#[cfg(feature = "pangoro-native")]
if chain_spec.is_pangoro() {
return runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<PangoroRuntimeExecutor>>(), task_manager))
Expand Down
1 change: 1 addition & 0 deletions pallet/account-migration/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl pallet_assets::Config for Runtime {
type AssetId = AssetId;
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
type CallbackHandle = ();
type CreateOrigin =
frame_support::traits::AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type Currency = Balances;
Expand Down
1 change: 1 addition & 0 deletions pallet/deposit/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl pallet_assets::Config for Runtime {
type AssetId = AssetId;
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<()>, u32>,
>;
Expand Down
4 changes: 2 additions & 2 deletions pallet/message-gadget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use frame_support::{log, pallet_prelude::*, traits::Get};
use frame_system::pallet_prelude::*;
use sp_core::{H160, H256};
use sp_io::hashing;
use sp_std::vec;
use sp_std::prelude::*;
aurexav marked this conversation as resolved.
Show resolved Hide resolved

#[frame_support::pallet]
pub mod pallet {
Expand Down Expand Up @@ -88,7 +88,7 @@ where
None,
None,
None,
vec![],
Vec::new(),
false,
false,
<T as pallet_evm::Config>::config(),
Expand Down
1 change: 1 addition & 0 deletions pallet/message-gadget/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = ();
type PrecompilesValue = ();
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
1 change: 1 addition & 0 deletions pallet/message-transact/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = ();
type PrecompilesValue = ();
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
1 change: 1 addition & 0 deletions pallet/staking/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl pallet_assets::Config for Runtime {
type AssetId = AssetId;
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<()>, u32>,
>;
Expand Down
2 changes: 2 additions & 0 deletions precompile/assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = TestPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand All @@ -177,6 +178,7 @@ impl pallet_assets::Config for TestRuntime {
type AssetId = AssetId;
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<()>, AccountId>,
>;
Expand Down
2 changes: 1 addition & 1 deletion precompile/bls12-381/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use milagro_bls::{AggregatePublicKey, AggregateSignature, PublicKey, Signature};
// moonbeam
use precompile_utils::prelude::*;
// substrate
use sp_std::vec::Vec;
use sp_std::prelude::*;

pub(crate) const VERIFY_ESTIMATED_COST: u64 = 100_000;
pub struct BLS12381<T>(PhantomData<T>);
Expand Down
1 change: 1 addition & 0 deletions precompile/deposit/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = TestPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
2 changes: 1 addition & 1 deletion precompile/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use frame_support::{
};
use sp_core::{H160, U256};
use sp_runtime::Perbill;
use sp_std::vec::Vec;
use sp_std::prelude::*;

pub struct Staking<Runtime>(PhantomData<Runtime>);

Expand Down
1 change: 1 addition & 0 deletions precompile/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = TestPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
1 change: 1 addition & 0 deletions precompile/state-storage/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = TestPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
6 changes: 6 additions & 0 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ xcm-executor = { workspace = true }
# substrate
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-assets = { workspace = true }
pallet-balances = { workspace = true }
pallet-collective = { workspace = true }
pallet-treasury = { workspace = true }
Expand Down Expand Up @@ -58,6 +59,7 @@ std = [
# substrate
"frame-support/std",
"frame-system/std",
"pallet-assets/std",
"pallet-balances/std",
"pallet-collective/std",
"pallet-treasury/std",
Expand All @@ -67,3 +69,7 @@ std = [
]

test = []

runtime-benchmarks = [
"pallet-assets/runtime-benchmarks"
]
10 changes: 10 additions & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,13 @@ macro_rules! impl_self_contained_call {
}
};
}

/// Helper for pallet-assets benchmarking.
#[cfg(feature = "runtime-benchmarks")]
pub struct AssetsBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_assets::BenchmarkHelper<codec::Compact<u64>> for AssetsBenchmarkHelper {
fn create_asset_id_parameter(id: u32) -> codec::Compact<u64> {
u64::from(id).into()
}
}
3 changes: 3 additions & 0 deletions runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ runtime-benchmarks = [
# cumulus optional
"cumulus-pallet-session-benchmarking/runtime-benchmarks",

# darwinia
"darwinia-common-runtime/runtime-benchmarks",

# darwinia-messages-substrate
"bridge-runtime-common/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
Expand Down
5 changes: 2 additions & 3 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ frame_benchmarking::define_benchmarks! {
[pallet_balances, Balances]
[pallet_session, SessionBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[cumulus_pallet_xcmp_queue, XcmpQueue]
}

Expand Down Expand Up @@ -547,7 +546,7 @@ sp_api::impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) {
// substrate
use frame_support::log;

Expand All @@ -563,7 +562,7 @@ sp_api::impl_runtime_apis! {
state_root_check: bool,
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Weight {
) -> frame_support::weights::Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
Expand Down
3 changes: 2 additions & 1 deletion runtime/crab/src/pallets/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime {
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type BenchmarkHelper = AssetsBenchmarkHelper;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<Creators>, AccountId>,
>;
Expand Down
1 change: 1 addition & 0 deletions runtime/crab/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = CrabPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
4 changes: 3 additions & 1 deletion runtime/crab/src/pallets/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::Staking => {
matches!(
c,
RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..)
RuntimeCall::Session(..)
| RuntimeCall::Deposit(..)
| RuntimeCall::DarwiniaStaking(..)
)
},
ProxyType::IdentityJudgement =>
Expand Down
3 changes: 3 additions & 0 deletions runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ runtime-benchmarks = [
# cumulus optional
"cumulus-pallet-session-benchmarking/runtime-benchmarks",

# darwinia
"darwinia-common-runtime/runtime-benchmarks",

# darwinia-messages-substrate
"bridge-runtime-common/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
Expand Down
5 changes: 2 additions & 3 deletions runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ frame_benchmarking::define_benchmarks! {
[pallet_balances, Balances]
[pallet_session, SessionBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[cumulus_pallet_xcmp_queue, XcmpQueue]
}

Expand Down Expand Up @@ -548,7 +547,7 @@ sp_api::impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) {
// substrate
use frame_support::log;

Expand All @@ -564,7 +563,7 @@ sp_api::impl_runtime_apis! {
state_root_check: bool,
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Weight {
) -> frame_support::weights::Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
Expand Down
3 changes: 2 additions & 1 deletion runtime/darwinia/src/pallets/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime {
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type BenchmarkHelper = AssetsBenchmarkHelper;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<Creators>, AccountId>,
>;
Expand Down
1 change: 1 addition & 0 deletions runtime/darwinia/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = DarwiniaPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
4 changes: 3 additions & 1 deletion runtime/darwinia/src/pallets/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::Staking => {
matches!(
c,
RuntimeCall::Session(..) | RuntimeCall::Deposit(..) | RuntimeCall::DarwiniaStaking(..)
RuntimeCall::Session(..)
| RuntimeCall::Deposit(..)
| RuntimeCall::DarwiniaStaking(..)
)
},
ProxyType::IdentityJudgement =>
Expand Down
3 changes: 3 additions & 0 deletions runtime/pangolin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ runtime-benchmarks = [
# cumulus optional
"cumulus-pallet-session-benchmarking/runtime-benchmarks",

# darwinia
"darwinia-common-runtime/runtime-benchmarks",

# darwinia-messages-substrate
"bridge-runtime-common/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
Expand Down
5 changes: 2 additions & 3 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ frame_benchmarking::define_benchmarks! {
[pallet_balances, Balances]
[pallet_session, SessionBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
[cumulus_pallet_xcmp_queue, XcmpQueue]
}

Expand Down Expand Up @@ -529,7 +528,7 @@ sp_api::impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, frame_support::weights::Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (frame_support::weights::Weight, frame_support::weights::Weight) {
// substrate
use frame_support::log;

Expand All @@ -545,7 +544,7 @@ sp_api::impl_runtime_apis! {
state_root_check: bool,
signature_check: bool,
select: frame_try_runtime::TryStateSelect,
) -> Weight {
) -> frame_support::weights::Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
Expand Down
5 changes: 3 additions & 2 deletions runtime/pangolin/src/migration.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// darwinia
#[allow(unused_imports)]
use crate::*;
// substrate

pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
Ok(())
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
Ok(Vec::new())
}

#[cfg(feature = "try-runtime")]
Expand Down
3 changes: 2 additions & 1 deletion runtime/pangolin/src/pallets/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl pallet_assets::Config for Runtime {
type AssetIdParameter = codec::Compact<AssetId>;
type Balance = Balance;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type BenchmarkHelper = AssetsBenchmarkHelper;
type CallbackHandle = ();
type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg<
frame_system::EnsureSignedBy<frame_support::traits::IsInVec<Creators>, AccountId>,
>;
Expand Down
1 change: 1 addition & 0 deletions runtime/pangolin/src/pallets/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = ();
type OnCreate = ();
type PrecompilesType = PangolinPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
Expand Down
Loading