Skip to content

Commit

Permalink
chore(upgrade): v1.8.0 to v1.9.0 (#2099)
Browse files Browse the repository at this point in the history
- Upgrade Polkadot-sdk to v.1.9.0.
- Update weights to reflect the new version.

Notable Changes:
- [System
Callbacks](paritytech/polkadot-sdk#1781)
- [Remove of pallet
pallet::getter](paritytech/polkadot-sdk#3456)
- [Add storage_proof_size host
function](paritytech/polkadot-sdk#3002)
- [Rename of storage version
function](https://github.com/paritytech/polkadot-sdk/pull/1554/files#diff-01dc4f43df9baa537f30c6b369525715d596a3068944f38458e9f160d5412d58R306)

For more details, please refer to:

[Release
Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.9.0)
  • Loading branch information
enddynayn authored Jul 26, 2024
1 parent 2676db8 commit 21f1bde
Show file tree
Hide file tree
Showing 23 changed files with 826 additions and 702 deletions.
1,173 changes: 613 additions & 560 deletions Cargo.lock

Large diffs are not rendered by default.

197 changes: 99 additions & 98 deletions Cargo.toml

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions node/service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ pub mod frequency_executor {

impl sc_executor::NativeExecutionDispatch for FrequencyExecutorDispatch {
#[cfg(feature = "runtime-benchmarks")]
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
type ExtendHostFunctions = (
frame_benchmarking::benchmarking::HostFunctions,
cumulus_client_service::storage_proof_size::HostFunctions,
);

#[cfg(not(feature = "runtime-benchmarks"))]
type ExtendHostFunctions = ();
type ExtendHostFunctions = cumulus_client_service::storage_proof_size::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
frequency_runtime::api::dispatch(method, data)
Expand Down
5 changes: 5 additions & 0 deletions pallets/capacity/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

impl pallet_balances::Config for Test {
Expand Down
5 changes: 5 additions & 0 deletions pallets/frequency-tx-payment/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

impl pallet_balances::Config for Test {
Expand Down
5 changes: 5 additions & 0 deletions pallets/handles/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

impl pallet_handles::Config for Test {
Expand Down
2 changes: 1 addition & 1 deletion pallets/messages/src/migration/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV2<T> {
pub fn migrate_to_v2<T: Config>() -> Weight {
log::info!(target: LOG_TARGET, "Running storage migration...");
let onchain_version = Pallet::<T>::on_chain_storage_version();
let current_version = Pallet::<T>::current_storage_version();
let current_version = Pallet::<T>::in_code_storage_version();
log::info!(target: LOG_TARGET, "onchain_version= {:?}, current_version={:?}", onchain_version, current_version);

if onchain_version < 2 {
Expand Down
5 changes: 5 additions & 0 deletions pallets/messages/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ impl system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

pub type MaxSchemaGrantsPerDelegation = ConstU32<30>;
Expand Down
2 changes: 1 addition & 1 deletion pallets/messages/src/tests/other_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ fn migration_to_v2_should_work_as_expected() {

let old_count = v2::old::Messages::<Test>::iter().count();
let new_count = MessagesV2::<Test>::iter().count();
let current_version = MessagesPallet::current_storage_version();
let current_version = MessagesPallet::in_code_storage_version();

assert_eq!(old_count, 0);
assert_eq!(new_count, message_per_block.iter().sum::<usize>());
Expand Down
3 changes: 2 additions & 1 deletion pallets/msa/src/tests/governance_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use frame_support::{assert_noop, assert_ok, traits::ChangeMembers};

use pallet_collective::ProposalOf;
use sp_weights::Weight;

use pretty_assertions::assert_eq;
Expand Down Expand Up @@ -52,7 +53,7 @@ fn propose_to_be_provider_happy_path() {

let proposal_index = proposed_events[0].0;
let proposal_hash = proposed_events[0].1;
let proposal = Council::proposal_of(proposal_hash).unwrap();
let proposal = ProposalOf::<Test, CouncilCollective>::get(proposal_hash).unwrap();
let proposal_len: u32 = proposal.encoded_size() as u32;

// Set up the council members
Expand Down
14 changes: 10 additions & 4 deletions pallets/msa/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use frame_support::{
weights::Weight,
};
use frame_system::EnsureRoot;
use pallet_collective;
use pallet_collective::{self, Members, ProposalCount};
use parity_scale_codec::MaxEncodedLen;
use sp_core::{
offchain::{testing, testing::OffchainState, OffchainDbExt, OffchainWorkerExt},
Expand Down Expand Up @@ -58,7 +58,7 @@ impl MaxEncodedLen for SchemaModelMaxBytesBoundedVecLimit {
}
}

type CouncilCollective = pallet_collective::Instance1;
pub type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
Expand Down Expand Up @@ -97,6 +97,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

impl pallet_schemas::Config for Test {
Expand Down Expand Up @@ -169,14 +174,15 @@ impl pallet_msa::ProposalProvider<AccountId, RuntimeCall> for CouncilProposalPro
who: AccountId,
proposal: Box<RuntimeCall>,
) -> Result<(u32, u32), DispatchError> {
let threshold: u32 = ((Council::members().len() / 2) + 1) as u32;
let members = Members::<Test, CouncilCollective>::get();
let threshold: u32 = ((members.len() / 2) + 1) as u32;
let length_bound: u32 = proposal.using_encoded(|p| p.len() as u32);
Council::do_propose_proposed(who, threshold, proposal, length_bound)
}

#[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
fn proposal_count() -> u32 {
Council::proposal_count()
ProposalCount::<Test, CouncilCollective>::get()
}
}

Expand Down
5 changes: 5 additions & 0 deletions pallets/passkey/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

impl pallet_transaction_payment::Config for Test {
Expand Down
2 changes: 1 addition & 1 deletion pallets/schemas/src/migration/v4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV4<T> {
pub fn migrate_to_v4<T: Config>() -> Weight {
log::info!(target: LOG_TARGET, "Running storage migration...");
let onchain_version = Pallet::<T>::on_chain_storage_version();
let current_version = Pallet::<T>::current_storage_version();
let current_version = Pallet::<T>::in_code_storage_version();
log::info!(target: LOG_TARGET, "onchain_version= {:?}, current_version={:?}", onchain_version, current_version);
let each_layer_access: u64 = 33 * 16;

Expand Down
3 changes: 2 additions & 1 deletion pallets/schemas/src/tests/deprecated_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use common_primitives::{
schema::{ModelType, PayloadLocation, SchemaId, SchemaSetting},
};
use frame_support::{assert_noop, assert_ok, traits::ChangeMembers, weights::Weight, BoundedVec};
use pallet_collective::ProposalOf;
use parity_scale_codec::Encode;
use serial_test::serial;

Expand Down Expand Up @@ -107,7 +108,7 @@ fn propose_to_create_schema_happy_path() {

let proposal_index = proposed_events[0].0;
let proposal_hash = proposed_events[0].1;
let proposal = Council::proposal_of(proposal_hash).unwrap();
let proposal = ProposalOf::<Test, CouncilCollective>::get(proposal_hash).unwrap();
let proposal_len: u32 = proposal.encoded_size() as u32;

// Set up the council members
Expand Down
2 changes: 1 addition & 1 deletion pallets/schemas/src/tests/migrations_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn schemas_migration_to_v4_should_work_as_expected() {
let _ = v4::migrate_to_v4::<Test>();

// Assert
let current_version = SchemasPallet::current_storage_version();
let current_version = SchemasPallet::in_code_storage_version();
assert_eq!(current_version, StorageVersion::new(4));

let known_schemas = v4::get_known_schemas::<Test>();
Expand Down
15 changes: 11 additions & 4 deletions pallets/schemas/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use parity_scale_codec::MaxEncodedLen;

use common_primitives::node::AccountId;
use common_runtime::constants::DAYS;
use pallet_collective;
use pallet_collective::{self, Members};
use smallvec::smallvec;
use sp_core::{parameter_types, Encode, H256};
use sp_runtime::{
Expand Down Expand Up @@ -49,7 +49,7 @@ impl MaxEncodedLen for SchemaModelMaxBytesBoundedVecLimit {
}
}

type CouncilCollective = pallet_collective::Instance1;
pub type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Test {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
Expand Down Expand Up @@ -98,14 +98,16 @@ impl pallet_schemas::ProposalProvider<AccountId, RuntimeCall> for CouncilProposa
who: AccountId,
proposal: Box<RuntimeCall>,
) -> Result<(u32, u32), DispatchError> {
let threshold: u32 = ((Council::members().len() / 2) + 1) as u32;
let members = Members::<Test, CouncilCollective>::get();
let threshold: u32 = ((members.len() / 2) + 1) as u32;
let length_bound: u32 = proposal.using_encoded(|p| p.len() as u32);
Council::do_propose_proposed(who, threshold, proposal, length_bound)
}

#[cfg(any(feature = "runtime-benchmarks", feature = "test"))]
fn proposal_count() -> u32 {
Council::proposal_count()
use pallet_collective::ProposalCount;
ProposalCount::<Test, CouncilCollective>::get()
}
}

Expand Down Expand Up @@ -155,6 +157,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

pub fn new_test_ext() -> sp_io::TestExternalities {
Expand Down
5 changes: 3 additions & 2 deletions pallets/schemas/src/tests/other_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use common_primitives::{
use frame_support::{
assert_noop, assert_ok, dispatch::RawOrigin, traits::ChangeMembers, weights::Weight, BoundedVec,
};
use pallet_collective::ProposalOf;
use parity_scale_codec::Encode;
use serial_test::serial;
use sp_runtime::{BuildStorage, DispatchError::BadOrigin};
Expand Down Expand Up @@ -794,7 +795,7 @@ fn propose_to_create_schema_v2_happy_path() {

let proposal_index = proposed_events[0].0;
let proposal_hash = proposed_events[0].1;
let proposal = Council::proposal_of(proposal_hash).unwrap();
let proposal = ProposalOf::<Test, CouncilCollective>::get(proposal_hash).unwrap();
let proposal_len: u32 = proposal.encoded_size() as u32;

// Set up the council members
Expand Down Expand Up @@ -943,7 +944,7 @@ fn propose_to_create_schema_name_happy_path() {

let proposal_index = proposed_events[0].0;
let proposal_hash = proposed_events[0].1;
let proposal = Council::proposal_of(proposal_hash).unwrap();
let proposal = ProposalOf::<Test, CouncilCollective>::get(proposal_hash).unwrap();
let proposal_len: u32 = proposal.encoded_size() as u32;

// Set up the council members
Expand Down
5 changes: 5 additions & 0 deletions pallets/stateful-storage/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ impl system::Config for Test {
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

pub type MaxItemizedActionsCount = ConstU32<6>;
Expand Down
5 changes: 5 additions & 0 deletions pallets/time-release/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ impl frame_system::Config for Test {
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}

type Balance = u64;
Expand Down
20 changes: 10 additions & 10 deletions runtime/common/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// limitations under the License.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-07-22 (Y/M/D)
//! HOSTNAME: `ip-10-173-10-212`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! DATE: 2024-07-26 (Y/M/D)
//! HOSTNAME: `ip-10-173-10-116`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Frequency Development (No Relay)`
//! WARMUPS: `10`, REPEAT: `100`
Expand All @@ -43,17 +43,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 228_705, 258_327
/// Average: 233_749
/// Median: 231_407
/// Std-Dev: 6138.82
/// Min, Max: 237_698, 260_606
/// Average: 241_909
/// Median: 239_649
/// Std-Dev: 5441.42
///
/// Percentiles nanoseconds:
/// 99th: 253_969
/// 95th: 248_960
/// 75th: 233_995
/// 99th: 260_507
/// 95th: 254_401
/// 75th: 242_002
pub const BlockExecutionWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(233_749), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(241_909), 0);
}

#[cfg(test)]
Expand Down
20 changes: 10 additions & 10 deletions runtime/common/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// limitations under the License.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-07-22 (Y/M/D)
//! HOSTNAME: `ip-10-173-10-212`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! DATE: 2024-07-26 (Y/M/D)
//! HOSTNAME: `ip-10-173-10-116`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Frequency Development (No Relay)`
//! WARMUPS: `10`, REPEAT: `100`
Expand All @@ -43,17 +43,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 62_781, 63_685
/// Average: 63_128
/// Median: 63_087
/// Std-Dev: 186.35
/// Min, Max: 63_899, 66_104
/// Average: 64_842
/// Median: 64_786
/// Std-Dev: 417.92
///
/// Percentiles nanoseconds:
/// 99th: 63_539
/// 95th: 63_452
/// 75th: 63_256
/// 99th: 65_857
/// 95th: 65_692
/// 75th: 65_020
pub const ExtrinsicBaseWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(63_128), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(64_842), 0);
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion runtime/frequency/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version = "0.0.0"
targets = ["x86_64-unknown-linux-gnu"]

[build-dependencies]
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.8.0"}
substrate-wasm-builder = { workspace = true }

[dependencies]
parity-scale-codec = { workspace = true, features = ["derive"] }
Expand Down
Loading

0 comments on commit 21f1bde

Please sign in to comment.