Skip to content

Commit

Permalink
feat: remove v102 storage migrations and arm validator manager, v103
Browse files Browse the repository at this point in the history
  • Loading branch information
OnyxSkyscape committed Mar 28, 2023
1 parent f1b7e5f commit 23bb7cc
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions gn-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ pub mod opaque {
/// Opaque block identifier type.
pub type BlockId = generic::BlockId<Block>;

// TODO Remove after im_online runtime upgrade is done.
impl_opaque_keys! {
pub struct OldSessionKeys {
pub aura: Aura,
pub grandpa: Grandpa,

}
}

impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
Expand All @@ -109,7 +100,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 102,
spec_version: 103,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -286,7 +277,7 @@ impl pallet_im_online::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type ValidatorSet = ValidatorManager;
type ReportUnresponsiveness = ();
type ReportUnresponsiveness = ValidatorManager;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = pallet_im_online::weights::SubstrateWeight<Runtime>;
type MaxKeys = MaxKeys;
Expand Down Expand Up @@ -390,26 +381,6 @@ impl pallet_validator_manager::Config for Runtime {
type MinAuthorities = MinAuthorities;
}

// should be removed along with UpgradeSessionKeys
fn transform_session_keys(_v: AccountId, old: opaque::OldSessionKeys) -> opaque::SessionKeys {
let dummy_id = pallet_im_online::sr25519::AuthorityId::try_from(old.aura.as_ref()).unwrap();

opaque::SessionKeys {
grandpa: old.grandpa,
aura: old.aura,
im_online: dummy_id,
}
}

// When this is removed, should also remove `OldSessionKeys`.
pub struct UpgradeSessionKeys;
impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
Session::upgrade_keys::<opaque::OldSessionKeys, _>(transform_session_keys);
BlockWeights::get().max_block
}
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
Expand Down Expand Up @@ -466,7 +437,6 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
UpgradeSessionKeys,
>;

#[cfg(feature = "runtime-benchmarks")]
Expand Down

0 comments on commit 23bb7cc

Please sign in to comment.