Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct storage of new pallets and prepare release #723

Merged
merged 6 commits into from
Mar 24, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ jobs:
- name: Run Migration on new snapshot
if: steps.cachedir.outputs.cache-hit != 'true'
run: |
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm -lruntime=debug --chain ${{ env.try-runtime-chain }} on-runtime-upgrade snap -s snapshots/eden-snapshot-full
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm -lruntime=debug --chain ${{ env.try-runtime-chain }} on-runtime-upgrade --checks=all snap -s snapshots/eden-snapshot-full
- name: Try runtime reuse snap
if: steps.cachedir.outputs.cache-hit == 'true'
run: |
cat snapshots/created_at
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm --chain ${{ env.try-runtime-chain }} on-runtime-upgrade snap --snapshot-path="snapshots/eden-snapshot-full"
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm --chain ${{ env.try-runtime-chain }} on-runtime-upgrade --checks=all snap --snapshot-path="snapshots/eden-snapshot-full"
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Nodle <[email protected]>", "Parity Technologies <[email protected]>"]
build = "build.rs"
edition = "2021"
name = "nodle-parachain"
version = "2.0.27"
version = "2.0.28"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
2 changes: 1 addition & 1 deletion pallets/allocations/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-allocations"
version = "2.0.27"
version = "2.0.28"
authors = ['Eliott Teissonniere <[email protected]>']
edition = "2021"
description = "A pallet to handle the Proof Of Connectivity allocations rewards"
Expand Down
2 changes: 1 addition & 1 deletion pallets/grants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "pallet-grants"
description = "Provides scheduled balance locking mechanism, in a *graded vesting* way."
license = "Apache-2.0"
version = "2.0.27"
version = "2.0.28"
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion pallets/mandate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-mandate"
version = "2.0.27"
version = "2.0.28"
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion pallets/reserve/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-reserve"
version = "2.0.27"
version = "2.0.28"
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "primitives"
version = "2.0.27"
version = "2.0.28"
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion runtimes/eden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"
name = "runtime-eden"
version = "2.0.27"
version = "2.0.28"

[features]
default = ["std"]
Expand Down
113 changes: 88 additions & 25 deletions runtimes/eden/src/migrations.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use crate::Runtime;
use frame_support::{migration, parameter_types, traits::OnRuntimeUpgrade, weights::Weight, BoundedVec};
use crate::{Runtime, RuntimeOrigin};
use frame_support::{
migration, parameter_types,
traits::{GetStorageVersion, OnRuntimeUpgrade},
weights::Weight,
BoundedVec,
};
use primitives::{AccountId, Balance};

#[cfg(feature = "try-runtime")]
Expand Down Expand Up @@ -36,6 +41,7 @@ const CANDIDACY_BOND: Balance = 3_000_000 * crate::constants::NODL;
pub struct MoveValidatorsSetToInvulnerables;
impl OnRuntimeUpgrade for MoveValidatorsSetToInvulnerables {
fn on_runtime_upgrade() -> Weight {
let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(4);
if let Some(validators) = migration::take_storage_value::<BoundedVec<AccountId, MaxMembers>>(
VALIDATORS_SET_MODULE,
MEMBERS_ITEM,
Expand Down Expand Up @@ -75,10 +81,42 @@ impl OnRuntimeUpgrade for MoveValidatorsSetToInvulnerables {
log::error!(target: MIGRATION, "Failed to remove Poa::StorageVersion completely");
}

<Runtime as frame_system::Config>::DbWeight::get().writes(4)
weight += <Runtime as frame_system::Config>::DbWeight::get().writes(4);
} else {
<Runtime as frame_system::Config>::DbWeight::get().reads(1)
log::info!(target: MIGRATION, "No migration for ValidatorsSet");
}

let dmp_queue_version = <cumulus_pallet_dmp_queue::pallet::Pallet<Runtime>>::current_storage_version();
if dmp_queue_version != <cumulus_pallet_dmp_queue::pallet::Pallet<Runtime>>::on_chain_storage_version() {
dmp_queue_version.put::<cumulus_pallet_dmp_queue::pallet::Pallet<Runtime>>();
weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1);
} else {
log::info!(target: MIGRATION, "No migration for DMP Queue");
}

let xcmp_queue_version = <cumulus_pallet_xcmp_queue::pallet::Pallet<Runtime>>::current_storage_version();
if xcmp_queue_version != <cumulus_pallet_xcmp_queue::pallet::Pallet<Runtime>>::on_chain_storage_version() {
xcmp_queue_version.put::<cumulus_pallet_xcmp_queue::pallet::Pallet<Runtime>>();
weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1);
} else {
log::info!(target: MIGRATION, "No migration for XCMP Queue");
}

let contracts_version = <pallet_contracts::pallet::Pallet<Runtime>>::current_storage_version();
if contracts_version != <pallet_contracts::pallet::Pallet<Runtime>>::on_chain_storage_version() {
contracts_version.put::<pallet_contracts::pallet::Pallet<Runtime>>();
weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1);
} else {
log::info!(target: MIGRATION, "No migration for Contracts");
}

let _ = pallet_xcm::pallet::Pallet::<Runtime>::force_default_xcm_version(
RuntimeOrigin::root(),
Some(pallet_xcm::CurrentXcmVersion::get()),
);
weight += <Runtime as frame_system::Config>::DbWeight::get().writes(1);

weight
}

#[cfg(feature = "try-runtime")]
Expand All @@ -100,27 +138,52 @@ impl OnRuntimeUpgrade for MoveValidatorsSetToInvulnerables {
|| migration::have_storage_value(VALIDATORS_SET_MODULE, PRIME_ITEM, EMPTY_HASH)
|| migration::have_storage_value(POA_MODULE, STORAGE_VERSION_ITEM, EMPTY_HASH)
{
Err("Failed to remove ValidatorsSet and/or Poa")
} else {
let invulnerables = pallet_collator_selection::pallet::Pallet::<Runtime>::invulnerables();
log::info!(
target: TRY_RUNTIME,
"CollatorSelection::Invulnerables are {:?}",
invulnerables
);
let candidacy_bond = pallet_collator_selection::pallet::Pallet::<Runtime>::candidacy_bond();
log::info!(
target: TRY_RUNTIME,
"CollatorSelection::candidacy_bond is {:?}",
candidacy_bond
);
let validators: BoundedVec<AccountId, MaxMembers> = Decode::decode(&mut state.as_slice()).unwrap();
if invulnerables == validators && candidacy_bond == CANDIDACY_BOND {
log::info!(target: TRY_RUNTIME, "MoveValidatorsSetToInvulnerables was successful");
Ok(())
} else {
Err("CollatorSelection::Invulnerables are not the same as ValidatorsSet::Members")
}
return Err("Failed to remove ValidatorsSet and/or Poa");
}

let invulnerables = pallet_collator_selection::pallet::Pallet::<Runtime>::invulnerables();
log::info!(
target: TRY_RUNTIME,
"CollatorSelection::Invulnerables are {:?}",
invulnerables
);
let candidacy_bond = pallet_collator_selection::pallet::Pallet::<Runtime>::candidacy_bond();
log::info!(
target: TRY_RUNTIME,
"CollatorSelection::candidacy_bond is {:?}",
candidacy_bond
);
let validators: BoundedVec<AccountId, MaxMembers> =
Decode::decode(&mut state.as_slice()).map_err(|_| "Failed to decode validators")?;
if invulnerables != validators || candidacy_bond != CANDIDACY_BOND {
return Err("CollatorSelection::Invulnerables are not the same as ValidatorsSet::Members");
}
log::info!(target: TRY_RUNTIME, "MoveValidatorsSetToInvulnerables was successful");

if <cumulus_pallet_dmp_queue::pallet::Pallet<Runtime>>::current_storage_version()
!= <cumulus_pallet_dmp_queue::pallet::Pallet<Runtime>>::on_chain_storage_version()
{
log::info!(target: TRY_RUNTIME, "DMP Queue storage version is not updated");
return Err("DMP Queue storage version is not updated");
}
log::info!(target: TRY_RUNTIME, "DMP Queue storage version was good");

if <cumulus_pallet_xcmp_queue::pallet::Pallet<Runtime>>::current_storage_version()
!= <cumulus_pallet_xcmp_queue::pallet::Pallet<Runtime>>::on_chain_storage_version()
{
log::info!(target: TRY_RUNTIME, "XCMP Queue storage version is not updated");
return Err("XCMP Queue storage version is not updated");
}
log::info!(target: TRY_RUNTIME, "XCMP Queue storage version was good");

if <pallet_contracts::pallet::Pallet<Runtime>>::current_storage_version()
!= <pallet_contracts::pallet::Pallet<Runtime>>::on_chain_storage_version()
{
log::info!(target: TRY_RUNTIME, "Contracts storage version is not updated");
return Err("Contracts storage version is not updated");
}
log::info!(target: TRY_RUNTIME, "Contracts storage version was good");

Ok(())
}
}
2 changes: 1 addition & 1 deletion runtimes/eden/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Version of the runtime specification. A full-node will not attempt to use its native
/// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
/// `spec_version` and `authoring_version` are the same between Wasm and native.
spec_version: 18,
spec_version: 19,

/// Version of the implementation of the specification. Nodes are free to ignore this; it
/// serves only as an indication that the code is different; as long as the other two versions
Expand Down
2 changes: 1 addition & 1 deletion support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
authors = ["Eliott Teissonniere <[email protected]>"]
edition = "2021"
name = "support"
version = "2.0.27"
version = "2.0.28"