Skip to content

Commit

Permalink
Remove im-online pallet from Kusama and Polkadot runtimes (polkadot…
Browse files Browse the repository at this point in the history
…-fellows#178)

# Summary

This PR aims to remove `im-online` pallet, its session keys, and its
on-chain storage from both Kusama and Polkadot relay chain runtimes,
thus giving up liveness slashing.

# Motivation

* Missing out on rewards because of being offline is enough disincentive
for validators. Slashing them for being offline is redundant.
* Disabling liveness slashing is a prerequisite for validator disabling.

# See also

paritytech/polkadot-sdk#1964
paritytech/polkadot-sdk#784
  • Loading branch information
s0me0ne-unkn0wn authored Feb 29, 2024
1 parent 0718945 commit f1fb358
Show file tree
Hide file tree
Showing 14 changed files with 294 additions and 247 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed

- Removed the `SafeCallFilter` from the Relay Chain XCM config ([polkadot-fellows/runtimes#172](https://github.com/polkadot-fellows/runtimes/pull/172)).
- Removed the `ImOnline` pallet ([polkadot-fellows/runtimes#178](https://github.com/polkadot-fellows/runtimes/pull/178))

### Based on Polkadot-SDK

Expand Down
3 changes: 0 additions & 3 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ sp-authority-discovery = "26.0.0"
sp-core = "28.0.0"
pallet-staking = "28.0.0"
sc-consensus-grandpa = "0.19.0"
pallet-im-online = "27.0.0"
sp-runtime = "31.0.1"
sp-consensus-beefy = "13.0.0"
xcm = { package = "staging-xcm", version = "7.0.0" }
Expand Down
24 changes: 2 additions & 22 deletions chain-spec-generator/src/relay_chain_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use kusama_runtime_constants::currency::UNITS as KSM;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_staking::Forcing;
use polkadot_primitives::{AccountId, AccountPublic, AssignmentId, ValidatorId};
use polkadot_runtime_constants::currency::UNITS as DOT;
Expand Down Expand Up @@ -84,7 +83,6 @@ fn default_parachains_host_configuration() -> HostConfiguration<polkadot_primiti
fn polkadot_session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
para_validator: ValidatorId,
para_assignment: AssignmentId,
authority_discovery: AuthorityDiscoveryId,
Expand All @@ -93,7 +91,6 @@ fn polkadot_session_keys(
polkadot_runtime::SessionKeys {
babe,
grandpa,
im_online,
para_validator,
para_assignment,
authority_discovery,
Expand All @@ -104,7 +101,6 @@ fn polkadot_session_keys(
fn kusama_session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
para_validator: ValidatorId,
para_assignment: AssignmentId,
authority_discovery: AuthorityDiscoveryId,
Expand All @@ -113,7 +109,6 @@ fn kusama_session_keys(
kusama_runtime::SessionKeys {
babe,
grandpa,
im_online,
para_validator,
para_assignment,
authority_discovery,
Expand Down Expand Up @@ -144,35 +139,24 @@ pub fn get_authority_keys_from_seed(
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
BeefyId,
) {
let keys = get_authority_keys_from_seed_no_beefy(seed);
(keys.0, keys.1, keys.2, keys.3, keys.4, keys.5, keys.6, keys.7, get_from_seed::<BeefyId>(seed))
(keys.0, keys.1, keys.2, keys.3, keys.4, keys.5, keys.6, get_from_seed::<BeefyId>(seed))
}

/// Helper function to generate stash, controller and session key from seed
pub fn get_authority_keys_from_seed_no_beefy(
seed: &str,
) -> (
AccountId,
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
) {
) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId, AssignmentId, AuthorityDiscoveryId) {
(
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ImOnlineId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
get_from_seed::<AuthorityDiscoveryId>(seed),
Expand Down Expand Up @@ -202,7 +186,6 @@ pub fn polkadot_testnet_genesis(
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
Expand Down Expand Up @@ -234,7 +217,6 @@ pub fn polkadot_testnet_genesis(
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
Expand Down Expand Up @@ -266,7 +248,6 @@ pub fn kusama_testnet_genesis(
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
Expand Down Expand Up @@ -298,7 +279,6 @@ pub fn kusama_testnet_genesis(
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
Expand Down
1 change: 0 additions & 1 deletion integration-tests/emulated/chains/relays/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ authority-discovery-primitives = { package = "sp-authority-discovery", version =
babe-primitives = { package = "sp-consensus-babe", version = "0.32.0" }
beefy-primitives = { package = "sp-consensus-beefy", version = "13.0.0" }
grandpa = { package = "sc-consensus-grandpa", version = "0.19.0" }
pallet-im-online = { version = "27.0.0" }

# Polkadot
polkadot-primitives = { version = "7.0.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use babe_primitives::AuthorityId as BabeId;
use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
use grandpa::AuthorityId as GrandpaId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sp_core::{sr25519, storage::Storage};

// Polkadot
Expand All @@ -43,7 +42,6 @@ mod validators {
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
Expand All @@ -55,7 +53,6 @@ mod validators {
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ImOnlineId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
get_from_seed::<AuthorityDiscoveryId>(seed),
Expand All @@ -67,7 +64,6 @@ mod validators {
fn session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
para_validator: ValidatorId,
para_assignment: AssignmentId,
authority_discovery: AuthorityDiscoveryId,
Expand All @@ -76,7 +72,6 @@ fn session_keys(
kusama_runtime::SessionKeys {
grandpa,
babe,
im_online,
para_validator,
para_assignment,
authority_discovery,
Expand Down Expand Up @@ -104,7 +99,6 @@ pub fn genesis() -> Storage {
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ authority-discovery-primitives = { package = "sp-authority-discovery", version =
babe-primitives = { package = "sp-consensus-babe", version = "0.32.0" }
beefy-primitives = { package = "sp-consensus-beefy", version = "13.0.0" }
grandpa = { package = "sc-consensus-grandpa", version = "0.19.0" }
pallet-im-online = { version = "27.0.0" }
pallet-staking = { version = "28.0.0" }

# Polkadot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use babe_primitives::AuthorityId as BabeId;
use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
use grandpa::AuthorityId as GrandpaId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sp_core::{sr25519, storage::Storage};
use sp_runtime::Perbill;

Expand All @@ -45,7 +44,6 @@ mod validators {
AccountId,
BabeId,
GrandpaId,
ImOnlineId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
Expand All @@ -57,7 +55,6 @@ mod validators {
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ImOnlineId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
get_from_seed::<AuthorityDiscoveryId>(seed),
Expand All @@ -69,7 +66,6 @@ mod validators {
fn session_keys(
babe: BabeId,
grandpa: GrandpaId,
im_online: ImOnlineId,
para_validator: ValidatorId,
para_assignment: AssignmentId,
authority_discovery: AuthorityDiscoveryId,
Expand All @@ -78,7 +74,6 @@ fn session_keys(
polkadot_runtime::SessionKeys {
babe,
grandpa,
im_online,
para_validator,
para_assignment,
authority_discovery,
Expand Down Expand Up @@ -106,7 +101,6 @@ pub fn genesis() -> Storage {
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
Expand Down
Loading

0 comments on commit f1fb358

Please sign in to comment.