From 80719e9c5acb19d1e3f2e92554c5bd141540e1bc Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 19 Jul 2024 14:13:41 +0200 Subject: [PATCH 01/17] add possibility to inject non-authorities session-keys in genesis --- cumulus/parachains/runtimes/test-utils/src/lib.rs | 2 +- substrate/frame/session/src/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/test-utils/src/lib.rs b/cumulus/parachains/runtimes/test-utils/src/lib.rs index 3fc3822a63eb..940aa1b734df 100644 --- a/cumulus/parachains/runtimes/test-utils/src/lib.rs +++ b/cumulus/parachains/runtimes/test-utils/src/lib.rs @@ -242,7 +242,7 @@ impl ExtBuilder { .assimilate_storage(&mut t) .unwrap(); - pallet_session::GenesisConfig:: { keys: self.keys } + pallet_session::GenesisConfig:: { keys: self.keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index e1a2a31911fe..c48904cca417 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -424,6 +424,9 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, + /// Keys injected for a validatorId, but that will not be considered + /// in the initial validators list + pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)> } #[pallet::genesis_build] @@ -446,7 +449,7 @@ pub mod pallet { } }); - for (account, val, keys) in self.keys.iter().cloned() { + for (account, val, keys) in self.keys.iter().cloned().chain(self.non_authority_keys.iter().cloned()) { Pallet::::inner_set_keys(&val, keys) .expect("genesis config must not contain duplicates; qed"); if frame_system::Pallet::::inc_consumers_without_limit(&account).is_err() { From 1e5c9b27f34cb72084b02c8627fa708bdcdd4463 Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 19 Jul 2024 14:52:52 +0200 Subject: [PATCH 02/17] just single cloned --- substrate/frame/session/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index c48904cca417..470a1bf5d030 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -449,7 +449,7 @@ pub mod pallet { } }); - for (account, val, keys) in self.keys.iter().cloned().chain(self.non_authority_keys.iter().cloned()) { + for (account, val, keys) in self.keys.iter().chain(self.non_authority_keys.iter()).cloned() { Pallet::::inner_set_keys(&val, keys) .expect("genesis config must not contain duplicates; qed"); if frame_system::Pallet::::inc_consumers_without_limit(&account).is_err() { From 8a019dbb64d958e59ee988e85f4761c8fba6fea3 Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 22 Jul 2024 09:44:26 +0200 Subject: [PATCH 03/17] changes --- substrate/frame/session/src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 470a1bf5d030..2ed612fdd0ab 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -423,10 +423,10 @@ pub mod pallet { #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { + /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, Keys)`. pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, - /// Keys injected for a validatorId, but that will not be considered - /// in the initial validators list - pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)> + /// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as active validators. + pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, } #[pallet::genesis_build] @@ -449,7 +449,9 @@ pub mod pallet { } }); - for (account, val, keys) in self.keys.iter().chain(self.non_authority_keys.iter()).cloned() { + for (account, val, keys) in + self.keys.iter().chain(self.non_authority_keys.iter()).cloned() + { Pallet::::inner_set_keys(&val, keys) .expect("genesis config must not contain duplicates; qed"); if frame_system::Pallet::::inc_consumers_without_limit(&account).is_err() { @@ -679,7 +681,7 @@ impl Pallet { let mut now_session_keys = session_keys.iter(); let mut check_next_changed = |keys: &T::Keys| { if changed { - return + return; } // since a new validator set always leads to `changed` starting // as true, we can ensure that `now_session_keys` and `next_validators` From 2d4b35b396dd41e3ecfdb062da80cd5843af3228 Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 22 Jul 2024 09:50:49 +0200 Subject: [PATCH 04/17] prdoc --- prdoc/pr_5078.prdoc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 prdoc/pr_5078.prdoc diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc new file mode 100644 index 000000000000..fcd8185b3ded --- /dev/null +++ b/prdoc/pr_5078.prdoc @@ -0,0 +1,10 @@ +title: Add possibility to inject non-authorities session-keys in genesis + +doc: + - audience: Runtime Dev + description: | + Allows to inject a set of registered session-keys in pallet-session that are not + part of the first initial set of validators +crates: +- name: frame-session + bump: minor From 5eefddce64f38fd693fa6b5a36dfb5079de4241a Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 22 Jul 2024 14:48:08 +0200 Subject: [PATCH 05/17] improve commets --- substrate/frame/session/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 2ed612fdd0ab..48c402a4dba2 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -424,8 +424,11 @@ pub mod pallet { #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, Keys)`. + /// These keys will be considered authorities for the first two sessions and they will be valid + /// at least until session 2 pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, /// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as active validators. + /// These keys will be be valid at least until session 2 pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, } From 91c5402a016ac55293cefe590a3d6605a5b46d32 Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 22 Jul 2024 15:22:11 +0200 Subject: [PATCH 06/17] more comments --- substrate/frame/session/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 48c402a4dba2..29da049dcdd0 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -428,7 +428,7 @@ pub mod pallet { /// at least until session 2 pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, /// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as active validators. - /// These keys will be be valid at least until session 2 + /// These keys are set, together with `keys`, as authority candidates for future sessions (enactable from session 2 onwards) pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, } From 3c5f0733f282a28a7e628aa57b2807dddfd243a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 22 Jul 2024 21:52:52 +0200 Subject: [PATCH 07/17] Apply suggestions from code review --- prdoc/pr_5078.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc index fcd8185b3ded..091d083617b7 100644 --- a/prdoc/pr_5078.prdoc +++ b/prdoc/pr_5078.prdoc @@ -7,4 +7,4 @@ doc: part of the first initial set of validators crates: - name: frame-session - bump: minor + bump: major From 802a7f0bf2e5fcb518feb7db4c98c0851c7cbbab Mon Sep 17 00:00:00 2001 From: girazoki Date: Tue, 23 Jul 2024 09:39:11 +0200 Subject: [PATCH 08/17] make prdoc hppy --- prdoc/pr_5078.prdoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc index 091d083617b7..d19294baef09 100644 --- a/prdoc/pr_5078.prdoc +++ b/prdoc/pr_5078.prdoc @@ -6,5 +6,8 @@ doc: Allows to inject a set of registered session-keys in pallet-session that are not part of the first initial set of validators crates: -- name: frame-session +- name: pallet-session bump: major +crates: +- name: parachains-runtimes-test-utils + bump: None From c1f345fa1d96e511cdfbf9ad7cf30d986afbdd8d Mon Sep 17 00:00:00 2001 From: girazoki Date: Tue, 23 Jul 2024 10:09:53 +0200 Subject: [PATCH 09/17] make prdoc happy again --- prdoc/pr_5078.prdoc | 1 - 1 file changed, 1 deletion(-) diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc index d19294baef09..38f519e71b24 100644 --- a/prdoc/pr_5078.prdoc +++ b/prdoc/pr_5078.prdoc @@ -8,6 +8,5 @@ doc: crates: - name: pallet-session bump: major -crates: - name: parachains-runtimes-test-utils bump: None From 4ea650c38af665bb0bd842089bbdbcec221c7c5f Mon Sep 17 00:00:00 2001 From: girazoki Date: Tue, 23 Jul 2024 11:22:42 +0200 Subject: [PATCH 10/17] add default for tests --- cumulus/pallets/collator-selection/src/mock.rs | 2 +- substrate/frame/root-offences/src/mock.rs | 1 + substrate/frame/staking/src/mock.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cumulus/pallets/collator-selection/src/mock.rs b/cumulus/pallets/collator-selection/src/mock.rs index 459b1cb5fdf2..d13f9e9d8c44 100644 --- a/cumulus/pallets/collator-selection/src/mock.rs +++ b/cumulus/pallets/collator-selection/src/mock.rs @@ -187,7 +187,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { candidacy_bond: 10, invulnerables, }; - let session = pallet_session::GenesisConfig:: { keys }; + let session = pallet_session::GenesisConfig:: { keys, ..Default::default() }; pallet_balances::GenesisConfig:: { balances } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/root-offences/src/mock.rs b/substrate/frame/root-offences/src/mock.rs index ab43b723e8a9..af073d7672cf 100644 --- a/substrate/frame/root-offences/src/mock.rs +++ b/substrate/frame/root-offences/src/mock.rs @@ -246,6 +246,7 @@ impl ExtBuilder { .into_iter() .map(|(id, ..)| (id, id, SessionKeys { other: id.into() })) .collect(), + ..Default::default() } .assimilate_storage(&mut storage); diff --git a/substrate/frame/staking/src/mock.rs b/substrate/frame/staking/src/mock.rs index 7e6a87955b08..7cc8e865916d 100644 --- a/substrate/frame/staking/src/mock.rs +++ b/substrate/frame/staking/src/mock.rs @@ -535,6 +535,7 @@ impl ExtBuilder { .map(|id| (id, id, SessionKeys { other: id.into() })) .collect() }, + ..Default::default() } .assimilate_storage(&mut storage); From 707df6906e859d1a94507f70d1b1be9db9fcfe89 Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 26 Jul 2024 09:20:24 +0200 Subject: [PATCH 11/17] more fixes --- prdoc/pr_5078.prdoc | 8 +++++++- substrate/frame/babe/src/mock.rs | 2 +- substrate/frame/beefy-mmr/src/mock.rs | 2 +- substrate/frame/beefy/src/mock.rs | 2 +- substrate/frame/grandpa/src/mock.rs | 2 +- substrate/frame/session/src/lib.rs | 11 ++++++----- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc index 38f519e71b24..56c7d16d256a 100644 --- a/prdoc/pr_5078.prdoc +++ b/prdoc/pr_5078.prdoc @@ -9,4 +9,10 @@ crates: - name: pallet-session bump: major - name: parachains-runtimes-test-utils - bump: None + bump: patch +- name: pallet-staking + bump: none +- name: pallet-collator-selection + bump: none +- name: pallet-root-offences + bump: none \ No newline at end of file diff --git a/substrate/frame/babe/src/mock.rs b/substrate/frame/babe/src/mock.rs index e193a2e3b645..912cb3e27cd5 100644 --- a/substrate/frame/babe/src/mock.rs +++ b/substrate/frame/babe/src/mock.rs @@ -319,7 +319,7 @@ pub fn new_test_ext_raw_authorities(authorities: Vec) -> sp_io::Tes // NOTE: this will initialize the babe authorities // through OneSessionHandler::on_genesis_session - pallet_session::GenesisConfig:: { keys: session_keys } + pallet_session::GenesisConfig:: { keys: session_keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/beefy-mmr/src/mock.rs b/substrate/frame/beefy-mmr/src/mock.rs index 3adef4f32bf4..1102f9677aaa 100644 --- a/substrate/frame/beefy-mmr/src/mock.rs +++ b/substrate/frame/beefy-mmr/src/mock.rs @@ -187,7 +187,7 @@ pub fn new_test_ext_raw_authorities(authorities: Vec<(u64, BeefyId)>) -> TestExt } }); - pallet_session::GenesisConfig:: { keys: session_keys } + pallet_session::GenesisConfig:: { keys: session_keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/beefy/src/mock.rs b/substrate/frame/beefy/src/mock.rs index 03efccff7643..658c41ecffec 100644 --- a/substrate/frame/beefy/src/mock.rs +++ b/substrate/frame/beefy/src/mock.rs @@ -262,7 +262,7 @@ impl ExtBuilder { } }); - pallet_session::GenesisConfig:: { keys: session_keys } + pallet_session::GenesisConfig:: { keys: session_keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/grandpa/src/mock.rs b/substrate/frame/grandpa/src/mock.rs index 5ba7da7f9fda..ae230a0209a7 100644 --- a/substrate/frame/grandpa/src/mock.rs +++ b/substrate/frame/grandpa/src/mock.rs @@ -235,7 +235,7 @@ pub fn new_test_ext_raw_authorities(authorities: AuthorityList) -> sp_io::TestEx // NOTE: this will initialize the grandpa authorities // through OneSessionHandler::on_genesis_session - pallet_session::GenesisConfig:: { keys: session_keys } + pallet_session::GenesisConfig:: { keys: session_keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 29da049dcdd0..b90fc10d0acf 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -423,12 +423,13 @@ pub mod pallet { #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { - /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, Keys)`. - /// These keys will be considered authorities for the first two sessions and they will be valid - /// at least until session 2 + /// /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, + /// Keys)`. These keys will be considered authorities for the first two sessions and they + /// will be valid at least until session 2 pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, - /// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as active validators. - /// These keys are set, together with `keys`, as authority candidates for future sessions (enactable from session 2 onwards) + /// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as + /// active validators. These keys are set, together with `keys`, as authority candidates + /// for future sessions (enactable from session 2 onwards) pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, } From 7a8b4fd1b491b458a08a401798143228ea5b5965 Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 26 Jul 2024 09:46:19 +0200 Subject: [PATCH 12/17] more fixes --- .../election-provider-multi-phase/test-staking-e2e/src/mock.rs | 1 + substrate/frame/session/src/historical/mod.rs | 2 +- substrate/frame/session/src/historical/offchain.rs | 2 +- substrate/frame/session/src/mock.rs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs index 5c64f2a0bc20..d148c05e4d0d 100644 --- a/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs +++ b/substrate/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs @@ -573,6 +573,7 @@ impl ExtBuilder { .into_iter() .map(|(id, ..)| (id, id, SessionKeys { other: (id as u64).into() })) .collect(), + ..Default::default() } .assimilate_storage(&mut storage); diff --git a/substrate/frame/session/src/historical/mod.rs b/substrate/frame/session/src/historical/mod.rs index fac580b49b3a..a19364d577f6 100644 --- a/substrate/frame/session/src/historical/mod.rs +++ b/substrate/frame/session/src/historical/mod.rs @@ -396,7 +396,7 @@ pub(crate) mod tests { frame_system::Pallet::::inc_providers(k); } }); - pallet_session::GenesisConfig:: { keys } + pallet_session::GenesisConfig:: { keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); sp_io::TestExternalities::new(t) diff --git a/substrate/frame/session/src/historical/offchain.rs b/substrate/frame/session/src/historical/offchain.rs index 685a0be8e191..0c4e73044db7 100644 --- a/substrate/frame/session/src/historical/offchain.rs +++ b/substrate/frame/session/src/historical/offchain.rs @@ -171,7 +171,7 @@ mod tests { } }); - crate::GenesisConfig:: { keys }.assimilate_storage(&mut t).unwrap(); + crate::GenesisConfig:: { keys, ..Default::default() }.assimilate_storage(&mut t).unwrap(); let mut ext = sp_io::TestExternalities::new(t); diff --git a/substrate/frame/session/src/mock.rs b/substrate/frame/session/src/mock.rs index 25b81668cc08..745b57d1be41 100644 --- a/substrate/frame/session/src/mock.rs +++ b/substrate/frame/session/src/mock.rs @@ -215,7 +215,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { // An additional identity that we use. frame_system::Pallet::::inc_providers(&69); }); - pallet_session::GenesisConfig:: { keys } + pallet_session::GenesisConfig:: { keys, ..Default::default() } .assimilate_storage(&mut t) .unwrap(); From 93dbfbf86032efd1c2948bb2fec82a8822aecc9d Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 26 Jul 2024 10:00:45 +0200 Subject: [PATCH 13/17] fix all chain-spec --- .../chains/parachains/assets/asset-hub-rococo/src/genesis.rs | 1 + .../chains/parachains/assets/asset-hub-westend/src/genesis.rs | 1 + .../parachains/bridges/bridge-hub-rococo/src/genesis.rs | 1 + .../parachains/bridges/bridge-hub-westend/src/genesis.rs | 1 + .../parachains/collectives/collectives-westend/src/genesis.rs | 1 + .../chains/parachains/coretime/coretime-rococo/src/genesis.rs | 1 + .../parachains/coretime/coretime-westend/src/genesis.rs | 1 + .../chains/parachains/people/people-rococo/src/genesis.rs | 1 + .../chains/parachains/people/people-westend/src/genesis.rs | 4 ++-- .../emulated/chains/parachains/testing/penpal/src/genesis.rs | 1 + .../emulated/chains/relays/rococo/src/genesis.rs | 1 + .../emulated/chains/relays/westend/src/genesis.rs | 1 + cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs | 1 + substrate/bin/node/testing/src/genesis.rs | 1 + 14 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs index 3a87322664d9..82f86e2b32ef 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs @@ -62,6 +62,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs index 219d1306906c..fd84030ed13b 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs @@ -58,6 +58,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: asset_hub_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/genesis.rs index 12778215b132..3786d529ea65 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/genesis.rs @@ -52,6 +52,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: bridge_hub_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend/src/genesis.rs index 4be68e510f4d..a160d18d4cf7 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend/src/genesis.rs @@ -51,6 +51,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: bridge_hub_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend/src/genesis.rs index 6a28b1a9dddb..d4ef184ea392 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend/src/genesis.rs @@ -51,6 +51,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: collectives_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/genesis.rs index f72de52c4932..e0f035c368e3 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/genesis.rs @@ -51,6 +51,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: coretime_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/src/genesis.rs index 222ffe7a63ab..239ad3760c11 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/src/genesis.rs @@ -51,6 +51,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: coretime_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo/src/genesis.rs index b14009933029..43d182facdd5 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo/src/genesis.rs @@ -47,6 +47,7 @@ pub fn genesis() -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: people_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs index d385fbebc821..0f5f875d77db 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs @@ -45,8 +45,8 @@ pub fn genesis() -> Storage { acc, // validator id people_westend_runtime::SessionKeys { aura }, // session keys ) - }) - .collect(), + }), + ..Default::default() }, polkadot_xcm: people_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs index 450439f5ea30..260875088bbc 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs @@ -59,6 +59,7 @@ pub fn genesis(para_id: u32) -> Storage { ) }) .collect(), + ..Default::default() }, polkadot_xcm: penpal_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/cumulus/parachains/integration-tests/emulated/chains/relays/rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/relays/rococo/src/genesis.rs index 074a1de5e185..9cb25b403600 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/relays/rococo/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/relays/rococo/src/genesis.rs @@ -75,6 +75,7 @@ pub fn genesis() -> Storage { ) }) .collect::>(), + ..Default::default() }, babe: rococo_runtime::BabeConfig { authorities: Default::default(), diff --git a/cumulus/parachains/integration-tests/emulated/chains/relays/westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/relays/westend/src/genesis.rs index b9f12932b84e..172e6e0ac93e 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/relays/westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/relays/westend/src/genesis.rs @@ -77,6 +77,7 @@ pub fn genesis() -> Storage { ) }) .collect::>(), + ..Default::default() }, staking: westend_runtime::StakingConfig { validator_count: validators::initial_authorities().len() as u32, diff --git a/cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs b/cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs index 45920cdb6146..af5bccdc416f 100644 --- a/cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs +++ b/cumulus/polkadot-parachain/src/chain_spec/asset_hubs.rs @@ -389,6 +389,7 @@ fn asset_hub_rococo_genesis( ) }) .collect(), + ..Default::default() }, "polkadotXcm": asset_hub_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/substrate/bin/node/testing/src/genesis.rs b/substrate/bin/node/testing/src/genesis.rs index c79612d68444..7f5364744c66 100644 --- a/substrate/bin/node/testing/src/genesis.rs +++ b/substrate/bin/node/testing/src/genesis.rs @@ -54,6 +54,7 @@ pub fn config_endowed(extra_endowed: Vec) -> RuntimeGenesisConfig { (bob(), eve(), session_keys_from_seed(Ed25519Keyring::Bob.into())), (charlie(), ferdie(), session_keys_from_seed(Ed25519Keyring::Charlie.into())), ], + ..Default::default() }, staking: StakingConfig { stakers: vec![ From 718b9246d4cdb710740ec0d564d84f1ff9335606 Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 26 Jul 2024 10:19:44 +0200 Subject: [PATCH 14/17] fix leftover collect --- .../chains/parachains/people/people-westend/src/genesis.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs index 0f5f875d77db..0b99f19bc130 100644 --- a/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs +++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend/src/genesis.rs @@ -45,7 +45,8 @@ pub fn genesis() -> Storage { acc, // validator id people_westend_runtime::SessionKeys { aura }, // session keys ) - }), + }) + .collect(), ..Default::default() }, polkadot_xcm: people_westend_runtime::PolkadotXcmConfig { From 32e4f80a243ca2c4f1ff09a53cd2bdec99b38ee9 Mon Sep 17 00:00:00 2001 From: girazoki Date: Fri, 26 Jul 2024 14:58:29 +0200 Subject: [PATCH 15/17] fmt --- substrate/frame/session/src/historical/offchain.rs | 4 +++- substrate/frame/session/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/substrate/frame/session/src/historical/offchain.rs b/substrate/frame/session/src/historical/offchain.rs index 0c4e73044db7..e9ced89a8f19 100644 --- a/substrate/frame/session/src/historical/offchain.rs +++ b/substrate/frame/session/src/historical/offchain.rs @@ -171,7 +171,9 @@ mod tests { } }); - crate::GenesisConfig:: { keys, ..Default::default() }.assimilate_storage(&mut t).unwrap(); + crate::GenesisConfig:: { keys, ..Default::default() } + .assimilate_storage(&mut t) + .unwrap(); let mut ext = sp_io::TestExternalities::new(t); diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index b90fc10d0acf..325758d54dd8 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -423,7 +423,7 @@ pub mod pallet { #[pallet::genesis_config] #[derive(frame_support::DefaultNoBound)] pub struct GenesisConfig { - /// /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, + /// Initial list of validator at genesis representing by their `(AccountId, ValidatorId, /// Keys)`. These keys will be considered authorities for the first two sessions and they /// will be valid at least until session 2 pub keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>, From 14206217f95ec77d3e0da26fc23274b683f8afe1 Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 29 Jul 2024 10:41:34 +0200 Subject: [PATCH 16/17] fix failing test --- substrate/bin/node/cli/tests/res/default_genesis_config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/substrate/bin/node/cli/tests/res/default_genesis_config.json b/substrate/bin/node/cli/tests/res/default_genesis_config.json index b63e5ff549ef..a2e52837d882 100644 --- a/substrate/bin/node/cli/tests/res/default_genesis_config.json +++ b/substrate/bin/node/cli/tests/res/default_genesis_config.json @@ -34,7 +34,9 @@ "maxNominatorCount": null }, "session": { - "keys": [] + "keys": [], + "nonAuthorityKeys": [] + }, "democracy": {}, "council": { From 395e9b602c9a858978224b7281c83bb90c1afa9f Mon Sep 17 00:00:00 2001 From: girazoki Date: Mon, 29 Jul 2024 15:36:19 +0200 Subject: [PATCH 17/17] prdoc --- prdoc/pr_5078.prdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/prdoc/pr_5078.prdoc b/prdoc/pr_5078.prdoc index 56c7d16d256a..1805a27c3f28 100644 --- a/prdoc/pr_5078.prdoc +++ b/prdoc/pr_5078.prdoc @@ -15,4 +15,20 @@ crates: - name: pallet-collator-selection bump: none - name: pallet-root-offences + bump: none +- name: pallet-babe + bump: none +- name: pallet-staking + bump: none +- name: pallet-grandpa + bump: none +- name: pallet-collator-selection + bump: none +- name: pallet-beefy + bump: none +- name: pallet-beefy-mmr + bump: none +- name: pallet-root-offences + bump: none +- name: polkadot-parachain-bin bump: none \ No newline at end of file