Skip to content

Commit

Permalink
Bump to polkadot 0.9.37 (#1938)
Browse files Browse the repository at this point in the history
* bump to 0.9.37

* add CallbackHandle to pallet_assets

* add OnCreate to pallet_evm

* update type

* fix tests

* update runtime migration

* fix ci error
  • Loading branch information
mclyk authored May 30, 2023
1 parent f85c7ed commit c0b0d84
Show file tree
Hide file tree
Showing 26 changed files with 2,236 additions and 1,368 deletions.
3,097 changes: 1,963 additions & 1,134 deletions Cargo.lock

Large diffs are not rendered by default.

412 changes: 208 additions & 204 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-tests/src/kusama_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn transfer_to_relay_chain() {
println!("heiko para account in relaychain:{:?}", para_acc);
assert_eq!(
kusama_runtime::Balances::free_balance(&AccountId::from(BOB)),
999_896_665_870
999_895_428_355
);
});
}
2 changes: 1 addition & 1 deletion integration-tests/src/polkadot_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn transfer_to_relay_chain() {
println!("parallel para account in relaychain:{:?}", para_acc);
assert_eq!(
polkadot_runtime::Balances::free_balance(&AccountId::from(BOB)),
99_591_353_032
99_578_565_860
);
});
}
Expand Down
19 changes: 11 additions & 8 deletions node/parallel/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,25 @@ impl sc_client_api::BlockBackend<Block> for Client {
}
}

fn block(&self, id: &BlockId) -> sp_blockchain::Result<Option<SignedBlock<Block>>> {
fn block(
&self,
hash: <Block as BlockT>::Hash,
) -> sp_blockchain::Result<Option<SignedBlock<Block>>> {
with_client! {
self,
client,
{
client.block(id)
client.block(hash)
}
}
}

fn block_status(&self, id: &BlockId) -> sp_blockchain::Result<BlockStatus> {
fn block_status(&self, hash: <Block as BlockT>::Hash) -> sp_blockchain::Result<BlockStatus> {
with_client! {
self,
client,
{
client.block_status(id)
client.block_status(hash)
}
}
}
Expand Down Expand Up @@ -455,12 +458,12 @@ impl sc_client_api::StorageProvider<Block, crate::service::FullBackend> for Clie
}

impl sp_blockchain::HeaderBackend<Block> for Client {
fn header(&self, id: BlockId) -> sp_blockchain::Result<Option<Header>> {
fn header(&self, hash: Hash) -> sp_blockchain::Result<Option<Header>> {
with_client! {
self,
client,
{
client.header(&id)
client.header(hash)
}
}
}
Expand All @@ -475,12 +478,12 @@ impl sp_blockchain::HeaderBackend<Block> for Client {
}
}

fn status(&self, id: BlockId) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
fn status(&self, hash: Hash) -> sp_blockchain::Result<sp_blockchain::BlockStatus> {
with_client! {
self,
client,
{
client.status(id)
client.status(hash)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions pallets/amm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/bridge/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/crowdloans/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ impl pallet_assets::Config for Test {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/evm-signatures/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/farming/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/liquid-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ impl pallet_assets::Config for Test {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/loans/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/prices/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/router/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/stableswap/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/streaming/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl pallet_assets::Config for Test {
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions pallets/xcm-helper/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ impl pallet_assets::Config for Test {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
2 changes: 2 additions & 0 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ impl pallet_evm::Config for Runtime {
type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping<Self>;
type FindAuthor = ();
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

// These parameters dont matter much as this will only be called by root with the forced arguments
Expand Down Expand Up @@ -253,6 +254,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down
1 change: 1 addition & 0 deletions precompiles/balances-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl pallet_evm::Config for Runtime {
type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping<Self>;
type FindAuthor = ();
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

// Configure a mock runtime to test the pallet.
Expand Down
17 changes: 8 additions & 9 deletions precompiles/utils/macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[package]
name = "precompile-utils-macro"
authors = ["StakeTechnologies", "PureStake"]
description = ""
edition = "2018"
version = "0.1.0"
authors = { workspace = true }
edition = "2021"
version = { workspace = true }

[lib]
proc-macro = true
Expand All @@ -13,8 +12,8 @@ name = "tests"
path = "tests/tests.rs"

[dependencies]
num_enum = { version = "0.5.3", default-features = false }
proc-macro2 = "1.0"
quote = "1.0"
sha3 = "0.8"
syn = { version = "1.0", features = ["extra-traits", "fold", "full", "visit"] }
num_enum = { workspace = true }
sha3 = { workspace = true }
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["extra-traits", "fold", "full", "visit"] }
4 changes: 2 additions & 2 deletions precompiles/utils/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl ::std::fmt::Debug for Bytes {
pub fn keccak256(input: TokenStream) -> TokenStream {
let lit_str = parse_macro_input!(input as LitStr);

let hash = Keccak256::digest(lit_str.value().as_ref());
let hash = Keccak256::digest(lit_str.value().as_bytes());

let bytes = Bytes(hash.to_vec());
let eval_str = format!("{:?}", bytes);
Expand Down Expand Up @@ -100,7 +100,7 @@ pub fn generate_function_selector(_: TokenStream, input: TokenStream) -> TokenSt
Some((_, Expr::Lit(ExprLit { lit, .. }))) => {
if let Lit::Str(lit_str) = lit {
let selector = u32::from_be_bytes(
Keccak256::digest(lit_str.value().as_ref())[..4]
Keccak256::digest(lit_str.value().as_bytes())[..4]
.try_into()
.unwrap(),
);
Expand Down
6 changes: 3 additions & 3 deletions precompiles/utils/macro/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub enum Action {
fn test_keccak256() {
assert_eq!(
&precompile_utils_macro::keccak256!(""),
Keccak256::digest(b"").as_ref(),
Keccak256::digest(b"").as_slice(),
);
assert_eq!(
&precompile_utils_macro::keccak256!("toto()"),
Keccak256::digest(b"toto()").as_ref(),
Keccak256::digest(b"toto()").as_slice(),
);
assert_ne!(
&precompile_utils_macro::keccak256!("toto()"),
Keccak256::digest(b"tata()").as_ref(),
Keccak256::digest(b"tata()").as_slice(),
);
}

Expand Down
11 changes: 9 additions & 2 deletions runtime/heiko/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ impl pallet_assets::Config for Runtime {
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down Expand Up @@ -859,6 +860,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type FindAuthor = FindAuthorTruncated<Aura>;
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

impl pallet_ethereum::Config for Runtime {
Expand Down Expand Up @@ -2042,7 +2044,12 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(),
(
pallet_balances::migration::ResetInactive<Runtime>,
// We need to apply this migration again, because `ResetInactive` resets the state again.
pallet_balances::migration::MigrateToTrackInactive<Runtime, CheckingAccount>,
pallet_scheduler::migration::v4::CleanupAgendas<Runtime>,
),
>;

impl fp_self_contained::SelfContainedCall for RuntimeCall {
Expand Down Expand Up @@ -2520,7 +2527,7 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade.");
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
Expand Down
4 changes: 3 additions & 1 deletion runtime/kerria/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ impl pallet_assets::Config for Runtime {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down Expand Up @@ -846,6 +847,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type FindAuthor = FindAuthorTruncated<Aura>;
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

impl pallet_ethereum::Config for Runtime {
Expand Down Expand Up @@ -2499,7 +2501,7 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade.");
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
Expand Down
11 changes: 9 additions & 2 deletions runtime/parallel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ impl pallet_assets::Config for Runtime {
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down Expand Up @@ -862,6 +863,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type FindAuthor = FindAuthorTruncated<Aura>;
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

impl pallet_ethereum::Config for Runtime {
Expand Down Expand Up @@ -2045,7 +2047,12 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(),
(
pallet_balances::migration::ResetInactive<Runtime>,
// We need to apply this migration again, because `ResetInactive` resets the state again.
pallet_balances::migration::MigrateToTrackInactive<Runtime, CheckingAccount>,
pallet_scheduler::migration::v4::CleanupAgendas<Runtime>,
),
>;

impl fp_self_contained::SelfContainedCall for RuntimeCall {
Expand Down Expand Up @@ -2523,7 +2530,7 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade.");
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
Expand Down
4 changes: 3 additions & 1 deletion runtime/vanilla/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ impl pallet_assets::Config for Runtime {
type WeightInfo = ();
type Extra = ();
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down Expand Up @@ -847,6 +848,7 @@ impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type FindAuthor = FindAuthorTruncated<Aura>;
type WeightPerGas = WeightPerGas;
type OnCreate = ();
}

impl pallet_ethereum::Config for Runtime {
Expand Down Expand Up @@ -2529,7 +2531,7 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade.");
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
Expand Down

0 comments on commit c0b0d84

Please sign in to comment.