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

Remove im-online pallet from Rococo and Westend #2265

Merged
merged 54 commits into from
Nov 28, 2023
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
03984c8
Remove pallet from Rococo; Add migrations
s0me0ne-unkn0wn Nov 10, 2023
7eebe6d
Fix chainspec
s0me0ne-unkn0wn Nov 10, 2023
370e5fc
Fix session key type
s0me0ne-unkn0wn Nov 10, 2023
6f78e95
Fix chainspec
s0me0ne-unkn0wn Nov 10, 2023
89bf585
Duplicate changes in Westend
s0me0ne-unkn0wn Nov 10, 2023
b390a4e
Fix test
s0me0ne-unkn0wn Nov 10, 2023
70cdc29
Fix tests
s0me0ne-unkn0wn Nov 10, 2023
de66ba8
Fix syntax
s0me0ne-unkn0wn Nov 10, 2023
760fa5c
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 10, 2023
c947a44
Fix tests
s0me0ne-unkn0wn Nov 10, 2023
481364a
Implement off-chain storage removal for Rococo
s0me0ne-unkn0wn Nov 10, 2023
e334415
`cargo fmt`
s0me0ne-unkn0wn Nov 10, 2023
c3fc483
Remove `im-online` dependency from `offences-benchmarking`
s0me0ne-unkn0wn Nov 11, 2023
6ee3a63
Simplify migration
s0me0ne-unkn0wn Nov 11, 2023
926aad6
Fix benchmark
s0me0ne-unkn0wn Nov 11, 2023
78d5025
Try to remove offchain storage with a mock pallet
s0me0ne-unkn0wn Nov 12, 2023
34b8f61
Revert "Try to remove offchain storage with a mock pallet"
s0me0ne-unkn0wn Nov 13, 2023
d150601
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 13, 2023
4c6d02c
Do not clean up off-chain storage; leave it for a follow-up
s0me0ne-unkn0wn Nov 13, 2023
bd39ae1
Remove unused code
s0me0ne-unkn0wn Nov 13, 2023
edbec9d
Minor fixes
s0me0ne-unkn0wn Nov 13, 2023
2ce8c76
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 13, 2023
e015c84
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 13, 2023
f1af593
Fix formatting
s0me0ne-unkn0wn Nov 13, 2023
71a9df8
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 14, 2023
8a3e1e5
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 15, 2023
79b1d78
Address discussions
s0me0ne-unkn0wn Nov 15, 2023
1c41ff4
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 15, 2023
9f7ab51
Fix build
s0me0ne-unkn0wn Nov 15, 2023
cc46759
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 16, 2023
5a4c41f
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 16, 2023
c65e882
Fix log level
s0me0ne-unkn0wn Nov 17, 2023
8a16b03
Merge branch 'master' into s0me0ne/retire-im-online-part-2
s0me0ne-unkn0wn Nov 17, 2023
091bf87
Fix comment
s0me0ne-unkn0wn Nov 21, 2023
26755a7
Fix version checking
s0me0ne-unkn0wn Nov 21, 2023
f5cca1f
Merge remote-tracking branch 'origin/s0me0ne/retire-im-online-part-2'…
s0me0ne-unkn0wn Nov 21, 2023
bf38a8c
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 21, 2023
47f7530
Merge branch 'master' into s0me0ne/retire-im-online-part-2
s0me0ne-unkn0wn Nov 21, 2023
78995ca
Add try-runtime hooks
s0me0ne-unkn0wn Nov 22, 2023
5247ed0
Merge remote-tracking branch 'origin/s0me0ne/retire-im-online-part-2'…
s0me0ne-unkn0wn Nov 22, 2023
ab4c1dc
Fix import
s0me0ne-unkn0wn Nov 22, 2023
ebf7e26
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 22, 2023
f621cbb
Add try-runtime checks to Westend and bump required spec version
s0me0ne-unkn0wn Nov 23, 2023
2d3b98f
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 23, 2023
8dbcc41
Add more checks
s0me0ne-unkn0wn Nov 23, 2023
802528f
Merge branch 'master' into s0me0ne/retire-im-online-part-2
s0me0ne-unkn0wn Nov 23, 2023
2e6e2c1
Merge branch 'master' into s0me0ne/retire-im-online-part-2
s0me0ne-unkn0wn Nov 27, 2023
ec0e48a
Remove timestamp handler
rcny Nov 27, 2023
bfecf87
Merge branch 'master' into s0me0ne/retire-im-online-part-2
s0me0ne-unkn0wn Nov 27, 2023
fbda23c
TERM=dumb
rcny Nov 27, 2023
aa813f8
Don't wrap `try-runtime` with `time`
rcny Nov 27, 2023
a0cd856
Forcefully disable output buffering
rcny Nov 27, 2023
b8d015e
Use `sleep` 🙃
rcny Nov 27, 2023
5b9ddb0
Merge remote-tracking branch 'origin/master' into s0me0ne/retire-im-o…
s0me0ne-unkn0wn Nov 28, 2023
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
104 changes: 80 additions & 24 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_identity::legacy::IdentityInfo;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};
use sp_core::{ConstU128, OpaqueMetadata, H256};
Expand All @@ -89,7 +88,8 @@ use sp_runtime::{
Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug,
ApplyExtrinsicResult, BoundToRuntimeAppPublic, FixedU128, KeyTypeId, Perbill, Percent, Permill,
RuntimeAppPublic, RuntimeDebug,
};
use sp_staking::SessionIndex;
#[cfg(any(feature = "std", test))]
Expand Down Expand Up @@ -338,21 +338,80 @@ impl pallet_timestamp::Config for Runtime {

impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type EventHandler = ImOnline;
type EventHandler = ();
}

#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode)]
pub struct OldSessionKeys {
pub grandpa: <Grandpa as BoundToRuntimeAppPublic>::Public,
pub babe: <Babe as BoundToRuntimeAppPublic>::Public,
pub im_online: (),
s0me0ne-unkn0wn marked this conversation as resolved.
Show resolved Hide resolved
pub para_validator: <Initializer as BoundToRuntimeAppPublic>::Public,
pub para_assignment: <ParaSessionInfo as BoundToRuntimeAppPublic>::Public,
pub authority_discovery: <AuthorityDiscovery as BoundToRuntimeAppPublic>::Public,
pub beefy: <Beefy as BoundToRuntimeAppPublic>::Public,
}

impl OpaqueKeys for OldSessionKeys {
type KeyTypeIdProviders =
(Grandpa, Babe, (), Initializer, ParaSessionInfo, AuthorityDiscovery, Beefy);
s0me0ne-unkn0wn marked this conversation as resolved.
Show resolved Hide resolved
s0me0ne-unkn0wn marked this conversation as resolved.
Show resolved Hide resolved
fn key_ids() -> &'static [KeyTypeId] {
&[<<Grandpa as BoundToRuntimeAppPublic>::Public>::ID,
<<Babe as BoundToRuntimeAppPublic>::Public>::ID,
sp_core::crypto::key_types::IM_ONLINE,
<<Initializer as BoundToRuntimeAppPublic>::Public as
::sp_runtime::RuntimeAppPublic>::ID,
<<ParaSessionInfo as
::sp_runtime::BoundToRuntimeAppPublic>::Public as
::sp_runtime::RuntimeAppPublic>::ID,
<<AuthorityDiscovery as
::sp_runtime::BoundToRuntimeAppPublic>::Public as
::sp_runtime::RuntimeAppPublic>::ID,
<<Beefy as ::sp_runtime::BoundToRuntimeAppPublic>::Public as
::sp_runtime::RuntimeAppPublic>::ID]
}
fn get_raw(&self, i: KeyTypeId) -> &[u8] {
match i {
<<Grandpa as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.grandpa.as_ref(),
<<Babe as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.babe.as_ref(),
<<Initializer as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.para_validator.as_ref(),
<<ParaSessionInfo as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.para_assignment.as_ref(),
<<AuthorityDiscovery as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.authority_discovery.as_ref(),
<<Beefy as BoundToRuntimeAppPublic>::Public as RuntimeAppPublic>::ID =>
self.beefy.as_ref(),
_ => &[],
bkchr marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
pub babe: Babe,
pub im_online: ImOnline,
pub para_validator: Initializer,
pub para_assignment: ParaSessionInfo,
pub authority_discovery: AuthorityDiscovery,
pub beefy: Beefy,
}
}

// remove this when removing `OldSessionKeys`
fn transform_session_keys(_val: AccountId, old: OldSessionKeys) -> SessionKeys {
SessionKeys {
grandpa: old.grandpa,
babe: old.babe,
para_validator: old.para_validator,
para_assignment: old.para_assignment,
authority_discovery: old.authority_discovery,
beefy: old.beefy,
}
}

/// Special `ValidatorIdOf` implementation that is just returning the input as result.
pub struct ValidatorIdOf;
impl sp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf {
Expand Down Expand Up @@ -497,22 +556,6 @@ impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}

parameter_types! {
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}

impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical;
type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = weights::pallet_im_online::WeightInfo<Runtime>;
type MaxKeys = MaxKeys;
type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
}

parameter_types! {
pub const MaxSetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get();
}
Expand Down Expand Up @@ -762,7 +805,6 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
// Specifically omitting the entire Balances pallet
RuntimeCall::Session(..) |
RuntimeCall::Grandpa(..) |
RuntimeCall::ImOnline(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::ChildBounties(..) |
Expand Down Expand Up @@ -1283,7 +1325,6 @@ construct_runtime! {

Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 8,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event, ValidateUnsigned} = 10,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>} = 12,

// Governance stuff; uncallable initially.
Expand Down Expand Up @@ -1434,6 +1475,7 @@ pub mod migrations {
pub const PhragmenElectionPalletName: &'static str = "PhragmenElection";
pub const TechnicalMembershipPalletName: &'static str = "TechnicalMembership";
pub const TipsPalletName: &'static str = "Tips";
pub const ImOnlinePalletName: &'static str = "ImOnline";
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
}

Expand Down Expand Up @@ -1470,10 +1512,19 @@ pub mod migrations {
type PalletName = TipsPalletName;
}

/// Upgrade Session keys to exclude ImOnline key.
/// When this is removed, should also remove `OldSessionKeys`.
pub struct UpgradeSessionKeys;
impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
fn on_runtime_upgrade() -> Weight {
Session::upgrade_keys::<OldSessionKeys, _>(transform_session_keys);
Perbill::from_percent(50) * BlockWeights::get().max_block
s0me0ne-unkn0wn marked this conversation as resolved.
Show resolved Hide resolved
}
}

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (
pallet_society::migrations::VersionCheckedMigrateToV2<Runtime, (), ()>,
pallet_im_online::migration::v1::Migration<Runtime>,
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
assigned_slots::migration::v1::VersionCheckedMigrateToV1<Runtime>,
parachains_scheduler::migration::v1::MigrateToV1<Runtime>,
Expand All @@ -1497,6 +1548,12 @@ pub mod migrations {
frame_support::migrations::RemovePallet<PhragmenElectionPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<TechnicalMembershipPalletName, <Runtime as frame_system::Config>::DbWeight>,
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,

// Upgrade `SessionKeys` to exclude `ImOnline`
UpgradeSessionKeys,

// Remove im-online pallet storage
frame_support::migrations::RemovePallet<ImOnlinePalletName, <Runtime as frame_system::Config>::DbWeight>,
);
}

Expand Down Expand Up @@ -1566,7 +1623,6 @@ mod benches {
[pallet_conviction_voting, ConvictionVoting]
[pallet_nis, Nis]
[pallet_identity, Identity]
[pallet_im_online, ImOnline]
[pallet_indices, Indices]
[pallet_message_queue, MessageQueue]
[pallet_multisig, Multisig]
Expand Down
Loading