cargo +nightly fmt (#3540)

* cargo +nightly fmt

* add cargo-fmt check to ci

* update ci

* fmt

* fmt

* skip macro

* ignore bridges
This commit is contained in:
Shawn Tabrizi
2021-08-02 12:47:33 +02:00
committed by GitHub
parent 30e3012270
commit ff5d56fb76
350 changed files with 20617 additions and 21266 deletions
+283 -291
View File
@@ -16,8 +16,6 @@
//! Polkadot chain configurations.
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use beefy_primitives::crypto::AuthorityId as BeefyId;
use grandpa::AuthorityId as GrandpaId;
#[cfg(feature = "kusama-native")]
@@ -29,6 +27,8 @@ use pallet_staking::Forcing;
use polkadot::constants::currency::UNITS as DOT;
use polkadot_primitives::v1::{AccountId, AccountPublic, AssignmentId, ValidatorId};
use polkadot_runtime as polkadot;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
#[cfg(feature = "rococo-native")]
use rococo_runtime as rococo;
@@ -110,10 +110,7 @@ pub struct RococoGenesisExt {
#[cfg(feature = "rococo-native")]
impl sp_runtime::BuildStorage for RococoGenesisExt {
fn assimilate_storage(
&self,
storage: &mut sp_core::storage::Storage,
) -> Result<(), String> {
fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> {
sp_state_machine::BasicExternalities::execute_with_storage(storage, || {
if let Some(length) = self.session_length_in_blocks.as_ref() {
rococo::constants::time::EpochDurationInBlocks::set(length);
@@ -146,9 +143,10 @@ pub fn wococo_config() -> Result<RococoChainSpec, String> {
/// The default parachains host configuration.
#[cfg(any(feature = "rococo-native", feature = "kusama-native", feature = "westend-native"))]
fn default_parachains_host_configuration() ->
polkadot_runtime_parachains::configuration::HostConfiguration<polkadot_primitives::v1::BlockNumber>
{
fn default_parachains_host_configuration(
) -> polkadot_runtime_parachains::configuration::HostConfiguration<
polkadot_primitives::v1::BlockNumber,
> {
use polkadot_primitives::v1::{MAX_CODE_SIZE, MAX_POV_SIZE};
polkadot_runtime_parachains::configuration::HostConfiguration {
@@ -325,14 +323,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
minimum_validator_count: 4,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
polkadot::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::ForceNone,
@@ -341,10 +332,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
},
phragmen_election: Default::default(),
democracy: Default::default(),
council: polkadot::CouncilConfig {
members: vec![],
phantom: Default::default(),
},
council: polkadot::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: polkadot::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
@@ -357,10 +345,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] },
claims: polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
},
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(),
}
@@ -386,78 +371,104 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
)> = vec![(
//5ERCqy118nnXDai8g4t3MjdX7ZC5PrQzQpe9vwex5cELWqbt
hex!["681af4f93073484e1acd6b27395d0d258f1a6b158c808846c8fd05ee2435056e"].into(),
//5GTS114cfQNBgpQULhMaNCPXGds6NokegCnikxDe1vqANhtn
hex!["c2463372598ebabd21ee5bc33e1d7e77f391d2df29ce2fbe6bed0d13be629a45"].into(),
//5FhGbceKeH7fuGogcBwd28ZCkAwDGYBADCTeHiYrvx2ztyRd
hex!["a097bfc6a33499ed843b711f52f523f8a7174f798a9f98620e52f4170dbe2948"].unchecked_into(),
//5Es7nDkJt2by5qVCCD7PZJdp76KJw1LdRCiNst5S5f4eecnz
hex!["7bde49dda82c2c9f082b807ef3ceebff96437d67b3e630c584db7a220ecafacf"].unchecked_into(),
//5D4e8zRjaYzFamqChGPPtu26PcKbKgUrhb7WqcNbKa2RDFUR
hex!["2c2fb730a7d9138e6d62fcf516f9ecc2d712af3f2f03ca330c9564b8c0c1bb33"].unchecked_into(),
//5DD3JY5ENkjcgVFbVSgUbZv7WmrnyJ8bxxu56ee6hZFiRdnh
hex!["3297a8622988cc23dd9c131e3fb8746d49e007f6e58a81d43420cd539e250e4c"].unchecked_into(),
//5Gpodowhud8FG9xENXR5YwTFbUAWyoEtw7sYFytFsG4z7SU6
hex!["d2932edf775088bd088dc5a112ad867c24cc95858f77f8a1ab014de8d4f96a3f"].unchecked_into(),
//5GUMj8tnjL3PJZgXoiWtgLCaMVNHBNeSeTqDsvcxmaVAjKn9
hex!["c2fb0f74591a00555a292bc4882d3158bafc4c632124cb60681f164ef81bcf72"].unchecked_into(),
),
(
//5HgDCznTkHKUjzPkQoTZGWbvbyqB7sqHDBPDKdF1FyVYM7Er
hex!["f8418f189f84814fd40cc1b2e90873e72ea789487f3b98ed42811ba76d10fc37"].into(),
//5GQTryeFwuvgmZ2tH5ZeAKZHRM9ch5WGVGo6ND9P8f9uMsNY
hex!["c002bb4af4a1bd2f33d104aef8a41878fe1ac94ba007029c4dfdefa8b698d043"].into(),
//5C7YkWSVH1zrpsE5KwW1ua1qatyphzYxiZrL24mjkxz7mUbn
hex!["022b14fbcf65a93b81f453105b9892c3fc4aa74c22c53b4abab019e1d58fbd41"].unchecked_into(),
//5GwFC6Tmg4fhj4PxSqHycgJxi3PDfnC9RGDsNHoRwAvXvpnZ
hex!["d77cafd3b32c8b52b0e2780a586a6e527c94f1bdec117c4e4acb0a491461ffa3"].unchecked_into(),
//5DSVrGURuDuh8Luzo8FYq7o2NWiUSLSN6QAVNrj9BtswWH6R
hex!["3cdb36a5a14715999faffd06c5b9e5dcdc24d4b46bc3e4df1aaad266112a7b49"].unchecked_into(),
//5DLEG2AupawCXGwhJtrzBRc3zAhuP8V662dDrUTzAsCiB9Ec
hex!["38134245c9919ecb20bf2eedbe943b69ba92ceb9eb5477b92b0afd3cb6ce2858"].unchecked_into(),
//5D83o9fDgnHxaKPkSx59hk8zYzqcgzN2mrf7cp8fiVEi7V4E
hex!["2ec917690dc1d676002e3504c530b2595490aa5a4603d9cc579b9485b8d0d854"].unchecked_into(),
//5DwBJquZgncRWXFxj2ydbF8LBUPPUbiq86sXWXgm8Z38m8L2
hex!["52bae9b8dedb8058dda93ec6f57d7e5a517c4c9f002a4636fada70fed0acf376"].unchecked_into(),
),
(
//5DMHpkRpQV7NWJFfn2zQxCLiAKv7R12PWFRPHKKk5X3JkYfP
hex!["38e280b35d08db46019a210a944e4b7177665232ab679df12d6a8bbb317a2276"].into(),
//5FbJpSHmFDe5FN3DVGe1R345ZePL9nhcC9V2Cczxo7q8q6rN
hex!["9c0bc0e2469924d718ae683737f818a47c46b0612376ecca06a2ac059fe1f870"].into(),
//5E5Pm3Udzxy26KGkLE5pc8JPfQrvkYHiaXWtuEfmQsBSgep9
hex!["58fecadc2df8182a27e999e7e1fd7c99f8ec18f2a81f9a0db38b3653613f3f4d"].unchecked_into(),
//5FxcystSLHtaWoy2HEgRNerj9PrUs452B6AvHVnQZm5ZQmqE
hex!["ac4d0c5e8f8486de05135c10a707f58aa29126d5eb28fdaaba00f9a505f5249d"].unchecked_into(),
//5E7KqVXaVGuAqiqMigpuH8oXHLVh4tmijmpJABLYANpjMkem
hex!["5a781385a0235fe8594dd101ec55ef9ba01883f8563a0cdd37b89e0303f6a578"].unchecked_into(),
//5H9AybjkpyZ79yN5nHuBqs6RKuZPgM7aAVVvTQsDFovgXb2A
hex!["e09570f62a062450d4406b4eb43e7f775ff954e37606646cd590d1818189501f"].unchecked_into(),
//5Ccgs7VwJKBawMbwMENDmj2eFAxhFdGksVHdk8aTAf4w7xox
hex!["1864832dae34df30846d5cc65973f58a2d01b337d094b1284ec3466ecc90251d"].unchecked_into(),
//5EsSaZZ7niJs7hmAtp4QeK19AcAuTp7WXB7N7gRipVooerq4
hex!["7c1d92535e6d94e21cffea6633a855a7e3c9684cd2f209e5ddbdeaf5111e395b"].unchecked_into(),
),
(
//5Ea11qhmGRntQ7pyEkEydbwxvfrYwGMKW6rPERU4UiSBB6rd
hex!["6ed057d2c833c45629de2f14b9f6ce6df1edbf9421b7a638e1fb4828c2bd2651"].into(),
//5CZomCZwPB78BZMZsCiy7WSpkpHhdrN8QTSyjcK3FFEZHBor
hex!["1631ff446b3534d031adfc37b7f7aed26d2a6b3938d10496aab3345c54707429"].into(),
//5CSM6vppouFHzAVPkVFWN76DPRUG7B9qwJe892ccfSfJ8M5f
hex!["108188c43a7521e1abe737b343341c2179a3a89626c7b017c09a5b10df6f1c42"].unchecked_into(),
//5GwkG4std9KcjYi3ThSC7QWfhqokmYVvWEqTU9h7iswjhLnr
hex!["d7de8a43f7ee49fa3b3aaf32fb12617ec9ff7b246a46ab14e9c9d259261117fa"].unchecked_into(),
//5CoUk3wrCGJAWbiJEcsVjYhnd2JAHvR59jBRbSw77YrBtRL1
hex!["209f680bc501f9b59358efe3636c51fd61238a8659bac146db909aea2595284b"].unchecked_into(),
//5EcSu96wprFM7G2HfJTjYu8kMParnYGznSUNTsoEKXywEsgG
hex!["70adf80395b3f59e4cab5d9da66d5a286a0b6e138652a06f72542e46912df922"].unchecked_into(),
//5Ge3sjpD43Cuy7rNoJQmE9WctgCn6Faw89Pe7xPs3i55eHwJ
hex!["ca5f6b970b373b303f64801a0c2cadc4fc05272c6047a2560a27d0c65589ca1d"].unchecked_into(),
//5EFcjHLvB2z5vd5g63n4gABmhzP5iPsKvTwd8sjfvTehNNrk
hex!["60cae7fa5a079d9fc8061d715fbcc35ef57c3b00005694c2badce22dcc5a9f1b"].unchecked_into(),
)];
)> = vec![
(
//5ERCqy118nnXDai8g4t3MjdX7ZC5PrQzQpe9vwex5cELWqbt
hex!["681af4f93073484e1acd6b27395d0d258f1a6b158c808846c8fd05ee2435056e"].into(),
//5GTS114cfQNBgpQULhMaNCPXGds6NokegCnikxDe1vqANhtn
hex!["c2463372598ebabd21ee5bc33e1d7e77f391d2df29ce2fbe6bed0d13be629a45"].into(),
//5FhGbceKeH7fuGogcBwd28ZCkAwDGYBADCTeHiYrvx2ztyRd
hex!["a097bfc6a33499ed843b711f52f523f8a7174f798a9f98620e52f4170dbe2948"]
.unchecked_into(),
//5Es7nDkJt2by5qVCCD7PZJdp76KJw1LdRCiNst5S5f4eecnz
hex!["7bde49dda82c2c9f082b807ef3ceebff96437d67b3e630c584db7a220ecafacf"]
.unchecked_into(),
//5D4e8zRjaYzFamqChGPPtu26PcKbKgUrhb7WqcNbKa2RDFUR
hex!["2c2fb730a7d9138e6d62fcf516f9ecc2d712af3f2f03ca330c9564b8c0c1bb33"]
.unchecked_into(),
//5DD3JY5ENkjcgVFbVSgUbZv7WmrnyJ8bxxu56ee6hZFiRdnh
hex!["3297a8622988cc23dd9c131e3fb8746d49e007f6e58a81d43420cd539e250e4c"]
.unchecked_into(),
//5Gpodowhud8FG9xENXR5YwTFbUAWyoEtw7sYFytFsG4z7SU6
hex!["d2932edf775088bd088dc5a112ad867c24cc95858f77f8a1ab014de8d4f96a3f"]
.unchecked_into(),
//5GUMj8tnjL3PJZgXoiWtgLCaMVNHBNeSeTqDsvcxmaVAjKn9
hex!["c2fb0f74591a00555a292bc4882d3158bafc4c632124cb60681f164ef81bcf72"]
.unchecked_into(),
),
(
//5HgDCznTkHKUjzPkQoTZGWbvbyqB7sqHDBPDKdF1FyVYM7Er
hex!["f8418f189f84814fd40cc1b2e90873e72ea789487f3b98ed42811ba76d10fc37"].into(),
//5GQTryeFwuvgmZ2tH5ZeAKZHRM9ch5WGVGo6ND9P8f9uMsNY
hex!["c002bb4af4a1bd2f33d104aef8a41878fe1ac94ba007029c4dfdefa8b698d043"].into(),
//5C7YkWSVH1zrpsE5KwW1ua1qatyphzYxiZrL24mjkxz7mUbn
hex!["022b14fbcf65a93b81f453105b9892c3fc4aa74c22c53b4abab019e1d58fbd41"]
.unchecked_into(),
//5GwFC6Tmg4fhj4PxSqHycgJxi3PDfnC9RGDsNHoRwAvXvpnZ
hex!["d77cafd3b32c8b52b0e2780a586a6e527c94f1bdec117c4e4acb0a491461ffa3"]
.unchecked_into(),
//5DSVrGURuDuh8Luzo8FYq7o2NWiUSLSN6QAVNrj9BtswWH6R
hex!["3cdb36a5a14715999faffd06c5b9e5dcdc24d4b46bc3e4df1aaad266112a7b49"]
.unchecked_into(),
//5DLEG2AupawCXGwhJtrzBRc3zAhuP8V662dDrUTzAsCiB9Ec
hex!["38134245c9919ecb20bf2eedbe943b69ba92ceb9eb5477b92b0afd3cb6ce2858"]
.unchecked_into(),
//5D83o9fDgnHxaKPkSx59hk8zYzqcgzN2mrf7cp8fiVEi7V4E
hex!["2ec917690dc1d676002e3504c530b2595490aa5a4603d9cc579b9485b8d0d854"]
.unchecked_into(),
//5DwBJquZgncRWXFxj2ydbF8LBUPPUbiq86sXWXgm8Z38m8L2
hex!["52bae9b8dedb8058dda93ec6f57d7e5a517c4c9f002a4636fada70fed0acf376"]
.unchecked_into(),
),
(
//5DMHpkRpQV7NWJFfn2zQxCLiAKv7R12PWFRPHKKk5X3JkYfP
hex!["38e280b35d08db46019a210a944e4b7177665232ab679df12d6a8bbb317a2276"].into(),
//5FbJpSHmFDe5FN3DVGe1R345ZePL9nhcC9V2Cczxo7q8q6rN
hex!["9c0bc0e2469924d718ae683737f818a47c46b0612376ecca06a2ac059fe1f870"].into(),
//5E5Pm3Udzxy26KGkLE5pc8JPfQrvkYHiaXWtuEfmQsBSgep9
hex!["58fecadc2df8182a27e999e7e1fd7c99f8ec18f2a81f9a0db38b3653613f3f4d"]
.unchecked_into(),
//5FxcystSLHtaWoy2HEgRNerj9PrUs452B6AvHVnQZm5ZQmqE
hex!["ac4d0c5e8f8486de05135c10a707f58aa29126d5eb28fdaaba00f9a505f5249d"]
.unchecked_into(),
//5E7KqVXaVGuAqiqMigpuH8oXHLVh4tmijmpJABLYANpjMkem
hex!["5a781385a0235fe8594dd101ec55ef9ba01883f8563a0cdd37b89e0303f6a578"]
.unchecked_into(),
//5H9AybjkpyZ79yN5nHuBqs6RKuZPgM7aAVVvTQsDFovgXb2A
hex!["e09570f62a062450d4406b4eb43e7f775ff954e37606646cd590d1818189501f"]
.unchecked_into(),
//5Ccgs7VwJKBawMbwMENDmj2eFAxhFdGksVHdk8aTAf4w7xox
hex!["1864832dae34df30846d5cc65973f58a2d01b337d094b1284ec3466ecc90251d"]
.unchecked_into(),
//5EsSaZZ7niJs7hmAtp4QeK19AcAuTp7WXB7N7gRipVooerq4
hex!["7c1d92535e6d94e21cffea6633a855a7e3c9684cd2f209e5ddbdeaf5111e395b"]
.unchecked_into(),
),
(
//5Ea11qhmGRntQ7pyEkEydbwxvfrYwGMKW6rPERU4UiSBB6rd
hex!["6ed057d2c833c45629de2f14b9f6ce6df1edbf9421b7a638e1fb4828c2bd2651"].into(),
//5CZomCZwPB78BZMZsCiy7WSpkpHhdrN8QTSyjcK3FFEZHBor
hex!["1631ff446b3534d031adfc37b7f7aed26d2a6b3938d10496aab3345c54707429"].into(),
//5CSM6vppouFHzAVPkVFWN76DPRUG7B9qwJe892ccfSfJ8M5f
hex!["108188c43a7521e1abe737b343341c2179a3a89626c7b017c09a5b10df6f1c42"]
.unchecked_into(),
//5GwkG4std9KcjYi3ThSC7QWfhqokmYVvWEqTU9h7iswjhLnr
hex!["d7de8a43f7ee49fa3b3aaf32fb12617ec9ff7b246a46ab14e9c9d259261117fa"]
.unchecked_into(),
//5CoUk3wrCGJAWbiJEcsVjYhnd2JAHvR59jBRbSw77YrBtRL1
hex!["209f680bc501f9b59358efe3636c51fd61238a8659bac146db909aea2595284b"]
.unchecked_into(),
//5EcSu96wprFM7G2HfJTjYu8kMParnYGznSUNTsoEKXywEsgG
hex!["70adf80395b3f59e4cab5d9da66d5a286a0b6e138652a06f72542e46912df922"]
.unchecked_into(),
//5Ge3sjpD43Cuy7rNoJQmE9WctgCn6Faw89Pe7xPs3i55eHwJ
hex!["ca5f6b970b373b303f64801a0c2cadc4fc05272c6047a2560a27d0c65589ca1d"]
.unchecked_into(),
//5EFcjHLvB2z5vd5g63n4gABmhzP5iPsKvTwd8sjfvTehNNrk
hex!["60cae7fa5a079d9fc8061d715fbcc35ef57c3b00005694c2badce22dcc5a9f1b"]
.unchecked_into(),
),
];
const ENDOWMENT: u128 = 1_000_000 * WND;
const STASH: u128 = 100 * WND;
@@ -499,14 +510,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
minimum_validator_count: 4,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
westend::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, westend::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::ForceNone,
@@ -521,9 +525,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
im_online: Default::default(),
authority_discovery: westend::AuthorityDiscoveryConfig { keys: vec![] },
vesting: westend::VestingConfig { vesting: vec![] },
sudo: westend::SudoConfig {
key: endowed_accounts[0].clone(),
},
sudo: westend::SudoConfig { key: endowed_accounts[0].clone() },
configuration: westend::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
@@ -695,14 +697,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
minimum_validator_count: 4,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
kusama::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, kusama::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::ForceNone,
@@ -711,10 +706,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
},
phragmen_election: Default::default(),
democracy: Default::default(),
council: kusama::CouncilConfig {
members: vec![],
phantom: Default::default(),
},
council: kusama::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: kusama::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
@@ -727,10 +719,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] },
claims: kusama::ClaimsConfig {
claims: vec![],
vesting: vec![],
},
claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: kusama::VestingConfig { vesting: vec![] },
treasury: Default::default(),
configuration: kusama::ConfigurationConfig {
@@ -770,19 +759,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5FeSEpi9UYYaWwXXb3tV88qtZkmSdB3mvgj3pXkxKyYLGhcd
hex!["9e6e781a76810fe93187af44c79272c290c2b9e2b8b92ee11466cd79d8023f50"].into(),
//5Fh6rDpMDhM363o1Z3Y9twtaCPfizGQWCi55BSykTQjGbP7H
hex!["a076ef1280d768051f21d060623da3ab5b56944d681d303ed2d4bf658c5bed35"].unchecked_into(),
hex!["a076ef1280d768051f21d060623da3ab5b56944d681d303ed2d4bf658c5bed35"]
.unchecked_into(),
//5CPd3zoV9Aaah4xWucuDivMHJ2nEEmpdi864nPTiyRZp4t87
hex!["0e6d7d1afbcc6547b92995a394ba0daed07a2420be08220a5a1336c6731f0bfa"].unchecked_into(),
hex!["0e6d7d1afbcc6547b92995a394ba0daed07a2420be08220a5a1336c6731f0bfa"]
.unchecked_into(),
//5F7BEa1LGFksUihyatf3dCDYneB8pWzVyavnByCsm5nBgezi
hex!["86975a37211f8704e947a365b720f7a3e2757988eaa7d0f197e83dba355ef743"].unchecked_into(),
hex!["86975a37211f8704e947a365b720f7a3e2757988eaa7d0f197e83dba355ef743"]
.unchecked_into(),
//5CP6oGfwqbEfML8efqm1tCZsUgRsJztp9L8ZkEUxA16W8PPz
hex!["0e07a51d3213842f8e9363ce8e444255990a225f87e80a3d651db7841e1a0205"].unchecked_into(),
hex!["0e07a51d3213842f8e9363ce8e444255990a225f87e80a3d651db7841e1a0205"]
.unchecked_into(),
//5HQdwiDh8Qtd5dSNWajNYpwDvoyNWWA16Y43aEkCNactFc2b
hex!["ec60e71fe4a567ef9fef99d4bbf37ffae70564b41aa6f94ef0317c13e0a5477b"].unchecked_into(),
hex!["ec60e71fe4a567ef9fef99d4bbf37ffae70564b41aa6f94ef0317c13e0a5477b"]
.unchecked_into(),
//5HbSgM72xVuscsopsdeG3sCSCYdAeM1Tay9p79N6ky6vwDGq
hex!["f49eae66a0ac9f610316906ec8f1a0928e20d7059d76a5ca53cbcb5a9b50dd3c"].unchecked_into(),
hex!["f49eae66a0ac9f610316906ec8f1a0928e20d7059d76a5ca53cbcb5a9b50dd3c"]
.unchecked_into(),
//5DPSWdgw38Spu315r6LSvYCggeeieBAJtP5A1qzuzKhqmjVu
hex!["034f68c5661a41930c82f26a662276bf89f33467e1c850f2fb8ef687fe43d62276"].unchecked_into(),
hex!["034f68c5661a41930c82f26a662276bf89f33467e1c850f2fb8ef687fe43d62276"]
.unchecked_into(),
),
(
//5DvH8oEjQPYhzCoQVo7WDU91qmQfLZvxe9wJcrojmJKebCmG
@@ -790,19 +786,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5ENZvCRzyXJJYup8bM6yEzb2kQHEb1NDpY2ZEyVGBkCfRdj3
hex!["6618289af7ae8621981ffab34591e7a6486e12745dfa3fd3b0f7e6a3994c7b5b"].into(),
//5DLjSUfqZVNAADbwYLgRvHvdzXypiV1DAEaDMjcESKTcqMoM
hex!["38757d0de00a0c739e7d7984ef4bc01161bd61e198b7c01b618425c16bb5bd5f"].unchecked_into(),
hex!["38757d0de00a0c739e7d7984ef4bc01161bd61e198b7c01b618425c16bb5bd5f"]
.unchecked_into(),
//5HnDVBN9mD6mXyx8oryhDbJtezwNSj1VRXgLoYCBA6uEkiao
hex!["fcd5f87a6fd5707a25122a01b4dac0a8482259df7d42a9a096606df1320df08d"].unchecked_into(),
hex!["fcd5f87a6fd5707a25122a01b4dac0a8482259df7d42a9a096606df1320df08d"]
.unchecked_into(),
//5DhyXZiuB1LvqYKFgT5tRpgGsN3is2cM9QxgW7FikvakbAZP
hex!["48a910c0af90898f11bd57d37ceaea53c78994f8e1833a7ade483c9a84bde055"].unchecked_into(),
hex!["48a910c0af90898f11bd57d37ceaea53c78994f8e1833a7ade483c9a84bde055"]
.unchecked_into(),
//5EPEWRecy2ApL5n18n3aHyU1956zXTRqaJpzDa9DoqiggNwF
hex!["669a10892119453e9feb4e3f1ee8e028916cc3240022920ad643846fbdbee816"].unchecked_into(),
hex!["669a10892119453e9feb4e3f1ee8e028916cc3240022920ad643846fbdbee816"]
.unchecked_into(),
//5ES3fw5X4bndSgLNmtPfSbM2J1kLqApVB2CCLS4CBpM1UxUZ
hex!["68bf52c482630a8d1511f2edd14f34127a7d7082219cccf7fd4c6ecdb535f80d"].unchecked_into(),
hex!["68bf52c482630a8d1511f2edd14f34127a7d7082219cccf7fd4c6ecdb535f80d"]
.unchecked_into(),
//5HeXbwb5PxtcRoopPZTp5CQun38atn2UudQ8p2AxR5BzoaXw
hex!["f6f8fe475130d21165446a02fb1dbce3a7bf36412e5d98f4f0473aed9252f349"].unchecked_into(),
hex!["f6f8fe475130d21165446a02fb1dbce3a7bf36412e5d98f4f0473aed9252f349"]
.unchecked_into(),
//5F7nTtN8MyJV4UsXpjg7tHSnfANXZ5KRPJmkASc1ZSH2Xoa5
hex!["03a90c2bb6d3b7000020f6152fe2e5002fa970fd1f42aafb6c8edda8dacc2ea77e"].unchecked_into(),
hex!["03a90c2bb6d3b7000020f6152fe2e5002fa970fd1f42aafb6c8edda8dacc2ea77e"]
.unchecked_into(),
),
(
//5FPMzsezo1PRxYbVpJMWK7HNbR2kUxidsAAxH4BosHa4wd6S
@@ -810,19 +813,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5G6NQidFG7YiXsvV7hQTLGArir9tsYqD4JDxByhgxKvSKwRx
hex!["b235f57244230589523271c27b8a490922ffd7dccc83b044feaf22273c1dc735"].into(),
//5GpZhzAVg7SAtzLvaAC777pjquPEcNy1FbNUAG2nZvhmd6eY
hex!["d2644c1ab2c63a3ad8d40ad70d4b260969e3abfe6d7e6665f50dc9f6365c9d2a"].unchecked_into(),
hex!["d2644c1ab2c63a3ad8d40ad70d4b260969e3abfe6d7e6665f50dc9f6365c9d2a"]
.unchecked_into(),
//5HAes2RQYPbYKbLBfKb88f4zoXv6pPA6Ke8CjN7dob3GpmSP
hex!["e1b68fbd84333e31486c08e6153d9a1415b2e7e71b413702b7d64e9b631184a1"].unchecked_into(),
hex!["e1b68fbd84333e31486c08e6153d9a1415b2e7e71b413702b7d64e9b631184a1"]
.unchecked_into(),
//5HTXBf36LXmkFWJLokNUK6fPxVpkr2ToUnB1pvaagdGu4c1T
hex!["ee93e26259decb89afcf17ef2aa0fa2db2e1042fb8f56ecfb24d19eae8629878"].unchecked_into(),
hex!["ee93e26259decb89afcf17ef2aa0fa2db2e1042fb8f56ecfb24d19eae8629878"]
.unchecked_into(),
//5FtAGDZYJKXkhVhAxCQrXmaP7EE2mGbBMfmKDHjfYDgq2BiU
hex!["a8e61ffacafaf546283dc92d14d7cc70ea0151a5dd81fdf73ff5a2951f2b6037"].unchecked_into(),
hex!["a8e61ffacafaf546283dc92d14d7cc70ea0151a5dd81fdf73ff5a2951f2b6037"]
.unchecked_into(),
//5CtK7JHv3h6UQZ44y54skxdwSVBRtuxwPE1FYm7UZVhg8rJV
hex!["244f3421b310c68646e99cdbf4963e02067601f57756b072a4b19431448c186e"].unchecked_into(),
hex!["244f3421b310c68646e99cdbf4963e02067601f57756b072a4b19431448c186e"]
.unchecked_into(),
//5D4r6YaB6F7A7nvMRHNFNF6zrR9g39bqDJFenrcaFmTCRwfa
hex!["2c57f81fd311c1ab53813c6817fe67f8947f8d39258252663b3384ab4195494d"].unchecked_into(),
hex!["2c57f81fd311c1ab53813c6817fe67f8947f8d39258252663b3384ab4195494d"]
.unchecked_into(),
//5EPoHj8uV4fFKQHYThc6Z9fDkU7B6ih2ncVzQuDdNFb8UyhF
hex!["039d065fe4f9234f0a4f13cc3ae585f2691e9c25afa469618abb6645111f607a53"].unchecked_into(),
hex!["039d065fe4f9234f0a4f13cc3ae585f2691e9c25afa469618abb6645111f607a53"]
.unchecked_into(),
),
(
//5DMNx7RoX6d7JQ38NEM7DWRcW2THu92LBYZEWvBRhJeqcWgR
@@ -830,19 +840,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5GGdKNDr9P47dpVnmtq3m8Tvowwf1ot1abw6tPsTYYFoKm2v
hex!["ba0898c1964196474c0be08d364cdf4e9e1d47088287f5235f70b0590dfe1704"].into(),
//5EjkyPCzR2SjhDZq8f7ufsw6TfkvgNRepjCRQFc4TcdXdaB1
hex!["764186bc30fd5a02477f19948dc723d6d57ab174debd4f80ed6038ec960bfe21"].unchecked_into(),
hex!["764186bc30fd5a02477f19948dc723d6d57ab174debd4f80ed6038ec960bfe21"]
.unchecked_into(),
//5DJV3zCBTJBLGNDCcdWrYxWDacSz84goGTa4pFeKVvehEBte
hex!["36be9069cdb4a8a07ecd51f257875150f0a8a1be44a10d9d98dabf10a030aef4"].unchecked_into(),
hex!["36be9069cdb4a8a07ecd51f257875150f0a8a1be44a10d9d98dabf10a030aef4"]
.unchecked_into(),
//5FHf8kpK4fPjEJeYcYon2gAPwEBubRvtwpzkUbhMWSweKPUY
hex!["8e95b9b5b4dc69790b67b566567ca8bf8cdef3a3a8bb65393c0d1d1c87cd2d2c"].unchecked_into(),
hex!["8e95b9b5b4dc69790b67b566567ca8bf8cdef3a3a8bb65393c0d1d1c87cd2d2c"]
.unchecked_into(),
//5F9FsRjpecP9GonktmtFL3kjqNAMKjHVFjyjRdTPa4hbQRZA
hex!["882d72965e642677583b333b2d173ac94b5fd6c405c76184bb14293be748a13b"].unchecked_into(),
hex!["882d72965e642677583b333b2d173ac94b5fd6c405c76184bb14293be748a13b"]
.unchecked_into(),
//5F1FZWZSj3JyTLs8sRBxU6QWyGLSL9BMRtmSKDmVEoiKFxSP
hex!["821271c99c958b9220f1771d9f5e29af969edfa865631dba31e1ab7bc0582b75"].unchecked_into(),
hex!["821271c99c958b9220f1771d9f5e29af969edfa865631dba31e1ab7bc0582b75"]
.unchecked_into(),
//5CtgRR74VypK4h154s369abs78hDUxZSJqcbWsfXvsjcHJNA
hex!["2496f28d887d84705c6dae98aee8bf90fc5ad10bb5545eca1de6b68425b70f7c"].unchecked_into(),
hex!["2496f28d887d84705c6dae98aee8bf90fc5ad10bb5545eca1de6b68425b70f7c"]
.unchecked_into(),
//5CPx6dsr11SCJHKFkcAQ9jpparS7FwXQBrrMznRo4Hqv1PXz
hex!["0307d29bbf6a5c4061c2157b44fda33b7bb4ec52a5a0305668c74688cedf288d58"].unchecked_into(),
hex!["0307d29bbf6a5c4061c2157b44fda33b7bb4ec52a5a0305668c74688cedf288d58"]
.unchecked_into(),
),
(
//5C8AL1Zb4bVazgT3EgDxFgcow1L4SJjVu44XcLC9CrYqFN4N
@@ -850,19 +867,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5FLYy3YKsAnooqE4hCudttAsoGKbVG3hYYBtVzwMjJQrevPa
hex!["90cab33f0bb501727faa8319f0845faef7d31008f178b65054b6629fe531b772"].into(),
//5Et3tfbVf1ByFThNAuUq5pBssdaPPskip5yob5GNyUFojXC7
hex!["7c94715e5dd8ab54221b1b6b2bfa5666f593f28a92a18e28052531de1bd80813"].unchecked_into(),
hex!["7c94715e5dd8ab54221b1b6b2bfa5666f593f28a92a18e28052531de1bd80813"]
.unchecked_into(),
//5EX1JBghGbQqWohTPU6msR9qZ2nYPhK9r3RTQ2oD1K8TCxaG
hex!["6c878e33b83c20324238d22240f735457b6fba544b383e70bb62a27b57380c81"].unchecked_into(),
hex!["6c878e33b83c20324238d22240f735457b6fba544b383e70bb62a27b57380c81"]
.unchecked_into(),
//5GqL8RbVAuNXpDhjQi1KrS1MyNuKhvus2AbmQwRGjpuGZmFu
hex!["d2f9d537ffa59919a4028afdb627c14c14c97a1547e13e8e82203d2049b15b1a"].unchecked_into(),
hex!["d2f9d537ffa59919a4028afdb627c14c14c97a1547e13e8e82203d2049b15b1a"]
.unchecked_into(),
//5EUNaBpX9mJgcmLQHyG5Pkms6tbDiKuLbeTEJS924Js9cA1N
hex!["6a8570b9c6408e54bacf123cc2bb1b0f087f9c149147d0005badba63a5a4ac01"].unchecked_into(),
hex!["6a8570b9c6408e54bacf123cc2bb1b0f087f9c149147d0005badba63a5a4ac01"]
.unchecked_into(),
//5CaZuueRVpMATZG4hkcrgDoF4WGixuz7zu83jeBdY3bgWGaG
hex!["16c69ea8d595e80b6736f44be1eaeeef2ac9c04a803cc4fd944364cb0d617a33"].unchecked_into(),
hex!["16c69ea8d595e80b6736f44be1eaeeef2ac9c04a803cc4fd944364cb0d617a33"]
.unchecked_into(),
//5DABsdQCDUGuhzVGWe5xXzYQ9rtrVxRygW7RXf9Tsjsw1aGJ
hex!["306ac5c772fe858942f92b6e28bd82fb7dd8cdd25f9a4626c1b0eee075fcb531"].unchecked_into(),
hex!["306ac5c772fe858942f92b6e28bd82fb7dd8cdd25f9a4626c1b0eee075fcb531"]
.unchecked_into(),
//5H91T5mHhoCw9JJG4NjghDdQyhC6L7XcSuBWKD3q3TAhEVvQ
hex!["02fb0330356e63a35dd930bc74525edf28b3bf5eb44aab9e9e4962c8309aaba6a6"].unchecked_into(),
hex!["02fb0330356e63a35dd930bc74525edf28b3bf5eb44aab9e9e4962c8309aaba6a6"]
.unchecked_into(),
),
(
//5C8XbDXdMNKJrZSrQURwVCxdNdk8AzG6xgLggbzuA399bBBF
@@ -870,19 +894,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5GsyzFP8qtF8tXPSsjhjxAeU1v7D1PZofuQKN9TdCc7Dp1JM
hex!["d4ffc4c05b47d1115ad200f7f86e307b20b46c50e1b72a912ec4f6f7db46b616"].into(),
//5GHWB8ZDzegLcMW7Gdd1BS6WHVwDdStfkkE4G7KjPjZNJBtD
hex!["bab3cccdcc34401e9b3971b96a662686cf755aa869a5c4b762199ce531b12c5b"].unchecked_into(),
hex!["bab3cccdcc34401e9b3971b96a662686cf755aa869a5c4b762199ce531b12c5b"]
.unchecked_into(),
//5GzDPGbUM9uH52ZEwydasTj8edokGUJ7vEpoFWp9FE1YNuFB
hex!["d9c056c98ca0e6b4eb7f5c58c007c1db7be0fe1f3776108f797dd4990d1ccc33"].unchecked_into(),
hex!["d9c056c98ca0e6b4eb7f5c58c007c1db7be0fe1f3776108f797dd4990d1ccc33"]
.unchecked_into(),
//5GWZbVkJEfWZ7fRca39YAQeqri2Z7pkeHyd7rUctUHyQifLp
hex!["c4a980da30939d5bb9e4a734d12bf81259ae286aa21fa4b65405347fa40eff35"].unchecked_into(),
hex!["c4a980da30939d5bb9e4a734d12bf81259ae286aa21fa4b65405347fa40eff35"]
.unchecked_into(),
//5CmLCFeSurRXXtwMmLcVo7sdJ9EqDguvJbuCYDcHkr3cpqyE
hex!["1efc23c0b51ad609ab670ecf45807e31acbd8e7e5cb7c07cf49ee42992d2867c"].unchecked_into(),
hex!["1efc23c0b51ad609ab670ecf45807e31acbd8e7e5cb7c07cf49ee42992d2867c"]
.unchecked_into(),
//5DnsSy8a8pfE2aFjKBDtKw7WM1V4nfE5sLzP15MNTka53GqS
hex!["4c64d3f06d28adeb36a892fdaccecace150bec891f04694448a60b74fa469c22"].unchecked_into(),
hex!["4c64d3f06d28adeb36a892fdaccecace150bec891f04694448a60b74fa469c22"]
.unchecked_into(),
//5CZdFnyzZvKetZTeUwj5APAYskVJe4QFiTezo5dQNsrnehGd
hex!["160ea09c5717270e958a3da42673fa011613a9539b2e4ebcad8626bc117ca04a"].unchecked_into(),
hex!["160ea09c5717270e958a3da42673fa011613a9539b2e4ebcad8626bc117ca04a"]
.unchecked_into(),
//5HgoR9JJkdBusxKrrs3zgd3ToppgNoGj1rDyAJp4e7eZiYyT
hex!["020019a8bb188f8145d02fa855e9c36e9914457d37c500e03634b5223aa5702474"].unchecked_into(),
hex!["020019a8bb188f8145d02fa855e9c36e9914457d37c500e03634b5223aa5702474"]
.unchecked_into(),
),
(
//5HinEonzr8MywkqedcpsmwpxKje2jqr9miEwuzyFXEBCvVXM
@@ -890,19 +921,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5EHJbj6Td6ks5HDnyfN4ttTSi57osxcQsQexm7XpazdeqtV7
hex!["62145d721967bd88622d08625f0f5681463c0f1b8bcd97eb3c2c53f7660fd513"].into(),
//5EeCsC58XgJ1DFaoYA1WktEpP27jvwGpKdxPMFjicpLeYu96
hex!["720537e2c1c554654d73b3889c3ef4c3c2f95a65dd3f7c185ebe4afebed78372"].unchecked_into(),
hex!["720537e2c1c554654d73b3889c3ef4c3c2f95a65dd3f7c185ebe4afebed78372"]
.unchecked_into(),
//5DnEySxbnppWEyN8cCLqvGjAorGdLRg2VmkY96dbJ1LHFK8N
hex!["4bea0b37e0cce9bddd80835fa2bfd5606f5dcfb8388bbb10b10c483f0856cf14"].unchecked_into(),
hex!["4bea0b37e0cce9bddd80835fa2bfd5606f5dcfb8388bbb10b10c483f0856cf14"]
.unchecked_into(),
//5E1Y1FJ7dVP7qtE3wm241pTm72rTMcDT5Jd8Czv7Pwp7N3AH
hex!["560d90ca51e9c9481b8a9810060e04d0708d246714960439f804e5c6f40ca651"].unchecked_into(),
hex!["560d90ca51e9c9481b8a9810060e04d0708d246714960439f804e5c6f40ca651"]
.unchecked_into(),
//5CAC278tFCHAeHYqE51FTWYxHmeLcENSS1RG77EFRTvPZMJT
hex!["042f07fc5268f13c026bbe199d63e6ac77a0c2a780f71cda05cee5a6f1b3f11f"].unchecked_into(),
hex!["042f07fc5268f13c026bbe199d63e6ac77a0c2a780f71cda05cee5a6f1b3f11f"]
.unchecked_into(),
//5HjRTLWcQjZzN3JDvaj1UzjNSayg5ZD9ZGWMstaL7Ab2jjAa
hex!["fab485e87ed1537d089df521edf983a777c57065a702d7ed2b6a2926f31da74f"].unchecked_into(),
hex!["fab485e87ed1537d089df521edf983a777c57065a702d7ed2b6a2926f31da74f"]
.unchecked_into(),
//5ELv74v7QcsS6FdzvG4vL2NnYDGWmRnJUSMKYwdyJD7Xcdi7
hex!["64d59feddb3d00316a55906953fb3db8985797472bd2e6c7ea1ab730cc339d7f"].unchecked_into(),
hex!["64d59feddb3d00316a55906953fb3db8985797472bd2e6c7ea1ab730cc339d7f"]
.unchecked_into(),
//5FaUcPt4fPz93vBhcrCJqmDkjYZ7jCbzAF56QJoCmvPaKrmx
hex!["033f1a6d47fe86f88934e4b83b9fae903b92b5dcf4fec97d5e3e8bf4f39df03685"].unchecked_into(),
hex!["033f1a6d47fe86f88934e4b83b9fae903b92b5dcf4fec97d5e3e8bf4f39df03685"]
.unchecked_into(),
),
(
//5Ey3NQ3dfabaDc16NUv7wRLsFCMDFJSqZFzKVycAsWuUC6Di
@@ -910,19 +948,26 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
//5HiWsuSBqt8nS9pnggexXuHageUifVPKPHDE2arTKqhTp1dV
hex!["fa0388fa88f3f0cb43d583e2571fbc0edad57dff3a6fd89775451dd2c2b8ea00"].into(),
//5H168nKX2Yrfo3bxj7rkcg25326Uv3CCCnKUGK6uHdKMdPt8
hex!["da6b2df18f0f9001a6dcf1d301b92534fe9b1f3ccfa10c49449fee93adaa8349"].unchecked_into(),
hex!["da6b2df18f0f9001a6dcf1d301b92534fe9b1f3ccfa10c49449fee93adaa8349"]
.unchecked_into(),
//5DrA2fZdzmNqT5j6DXNwVxPBjDV9jhkAqvjt6Us3bQHKy3cF
hex!["4ee66173993dd0db5d628c4c9cb61a27b76611ad3c3925947f0d0011ee2c5dcc"].unchecked_into(),
hex!["4ee66173993dd0db5d628c4c9cb61a27b76611ad3c3925947f0d0011ee2c5dcc"]
.unchecked_into(),
//5FNFDUGNLUtqg5LgrwYLNmBiGoP8KRxsvQpBkc7GQP6qaBUG
hex!["92156f54a114ee191415898f2da013d9db6a5362d6b36330d5fc23e27360ab66"].unchecked_into(),
hex!["92156f54a114ee191415898f2da013d9db6a5362d6b36330d5fc23e27360ab66"]
.unchecked_into(),
//5Gx6YeNhynqn8qkda9QKpc9S7oDr4sBrfAu516d3sPpEt26F
hex!["d822d4088b20dca29a580a577a97d6f024bb24c9550bebdfd7d2d18e946a1c7d"].unchecked_into(),
hex!["d822d4088b20dca29a580a577a97d6f024bb24c9550bebdfd7d2d18e946a1c7d"]
.unchecked_into(),
//5DhDcHqwxoes5s89AyudGMjtZXx1nEgrk5P45X88oSTR3iyx
hex!["481538f8c2c011a76d7d57db11c2789a5e83b0f9680dc6d26211d2f9c021ae4c"].unchecked_into(),
hex!["481538f8c2c011a76d7d57db11c2789a5e83b0f9680dc6d26211d2f9c021ae4c"]
.unchecked_into(),
//5DqAvikdpfRdk5rR35ZobZhqaC5bJXZcEuvzGtexAZP1hU3T
hex!["4e262811acdfe94528bfc3c65036080426a0e1301b9ada8d687a70ffcae99c26"].unchecked_into(),
hex!["4e262811acdfe94528bfc3c65036080426a0e1301b9ada8d687a70ffcae99c26"]
.unchecked_into(),
//5E41Znrr2YtZu8bZp3nvRuLVHg3jFksfQ3tXuviLku4wsao7
hex!["025e84e95ed043e387ddb8668176b42f8e2773ddd84f7f58a6d9bf436a4b527986"].unchecked_into(),
hex!["025e84e95ed043e387ddb8668176b42f8e2773ddd84f7f58a6d9bf436a4b527986"]
.unchecked_into(),
),
];
@@ -935,29 +980,33 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
changes_trie_config: Default::default(),
},
balances: rococo_runtime::BalancesConfig {
balances: endowed_accounts.iter()
balances: endowed_accounts
.iter()
.map(|k: &AccountId| (k.clone(), ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
.collect(),
},
beefy: Default::default(),
indices: rococo_runtime::IndicesConfig {
indices: vec![],
},
indices: rococo_runtime::IndicesConfig { indices: vec![] },
session: rococo_runtime::SessionConfig {
keys: initial_authorities.iter().map(|x| (
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)).collect::<Vec<_>>(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
.collect::<Vec<_>>(),
},
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
@@ -967,15 +1016,9 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
im_online: Default::default(),
collective: Default::default(),
membership: Default::default(),
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
keys: vec![],
},
sudo: rococo_runtime::SudoConfig {
key: endowed_accounts[0].clone(),
},
paras: rococo_runtime::ParasConfig {
paras: vec![],
},
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] },
sudo: rococo_runtime::SudoConfig { key: endowed_accounts[0].clone() },
paras: rococo_runtime::ParasConfig { paras: vec![] },
hrmp: Default::default(),
configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(),
@@ -1119,9 +1162,7 @@ pub fn get_authority_keys_from_seed(
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, keys.7, get_from_seed::<BeefyId>(seed))
}
/// Helper function to generate stash, controller and session key from seed
@@ -1194,10 +1235,7 @@ pub fn polkadot_testnet_genesis(
},
indices: polkadot::IndicesConfig { indices: vec![] },
balances: polkadot::BalancesConfig {
balances: endowed_accounts
.iter()
.map(|k| (k.clone(), ENDOWMENT))
.collect(),
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
},
session: polkadot::SessionConfig {
keys: initial_authorities
@@ -1223,14 +1261,7 @@ pub fn polkadot_testnet_genesis(
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
polkadot::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
@@ -1239,10 +1270,7 @@ pub fn polkadot_testnet_genesis(
},
phragmen_election: Default::default(),
democracy: polkadot::DemocracyConfig::default(),
council: polkadot::CouncilConfig {
members: vec![],
phantom: Default::default(),
},
council: polkadot::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: polkadot::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
@@ -1255,10 +1283,7 @@ pub fn polkadot_testnet_genesis(
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: polkadot::AuthorityDiscoveryConfig { keys: vec![] },
claims: polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
},
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(),
}
@@ -1293,10 +1318,7 @@ pub fn kusama_testnet_genesis(
},
indices: kusama::IndicesConfig { indices: vec![] },
balances: kusama::BalancesConfig {
balances: endowed_accounts
.iter()
.map(|k| (k.clone(), ENDOWMENT))
.collect(),
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
},
session: kusama::SessionConfig {
keys: initial_authorities
@@ -1322,14 +1344,7 @@ pub fn kusama_testnet_genesis(
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
kusama::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, kusama::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
@@ -1338,10 +1353,7 @@ pub fn kusama_testnet_genesis(
},
phragmen_election: Default::default(),
democracy: kusama::DemocracyConfig::default(),
council: kusama::CouncilConfig {
members: vec![],
phantom: Default::default(),
},
council: kusama::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: kusama::TechnicalCommitteeConfig {
members: vec![],
phantom: Default::default(),
@@ -1354,10 +1366,7 @@ pub fn kusama_testnet_genesis(
grandpa: Default::default(),
im_online: Default::default(),
authority_discovery: kusama::AuthorityDiscoveryConfig { keys: vec![] },
claims: kusama::ClaimsConfig {
claims: vec![],
vesting: vec![],
},
claims: kusama::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: kusama::VestingConfig { vesting: vec![] },
treasury: Default::default(),
configuration: kusama::ConfigurationConfig {
@@ -1397,10 +1406,7 @@ pub fn westend_testnet_genesis(
},
indices: westend::IndicesConfig { indices: vec![] },
balances: westend::BalancesConfig {
balances: endowed_accounts
.iter()
.map(|k| (k.clone(), ENDOWMENT))
.collect(),
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
},
session: westend::SessionConfig {
keys: initial_authorities
@@ -1426,14 +1432,7 @@ pub fn westend_testnet_genesis(
validator_count: initial_authorities.len() as u32,
stakers: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.1.clone(),
STASH,
westend::StakerStatus::Validator,
)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, westend::StakerStatus::Validator))
.collect(),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
force_era: Forcing::NotForcing,
@@ -1484,26 +1483,29 @@ pub fn rococo_testnet_genesis(
changes_trie_config: Default::default(),
},
beefy: Default::default(),
indices: rococo_runtime::IndicesConfig {
indices: vec![],
},
indices: rococo_runtime::IndicesConfig { indices: vec![] },
balances: rococo_runtime::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
},
session: rococo_runtime::SessionConfig {
keys: initial_authorities.iter().map(|x| (
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)).collect::<Vec<_>>(),
keys: initial_authorities
.iter()
.map(|x| {
(
x.0.clone(),
x.0.clone(),
rococo_session_keys(
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
x.6.clone(),
x.7.clone(),
x.8.clone(),
),
)
})
.collect::<Vec<_>>(),
},
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
@@ -1513,17 +1515,13 @@ pub fn rococo_testnet_genesis(
im_online: Default::default(),
collective: Default::default(),
membership: Default::default(),
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig {
keys: vec![],
},
authority_discovery: rococo_runtime::AuthorityDiscoveryConfig { keys: vec![] },
sudo: rococo_runtime::SudoConfig { key: root_key.clone() },
configuration: rococo_runtime::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
hrmp: Default::default(),
paras: rococo_runtime::ParasConfig {
paras: vec![],
},
paras: rococo_runtime::ParasConfig { paras: vec![] },
bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
owner: Some(root_key.clone()),
..Default::default()
@@ -1775,10 +1773,7 @@ pub fn westend_local_testnet_config() -> Result<WestendChainSpec, String> {
fn rococo_local_testnet_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig {
rococo_testnet_genesis(
wasm_binary,
vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
@@ -1811,10 +1806,7 @@ pub fn rococo_local_testnet_config() -> Result<RococoChainSpec, String> {
fn wococo_local_testnet_genesis(wasm_binary: &[u8]) -> rococo_runtime::GenesisConfig {
rococo_testnet_genesis(
wasm_binary,
vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
vec![get_authority_keys_from_seed("Alice"), get_authority_keys_from_seed("Bob")],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
)
+17 -54
View File
@@ -18,8 +18,7 @@
use std::sync::Arc;
use sp_runtime::traits::Header as _;
use sp_runtime::traits::{Block as BlockT, NumberFor};
use sp_runtime::traits::{Block as BlockT, Header as _, NumberFor};
use crate::HeaderProvider;
@@ -50,7 +49,7 @@ where
}
if *target_header.number() == target_number {
return Ok((target_hash, target_number));
return Ok((target_hash, target_number))
}
target_hash = *target_header.parent_hash();
@@ -86,18 +85,18 @@ where
// if we're past the pause period (i.e. `self.0 + self.1`)
// then we no longer need to restrict any votes
if *best_target.number() > self.0 + self.1 {
return None;
return None
}
// if we've finalized the pause block, just keep returning it
// until best number increases enough to pass the condition above
if *base.number() >= self.0 {
return Some((base.hash(), *base.number()));
return Some((base.hash(), *base.number()))
}
// otherwise find the target header at the pause block
// to vote on
return walk_backwards_to_target_block(&*backend, self.0, current_target).ok();
return walk_backwards_to_target_block(&*backend, self.0, current_target).ok()
}
None
@@ -125,51 +124,15 @@ pub(crate) fn kusama_hard_forks() -> Vec<(
use std::str::FromStr;
let forks = vec![
(
623,
"01e94e1e7e9cf07b3b0bf4e1717fce7448e5563901c2ef2e3b8e9ecaeba088b1",
1492283,
),
(
624,
"ddc4323c5e8966844dfaa87e0c2f74ef6b43115f17bf8e4ff38845a62d02b9a9",
1492436,
),
(
625,
"38ba115b296663e424e32d7b1655cd795719cef4fd7d579271a6d01086cf1628",
1492586,
),
(
626,
"f3172b6b8497c10fc772f5dada4eeb1f4c4919c97de9de2e1a439444d5a057ff",
1492955,
),
(
627,
"b26526aea299e9d24af29fdacd5cf4751a663d24894e3d0a37833aa14c58424a",
1493338,
),
(
628,
"3980d024327d53b8d01ef0d198a052cd058dd579508d8ed6283fe3614e0a3694",
1493913,
),
(
629,
"31f22997a786c25ee677786373368cae6fd501fd1bc4b212b8e267235c88179d",
1495083,
),
(
630,
"1c65eb250cf54b466c64f1a4003d1415a7ee275e49615450c0e0525179857eef",
1497404,
),
(
631,
"9e44116467cc9d7e224e36487bf2cf571698cae16b25f54a7430f1278331fdd8",
1498598,
),
(623, "01e94e1e7e9cf07b3b0bf4e1717fce7448e5563901c2ef2e3b8e9ecaeba088b1", 1492283),
(624, "ddc4323c5e8966844dfaa87e0c2f74ef6b43115f17bf8e4ff38845a62d02b9a9", 1492436),
(625, "38ba115b296663e424e32d7b1655cd795719cef4fd7d579271a6d01086cf1628", 1492586),
(626, "f3172b6b8497c10fc772f5dada4eeb1f4c4919c97de9de2e1a439444d5a057ff", 1492955),
(627, "b26526aea299e9d24af29fdacd5cf4751a663d24894e3d0a37833aa14c58424a", 1493338),
(628, "3980d024327d53b8d01ef0d198a052cd058dd579508d8ed6283fe3614e0a3694", 1493913),
(629, "31f22997a786c25ee677786373368cae6fd501fd1bc4b212b8e267235c88179d", 1495083),
(630, "1c65eb250cf54b466c64f1a4003d1415a7ee275e49615450c0e0525179857eef", 1497404),
(631, "9e44116467cc9d7e224e36487bf2cf571698cae16b25f54a7430f1278331fdd8", 1498598),
];
let authorities = vec![
@@ -253,14 +216,14 @@ pub(crate) fn kusama_hard_forks() -> Vec<(
#[cfg(test)]
mod tests {
use consensus_common::BlockOrigin;
use grandpa::VotingRule;
use polkadot_test_client::{
TestClientBuilder, TestClientBuilderExt, DefaultTestClientBuilderExt, InitPolkadotBlockBuilder,
ClientBlockImportExt,
ClientBlockImportExt, DefaultTestClientBuilderExt, InitPolkadotBlockBuilder,
TestClientBuilder, TestClientBuilderExt,
};
use sp_blockchain::HeaderBackend;
use sp_runtime::{generic::BlockId, traits::Header};
use consensus_common::BlockOrigin;
use std::sync::Arc;
#[test]
+187 -207
View File
@@ -28,10 +28,7 @@ mod overseer;
#[cfg(feature = "full-node")]
pub use self::overseer::{
OverseerGen,
OverseerGenArgs,
RealOverseerGen,
create_default_subsystems,
create_default_subsystems, OverseerGen, OverseerGenArgs, RealOverseerGen,
};
#[cfg(test)]
@@ -39,45 +36,43 @@ mod tests;
#[cfg(feature = "full-node")]
use {
tracing::info,
grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider},
polkadot_network_bridge::RequestMultiplexer,
polkadot_node_core_approval_voting::Config as ApprovalVotingConfig,
polkadot_node_core_av_store::Config as AvailabilityConfig,
polkadot_node_core_av_store::Error as AvailabilityError,
polkadot_node_core_approval_voting::Config as ApprovalVotingConfig,
polkadot_node_core_candidate_validation::Config as CandidateValidationConfig,
polkadot_node_core_chain_selection::{
self as chain_selection_subsystem,
Config as ChainSelectionConfig,
self as chain_selection_subsystem, Config as ChainSelectionConfig,
},
polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig,
polkadot_overseer::BlockInfo,
sp_trie::PrefixedMemoryDB,
sc_client_api::ExecutorProvider,
grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider},
sp_trie::PrefixedMemoryDB,
tracing::info,
};
pub use sp_core::traits::SpawnNamed;
#[cfg(feature = "full-node")]
pub use {
polkadot_overseer::{Handle, Overseer, OverseerHandle},
polkadot_primitives::v1::ParachainHost,
sc_client_api::AuxStore,
sp_authority_discovery::AuthorityDiscoveryApi,
sp_blockchain::HeaderBackend,
sp_consensus_babe::BabeApi,
sp_authority_discovery::AuthorityDiscoveryApi,
sc_client_api::AuxStore,
polkadot_primitives::v1::ParachainHost,
polkadot_overseer::{Overseer, Handle, OverseerHandle},
};
pub use sp_core::traits::SpawnNamed;
#[cfg(feature = "full-node")]
use polkadot_subsystem::jaeger;
use std::sync::Arc;
use std::time::Duration;
use std::{sync::Arc, time::Duration};
use prometheus_endpoint::Registry;
use service::RpcHandlers;
use telemetry::TelemetryWorker;
#[cfg(feature = "full-node")]
use telemetry::{Telemetry, TelemetryWorkerHandle};
use telemetry::TelemetryWorker;
#[cfg(feature = "rococo-native")]
pub use polkadot_client::RococoExecutor;
@@ -88,33 +83,28 @@ pub use polkadot_client::WestendExecutor;
#[cfg(feature = "kusama-native")]
pub use polkadot_client::KusamaExecutor;
pub use chain_spec::{KusamaChainSpec, PolkadotChainSpec, RococoChainSpec, WestendChainSpec};
pub use consensus_common::{block_validation::Chain, Proposal, SelectChain};
pub use polkadot_client::{
PolkadotExecutor, FullBackend, FullClient, AbstractClient, Client, ClientHandle, ExecuteWithClient,
RuntimeApiCollection,
AbstractClient, Client, ClientHandle, ExecuteWithClient, FullBackend, FullClient,
PolkadotExecutor, RuntimeApiCollection,
};
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec};
pub use consensus_common::{Proposal, SelectChain, block_validation::Chain};
pub use polkadot_primitives::v1::{Block, BlockId, CollatorPair, Hash, Id as ParaId};
pub use sc_client_api::{Backend, ExecutionStrategy, CallExecutor};
pub use sc_client_api::{Backend, CallExecutor, ExecutionStrategy};
pub use sc_consensus::{BlockImport, LongestChain};
pub use sc_executor::NativeExecutionDispatch;
pub use service::{
Role, PruningMode, TransactionPoolOptions, Error as SubstrateServiceError, RuntimeGenesis,
TFullClient, TLightClient, TFullBackend, TLightBackend, TFullCallExecutor, TLightCallExecutor,
Configuration, ChainSpec, TaskManager,
config::{DatabaseConfig, PrometheusConfig},
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, RuntimeGenesis,
TFullBackend, TFullCallExecutor, TFullClient, TLightBackend, TLightCallExecutor, TLightClient,
TaskManager, TransactionPoolOptions,
};
pub use service::config::{DatabaseConfig, PrometheusConfig};
pub use sp_api::{ApiRef, Core as CoreApi, ConstructRuntimeApi, ProvideRuntimeApi, StateBackend};
pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi, StateBackend};
pub use sp_runtime::{
generic,
traits::{
DigestFor,
HashFor,
NumberFor,
Block as BlockT,
Header as HeaderT,
self as runtime_traits,
BlakeTwo256,
self as runtime_traits, BlakeTwo256, Block as BlockT, DigestFor, HashFor,
Header as HeaderT, NumberFor,
},
};
@@ -306,7 +296,10 @@ fn jaeger_launch_collector_with_agent(
type FullSelectChain = relay_chain_selection::SelectRelayChainWithFallback<FullBackend>;
#[cfg(feature = "full-node")]
type FullGrandpaBlockImport<RuntimeApi, Executor> = grandpa::GrandpaBlockImport<
FullBackend, Block, FullClient<RuntimeApi, Executor>, FullSelectChain
FullBackend,
Block,
FullClient<RuntimeApi, Executor>,
FullSelectChain,
>;
#[cfg(feature = "light-node")]
@@ -323,7 +316,9 @@ fn new_partial<RuntimeApi, Executor>(
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
) -> Result<
service::PartialComponents<
FullClient<RuntimeApi, Executor>, FullBackend, FullSelectChain,
FullClient<RuntimeApi, Executor>,
FullBackend,
FullSelectChain,
sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, Executor>>,
(
@@ -333,7 +328,9 @@ fn new_partial<RuntimeApi, Executor>(
) -> polkadot_rpc::RpcExtension,
(
babe::BabeBlockImport<
Block, FullClient<RuntimeApi, Executor>, FullGrandpaBlockImport<RuntimeApi, Executor>
Block,
FullClient<RuntimeApi, Executor>,
FullGrandpaBlockImport<RuntimeApi, Executor>,
>,
grandpa::LinkHalf<Block, FullClient<RuntimeApi, Executor>, FullSelectChain>,
babe::BabeLink<Block>,
@@ -342,20 +339,22 @@ fn new_partial<RuntimeApi, Executor>(
grandpa::SharedVoterState,
std::time::Duration, // slot-duration
Option<Telemetry>,
)
),
>,
Error
Error,
>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
where
RuntimeApi:
ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Executor: NativeExecutionDispatch + 'static,
{
set_prometheus_registry(config)?;
let telemetry = config.telemetry_endpoints.clone()
let telemetry = config
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(move |endpoints| -> Result<_, telemetry::Error> {
let (worker, mut worker_handle) = if let Some(worker_handle) = telemetry_worker_handle {
@@ -377,13 +376,12 @@ fn new_partial<RuntimeApi, Executor>(
)?;
let client = Arc::new(client);
let telemetry = telemetry
.map(|(worker, telemetry)| {
if let Some(worker) = worker {
task_manager.spawn_handle().spawn("telemetry", worker.run());
}
telemetry
});
let telemetry = telemetry.map(|(worker, telemetry)| {
if let Some(worker) = worker {
task_manager.spawn_handle().spawn("telemetry", worker.run());
}
telemetry
});
jaeger_launch_collector_with_agent(task_manager.spawn_handle(), &*config, jaeger_agent)?;
@@ -407,23 +405,19 @@ fn new_partial<RuntimeApi, Executor>(
Vec::new()
};
let (grandpa_block_import, grandpa_link) =
grandpa::block_import_with_authority_set_hard_forks(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
grandpa_hard_forks,
telemetry.as_ref().map(|x| x.handle()),
)?;
let (grandpa_block_import, grandpa_link) = grandpa::block_import_with_authority_set_hard_forks(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
grandpa_hard_forks,
telemetry.as_ref().map(|x| x.handle()),
)?;
let justification_import = grandpa_block_import.clone();
let babe_config = babe::Config::get_or_compute(&*client)?;
let (block_import, babe_link) = babe::block_import(
babe_config.clone(),
grandpa_block_import,
client.clone(),
)?;
let (block_import, babe_link) =
babe::block_import(babe_config.clone(), grandpa_block_import, client.clone())?;
let slot_duration = babe_link.config().slot_duration();
let import_queue = babe::import_queue(
@@ -473,9 +467,9 @@ fn new_partial<RuntimeApi, Executor>(
let select_chain = select_chain.clone();
let chain_spec = config.chain_spec.cloned_box();
move |deny_unsafe, subscription_executor: polkadot_rpc::SubscriptionTaskExecutor|
-> polkadot_rpc::RpcExtension
{
move |deny_unsafe,
subscription_executor: polkadot_rpc::SubscriptionTaskExecutor|
-> polkadot_rpc::RpcExtension {
let deps = polkadot_rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
@@ -512,7 +506,7 @@ fn new_partial<RuntimeApi, Executor>(
select_chain,
import_queue,
transaction_pool,
other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, telemetry)
other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, telemetry),
})
}
@@ -577,10 +571,11 @@ async fn active_leaves<RuntimeApi, Executor>(
client: &FullClient<RuntimeApi, Executor>,
) -> Result<Vec<BlockInfo>, Error>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApi:
ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Executor: NativeExecutionDispatch + 'static,
{
let best_block = select_chain.best_chain().await?;
@@ -601,11 +596,7 @@ where
let parent_hash = client.header(&BlockId::Hash(hash)).ok()??.parent_hash;
Some(BlockInfo {
hash,
parent_hash,
number,
})
Some(BlockInfo { hash, parent_hash, number })
})
.collect::<Vec<_>>();
@@ -636,12 +627,13 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
program_path: Option<std::path::PathBuf>,
overseer_gen: OverseerGenerator,
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
where
RuntimeApi:
ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
OverseerGenerator: OverseerGen,
Executor: NativeExecutionDispatch + 'static,
OverseerGenerator: OverseerGen,
{
let role = config.role.clone();
let force_authoring = config.force_authoring;
@@ -669,7 +661,7 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
mut select_chain,
import_queue,
transaction_pool,
other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, mut telemetry)
other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, mut telemetry),
} = new_partial::<RuntimeApi, Executor>(&mut config, jaeger_agent, telemetry_worker_handle)?;
let prometheus_registry = config.prometheus_registry().cloned();
@@ -688,11 +680,7 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
{
use polkadot_network_bridge::{peer_sets_info, IsAuthority};
let is_authority = if role.is_authority() {
IsAuthority::Yes
} else {
IsAuthority::No
};
let is_authority = if role.is_authority() { IsAuthority::Yes } else { IsAuthority::No };
config.network.extra_sets.extend(peer_sets_info(is_authority));
}
@@ -703,8 +691,8 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
};
let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
import_setup.1.shared_authority_set().clone(),
backend.clone(),
import_setup.1.shared_authority_set().clone(),
));
let (network, system_rpc_tx, network_starter) =
@@ -721,7 +709,10 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
if config.offchain_worker.enabled {
let _ = service::build_offchain_workers(
&config, task_manager.spawn_handle(), client.clone(), network.clone(),
&config,
task_manager.spawn_handle(),
client.clone(),
network.clone(),
);
}
@@ -741,7 +732,8 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
};
let candidate_validation_config = CandidateValidationConfig {
artifacts_cache_path: config.database
artifacts_cache_path: config
.database
.path()
.ok_or(Error::DatabasePathRequired)?
.join("pvf-artifacts"),
@@ -780,27 +772,25 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
let overseer_client = client.clone();
let spawner = task_manager.spawn_handle();
let active_leaves = futures::executor::block_on(
active_leaves(&select_chain, &*client)
)?;
let active_leaves = futures::executor::block_on(active_leaves(&select_chain, &*client))?;
let authority_discovery_service = if role.is_authority() || is_collator.is_collator() {
use sc_network::Event;
use futures::StreamExt;
use sc_network::Event;
let authority_discovery_role = if role.is_authority() {
sc_authority_discovery::Role::PublishAndDiscover(
keystore_container.keystore(),
)
sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore())
} else {
// don't publish our addresses when we're only a collator
sc_authority_discovery::Role::Discover
};
let dht_event_stream = network.event_stream("authority-discovery")
.filter_map(|e| async move { match e {
Event::Dht(e) => Some(e),
_ => None,
}});
let dht_event_stream =
network.event_stream("authority-discovery").filter_map(|e| async move {
match e {
Event::Dht(e) => Some(e),
_ => None,
}
});
let (worker, service) = sc_authority_discovery::new_worker_and_service_with_config(
sc_authority_discovery::WorkerConfig {
publish_non_global_ips: auth_disc_publish_non_global_ips,
@@ -824,58 +814,59 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
tracing::info!("Cannot run as validator without local keystore.");
}
let maybe_params = local_keystore
.and_then(move |k| authority_discovery_service.map(|a| (a, k)));
let maybe_params =
local_keystore.and_then(move |k| authority_discovery_service.map(|a| (a, k)));
let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params {
let (overseer, overseer_handle) = overseer_gen.generate::<
service::SpawnTaskHandle,
FullClient<RuntimeApi, Executor>,
>(
OverseerGenArgs {
leaves: active_leaves,
keystore,
runtime_client: overseer_client.clone(),
parachains_db,
network_service: network.clone(),
authority_discovery_service,
request_multiplexer,
registry: prometheus_registry.as_ref(),
spawner,
is_collator,
approval_voting_config,
availability_config,
candidate_validation_config,
chain_selection_config,
dispute_coordinator_config,
}
)?;
let (overseer, overseer_handle) = overseer_gen
.generate::<service::SpawnTaskHandle, FullClient<RuntimeApi, Executor>>(
OverseerGenArgs {
leaves: active_leaves,
keystore,
runtime_client: overseer_client.clone(),
parachains_db,
network_service: network.clone(),
authority_discovery_service,
request_multiplexer,
registry: prometheus_registry.as_ref(),
spawner,
is_collator,
approval_voting_config,
availability_config,
candidate_validation_config,
chain_selection_config,
dispute_coordinator_config,
},
)?;
let handle = Handle::Connected(overseer_handle.clone());
let handle_clone = handle.clone();
task_manager.spawn_essential_handle().spawn_blocking("overseer", Box::pin(async move {
use futures::{pin_mut, select, FutureExt};
task_manager.spawn_essential_handle().spawn_blocking(
"overseer",
Box::pin(async move {
use futures::{pin_mut, select, FutureExt};
let forward = polkadot_overseer::forward_events(overseer_client, handle_clone);
let forward = polkadot_overseer::forward_events(overseer_client, handle_clone);
let forward = forward.fuse();
let overseer_fut = overseer.run().fuse();
let forward = forward.fuse();
let overseer_fut = overseer.run().fuse();
pin_mut!(overseer_fut);
pin_mut!(forward);
pin_mut!(overseer_fut);
pin_mut!(forward);
select! {
_ = forward => (),
_ = overseer_fut => (),
complete => (),
}
}));
select! {
_ = forward => (),
_ = overseer_fut => (),
complete => (),
}
}),
);
// we should remove this check before we deploy parachains on polkadot
// TODO: https://github.com/paritytech/polkadot/issues/3326
let should_connect_overseer = chain_spec.is_kusama()
|| chain_spec.is_westend()
|| chain_spec.is_rococo()
|| chain_spec.is_wococo();
let should_connect_overseer = chain_spec.is_kusama() ||
chain_spec.is_westend() ||
chain_spec.is_rococo() ||
chain_spec.is_wococo();
if should_connect_overseer {
select_chain.connect_to_overseer(overseer_handle.clone());
@@ -900,7 +891,8 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
);
let client_clone = client.clone();
let overseer_handle = overseer_handle.as_ref().ok_or(Error::AuthoritiesRequireRealOverseer)?.clone();
let overseer_handle =
overseer_handle.as_ref().ok_or(Error::AuthoritiesRequireRealOverseer)?.clone();
let slot_duration = babe_link.config().slot_duration();
let babe_config = babe::BabeParams {
keystore: keystore_container.sync_keystore(),
@@ -951,11 +943,8 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore_opt = if role.is_authority() {
Some(keystore_container.sync_keystore())
} else {
None
};
let keystore_opt =
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
// We currently only run the BEEFY gadget on the Rococo and Wococo testnets.
if !disable_beefy && (chain_spec.is_rococo() || chain_spec.is_wococo()) {
@@ -969,9 +958,7 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
prometheus_registry: prometheus_registry.clone(),
};
let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _>(
beefy_params
);
let gadget = beefy_gadget::start_beefy_gadget::<_, _, _, _>(beefy_params);
// Wococo's purpose is to be a testbed for BEEFY, so if it fails we'll
// bring the node down with it to make sure it is noticed.
@@ -1017,10 +1004,8 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
delay,
);
builder
.add(grandpa_support::PauseAfterBlockFor(block, delay))
.build()
}
builder.add(grandpa_support::PauseAfterBlockFor(block, delay)).build()
},
None => builder.build(),
};
@@ -1034,40 +1019,33 @@ pub fn new_full<RuntimeApi, Executor, OverseerGenerator>(
telemetry: telemetry.as_ref().map(|x| x.handle()),
};
task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter",
grandpa::run_grandpa_voter(grandpa_config)?
);
task_manager
.spawn_essential_handle()
.spawn_blocking("grandpa-voter", grandpa::run_grandpa_voter(grandpa_config)?);
}
network_starter.start_network();
Ok(NewFull {
task_manager,
client,
overseer_handle,
network,
rpc_handlers,
backend,
})
Ok(NewFull { task_manager, client, overseer_handle, network, rpc_handlers, backend })
}
/// Builds a new service for a light client.
#[cfg(feature = "light-node")]
fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
TaskManager,
RpcHandlers,
), Error>
where
Runtime: 'static + Send + Sync + ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>,
<Runtime as ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>>::RuntimeApi:
fn new_light<Runtime, Dispatch>(
mut config: Configuration,
) -> Result<(TaskManager, RpcHandlers), Error>
where
Runtime: 'static + Send + Sync + ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>,
<Runtime as ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>>::RuntimeApi:
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<LightBackend, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Dispatch: NativeExecutionDispatch + 'static,
{
set_prometheus_registry(&mut config)?;
use sc_client_api::backend::RemoteBackend;
let telemetry = config.telemetry_endpoints.clone()
let telemetry = config
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, telemetry::Error> {
let worker = TelemetryWorker::new(16)?;
@@ -1082,11 +1060,10 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
)?;
let mut telemetry = telemetry
.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run());
telemetry
});
let mut telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run());
telemetry
});
config.network.extra_sets.push(grandpa::grandpa_peers_set_config());
@@ -1140,8 +1117,8 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
)?;
let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
backend.clone(),
grandpa_link.shared_authority_set().clone(),
));
let (network, system_rpc_tx, network_starter) =
@@ -1226,44 +1203,43 @@ pub fn new_chain_ops(
sc_consensus::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
TaskManager,
),
Error
>
{
Error,
> {
config.keystore = service::config::KeystoreConfig::InMemory;
#[cfg(feature = "rococo-native")]
if config.chain_spec.is_rococo() || config.chain_spec.is_wococo() {
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<rococo_runtime::RuntimeApi, RococoExecutor>(config, jaeger_agent, None)?;
let service::PartialComponents { client, backend, import_queue, task_manager, .. } =
new_partial::<rococo_runtime::RuntimeApi, RococoExecutor>(config, jaeger_agent, None)?;
return Ok((Arc::new(Client::Rococo(client)), backend, import_queue, task_manager))
}
#[cfg(feature = "kusama-native")]
if config.chain_spec.is_kusama() {
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<kusama_runtime::RuntimeApi, KusamaExecutor>(config, jaeger_agent, None)?;
let service::PartialComponents { client, backend, import_queue, task_manager, .. } =
new_partial::<kusama_runtime::RuntimeApi, KusamaExecutor>(config, jaeger_agent, None)?;
return Ok((Arc::new(Client::Kusama(client)), backend, import_queue, task_manager))
}
#[cfg(feature = "westend-native")]
if config.chain_spec.is_westend() {
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<westend_runtime::RuntimeApi, WestendExecutor>(config, jaeger_agent, None)?;
let service::PartialComponents { client, backend, import_queue, task_manager, .. } =
new_partial::<westend_runtime::RuntimeApi, WestendExecutor>(
config,
jaeger_agent,
None,
)?;
return Ok((Arc::new(Client::Westend(client)), backend, import_queue, task_manager))
}
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(config, jaeger_agent, None)?;
let service::PartialComponents { client, backend, import_queue, task_manager, .. } =
new_partial::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(config, jaeger_agent, None)?;
Ok((Arc::new(Client::Polkadot(client)), backend, import_queue, task_manager))
}
/// Build a new light node.
#[cfg(feature = "light-node")]
pub fn build_light(config: Configuration) -> Result<(
TaskManager,
RpcHandlers,
), Error> {
pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers), Error> {
#[cfg(feature = "rococo-native")]
if config.chain_spec.is_rococo() || config.chain_spec.is_wococo() {
return new_light::<rococo_runtime::RuntimeApi, RococoExecutor>(config)
@@ -1303,7 +1279,8 @@ pub fn build_full(
telemetry_worker_handle,
None,
overseer_gen,
).map(|full| full.with_client(Client::Rococo))
)
.map(|full| full.with_client(Client::Rococo))
}
#[cfg(feature = "kusama-native")]
@@ -1317,7 +1294,8 @@ pub fn build_full(
telemetry_worker_handle,
None,
overseer_gen,
).map(|full| full.with_client(Client::Kusama))
)
.map(|full| full.with_client(Client::Kusama))
}
#[cfg(feature = "westend-native")]
@@ -1331,7 +1309,8 @@ pub fn build_full(
telemetry_worker_handle,
None,
overseer_gen,
).map(|full| full.with_client(Client::Westend))
)
.map(|full| full.with_client(Client::Westend))
}
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor, _>(
@@ -1343,5 +1322,6 @@ pub fn build_full(
telemetry_worker_handle,
None,
overseer_gen,
).map(|full| full.with_client(Client::Polkadot))
)
.map(|full| full.with_client(Client::Polkadot))
}
+71 -98
View File
@@ -14,55 +14,48 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use super::{
Error,
Registry,
IsCollator,
Block,
SpawnNamed,
Hash,
AuthorityDiscoveryApi,
};
use std::sync::Arc;
use super::{AuthorityDiscoveryApi, Block, Error, Hash, IsCollator, Registry, SpawnNamed};
use polkadot_network_bridge::RequestMultiplexer;
use polkadot_node_core_av_store::Config as AvailabilityConfig;
use polkadot_node_core_approval_voting::Config as ApprovalVotingConfig;
use polkadot_node_core_av_store::Config as AvailabilityConfig;
use polkadot_node_core_candidate_validation::Config as CandidateValidationConfig;
use polkadot_node_core_chain_selection::Config as ChainSelectionConfig;
use polkadot_node_core_dispute_coordinator::Config as DisputeCoordinatorConfig;
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandle};
use polkadot_primitives::v1::ParachainHost;
use sc_authority_discovery::Service as AuthorityDiscoveryService;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sc_client_api::AuxStore;
use sc_keystore::LocalKeystore;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_consensus_babe::BabeApi;
use std::sync::Arc;
pub use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
pub use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
pub use polkadot_approval_distribution::ApprovalDistribution as ApprovalDistributionSubsystem;
pub use polkadot_availability_bitfield_distribution::BitfieldDistribution as BitfieldDistributionSubsystem;
pub use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
pub use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
pub use polkadot_availability_recovery::AvailabilityRecoverySubsystem;
pub use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
pub use polkadot_dispute_distribution::DisputeDistributionSubsystem;
pub use polkadot_gossip_support::GossipSupport as GossipSupportSubsystem;
pub use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
pub use polkadot_node_collation_generation::CollationGenerationSubsystem;
pub use polkadot_node_core_approval_voting::ApprovalVotingSubsystem;
pub use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
pub use polkadot_node_core_backing::CandidateBackingSubsystem;
pub use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
pub use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
pub use polkadot_node_core_chain_api::ChainApiSubsystem;
pub use polkadot_node_collation_generation::CollationGenerationSubsystem;
pub use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
pub use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem;
pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem;
pub use polkadot_node_core_dispute_participation::DisputeParticipationSubsystem;
pub use polkadot_node_core_provisioner::ProvisioningSubsystem as ProvisionerSubsystem;
pub use polkadot_node_core_runtime_api::RuntimeApiSubsystem;
pub use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem;
pub use polkadot_availability_recovery::AvailabilityRecoverySubsystem;
pub use polkadot_approval_distribution::ApprovalDistribution as ApprovalDistributionSubsystem;
pub use polkadot_node_core_approval_voting::ApprovalVotingSubsystem;
pub use polkadot_gossip_support::GossipSupport as GossipSupportSubsystem;
pub use polkadot_node_core_dispute_coordinator::DisputeCoordinatorSubsystem;
pub use polkadot_node_core_dispute_participation::DisputeParticipationSubsystem;
pub use polkadot_dispute_distribution::DisputeDistributionSubsystem;
pub use polkadot_node_core_chain_selection::ChainSelectionSubsystem;
/// Arguments passed for overseer construction.
pub struct OverseerGenArgs<'a, Spawner, RuntimeClient> where
pub struct OverseerGenArgs<'a, Spawner, RuntimeClient>
where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin,
@@ -103,8 +96,7 @@ pub struct OverseerGenArgs<'a, Spawner, RuntimeClient> where
///
/// A convenience for usage with malus, to avoid
/// repetitive code across multiple behavior strain implementations.
pub fn create_default_subsystems<'a, Spawner, RuntimeClient>
(
pub fn create_default_subsystems<'a, Spawner, RuntimeClient>(
OverseerGenArgs {
keystore,
runtime_client,
@@ -121,37 +113,40 @@ pub fn create_default_subsystems<'a, Spawner, RuntimeClient>
chain_selection_config,
dispute_coordinator_config,
..
} : OverseerGenArgs<'a, Spawner, RuntimeClient>
}: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<
AllSubsystems<
CandidateValidationSubsystem,
CandidateBackingSubsystem<Spawner>,
StatementDistributionSubsystem,
AvailabilityDistributionSubsystem,
AvailabilityRecoverySubsystem,
BitfieldSigningSubsystem<Spawner>,
BitfieldDistributionSubsystem,
ProvisionerSubsystem<Spawner>,
RuntimeApiSubsystem<RuntimeClient>,
AvailabilityStoreSubsystem,
NetworkBridgeSubsystem<Arc<sc_network::NetworkService<Block, Hash>>, AuthorityDiscoveryService>,
ChainApiSubsystem<RuntimeClient>,
CollationGenerationSubsystem,
CollatorProtocolSubsystem,
ApprovalDistributionSubsystem,
ApprovalVotingSubsystem,
GossipSupportSubsystem,
DisputeCoordinatorSubsystem,
DisputeParticipationSubsystem,
DisputeDistributionSubsystem<AuthorityDiscoveryService>,
ChainSelectionSubsystem,
>,
Error
CandidateValidationSubsystem,
CandidateBackingSubsystem<Spawner>,
StatementDistributionSubsystem,
AvailabilityDistributionSubsystem,
AvailabilityRecoverySubsystem,
BitfieldSigningSubsystem<Spawner>,
BitfieldDistributionSubsystem,
ProvisionerSubsystem<Spawner>,
RuntimeApiSubsystem<RuntimeClient>,
AvailabilityStoreSubsystem,
NetworkBridgeSubsystem<
Arc<sc_network::NetworkService<Block, Hash>>,
AuthorityDiscoveryService,
>,
ChainApiSubsystem<RuntimeClient>,
CollationGenerationSubsystem,
CollatorProtocolSubsystem,
ApprovalDistributionSubsystem,
ApprovalVotingSubsystem,
GossipSupportSubsystem,
DisputeCoordinatorSubsystem,
DisputeParticipationSubsystem,
DisputeDistributionSubsystem<AuthorityDiscoveryService>,
ChainSelectionSubsystem,
>,
Error,
>
where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin
Spawner: 'static + SpawnNamed + Clone + Unpin,
{
use polkadot_node_subsystem_util::metrics::Metrics;
@@ -160,16 +155,13 @@ where
keystore.clone(),
Metrics::register(registry)?,
),
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only(
),
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only(),
availability_store: AvailabilityStoreSubsystem::new(
parachains_db.clone(),
availability_config,
Metrics::register(registry)?,
),
bitfield_distribution: BitfieldDistributionSubsystem::new(
Metrics::register(registry)?,
),
bitfield_distribution: BitfieldDistributionSubsystem::new(Metrics::register(registry)?),
bitfield_signing: BitfieldSigningSubsystem::new(
spawner.clone(),
keystore.clone(),
@@ -184,13 +176,8 @@ where
candidate_validation_config,
Metrics::register(registry)?,
),
chain_api: ChainApiSubsystem::new(
runtime_client.clone(),
Metrics::register(registry)?,
),
collation_generation: CollationGenerationSubsystem::new(
Metrics::register(registry)?,
),
chain_api: ChainApiSubsystem::new(runtime_client.clone(), Metrics::register(registry)?),
collation_generation: CollationGenerationSubsystem::new(Metrics::register(registry)?),
collator_protocol: {
let side = match is_collator {
IsCollator::Yes(collator_pair) => ProtocolSide::Collator(
@@ -204,9 +191,7 @@ where
metrics: Metrics::register(registry)?,
},
};
CollatorProtocolSubsystem::new(
side,
)
CollatorProtocolSubsystem::new(side)
},
network_bridge: NetworkBridgeSubsystem::new(
network_service.clone(),
@@ -215,11 +200,7 @@ where
Box::new(network_service.clone()),
Metrics::register(registry)?,
),
provisioner: ProvisionerSubsystem::new(
spawner.clone(),
(),
Metrics::register(registry)?,
),
provisioner: ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?),
runtime_api: RuntimeApiSubsystem::new(
runtime_client.clone(),
Metrics::register(registry)?,
@@ -229,9 +210,7 @@ where
keystore.clone(),
Metrics::register(registry)?,
),
approval_distribution: ApprovalDistributionSubsystem::new(
Metrics::register(registry)?,
),
approval_distribution: ApprovalDistributionSubsystem::new(Metrics::register(registry)?),
approval_voting: ApprovalVotingSubsystem::with_config(
approval_voting_config,
parachains_db.clone(),
@@ -239,9 +218,7 @@ where
Box::new(network_service.clone()),
Metrics::register(registry)?,
),
gossip_support: GossipSupportSubsystem::new(
keystore.clone(),
),
gossip_support: GossipSupportSubsystem::new(keystore.clone()),
dispute_coordinator: DisputeCoordinatorSubsystem::new(
parachains_db.clone(),
dispute_coordinator_config,
@@ -253,26 +230,26 @@ where
authority_discovery_service.clone(),
Metrics::register(registry)?,
),
chain_selection: ChainSelectionSubsystem::new(
chain_selection_config,
parachains_db,
),
chain_selection: ChainSelectionSubsystem::new(chain_selection_config, parachains_db),
};
Ok(all_subsystems)
}
/// Trait for the `fn` generating the overseer.
///
/// Default behavior is to create an unmodified overseer, as `RealOverseerGen`
/// would do.
pub trait OverseerGen {
/// Overwrite the full generation of the overseer, including the subsystems.
fn generate<'a, Spawner, RuntimeClient>(&self, args: OverseerGenArgs<'a, Spawner, RuntimeClient>) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
fn generate<'a, Spawner, RuntimeClient>(
&self,
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin {
Spawner: 'static + SpawnNamed + Clone + Unpin,
{
let gen = RealOverseerGen;
RealOverseerGen::generate::<Spawner, RuntimeClient>(&gen, args)
}
@@ -285,13 +262,14 @@ pub trait OverseerGen {
pub struct RealOverseerGen;
impl OverseerGen for RealOverseerGen {
fn generate<'a, Spawner, RuntimeClient>(&self,
args : OverseerGenArgs<'a, Spawner, RuntimeClient>
fn generate<'a, Spawner, RuntimeClient>(
&self,
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
where
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,
Spawner: 'static + SpawnNamed + Clone + Unpin
Spawner: 'static + SpawnNamed + Clone + Unpin,
{
let spawner = args.spawner.clone();
let leaves = args.leaves.clone();
@@ -300,12 +278,7 @@ impl OverseerGen for RealOverseerGen {
let all_subsystems = create_default_subsystems::<Spawner, RuntimeClient>(args)?;
Overseer::new(
leaves,
all_subsystems,
registry,
runtime_client,
spawner,
).map_err(|e| e.into())
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner)
.map_err(|e| e.into())
}
}
+16 -26
View File
@@ -14,18 +14,12 @@
//! A `RocksDB` instance for storing parachain data; availability data, and approvals.
#[cfg(feature = "full-node")]
use {
std::io,
std::path::PathBuf,
std::sync::Arc,
kvdb::KeyValueDB,
};
use {kvdb::KeyValueDB, std::io, std::path::PathBuf, std::sync::Arc};
#[cfg(feature = "full-node")]
mod upgrade;
#[cfg(any(test,feature = "full-node"))]
#[cfg(any(test, feature = "full-node"))]
pub(crate) mod columns {
pub mod v0 {
pub const NUM_COLUMNS: u32 = 3;
@@ -40,7 +34,7 @@ pub(crate) mod columns {
}
/// Columns used by different subsystems.
#[cfg(any(test,feature = "full-node"))]
#[cfg(any(test, feature = "full-node"))]
#[derive(Debug, Clone)]
pub struct ColumnsConfig {
/// The column used by the av-store for data.
@@ -56,7 +50,7 @@ pub struct ColumnsConfig {
}
/// The real columns used by the parachains DB.
#[cfg(any(test,feature = "full-node"))]
#[cfg(any(test, feature = "full-node"))]
pub const REAL_COLUMNS: ColumnsConfig = ColumnsConfig {
col_availability_data: columns::COL_AVAILABILITY_DATA,
col_availability_meta: columns::COL_AVAILABILITY_META,
@@ -78,11 +72,7 @@ pub struct CacheSizes {
impl Default for CacheSizes {
fn default() -> Self {
CacheSizes {
availability_data: 25,
availability_meta: 1,
approval_data: 5,
}
CacheSizes { availability_data: 25, availability_meta: 1, approval_data: 5 }
}
}
@@ -93,26 +83,26 @@ pub(crate) fn other_io_error(err: String) -> io::Error {
/// Open the database on disk, creating it if it doesn't exist.
#[cfg(feature = "full-node")]
pub fn open_creating(
root: PathBuf,
cache_sizes: CacheSizes,
) -> io::Result<Arc<dyn KeyValueDB>> {
use kvdb_rocksdb::{DatabaseConfig, Database};
pub fn open_creating(root: PathBuf, cache_sizes: CacheSizes) -> io::Result<Arc<dyn KeyValueDB>> {
use kvdb_rocksdb::{Database, DatabaseConfig};
let path = root.join("parachains").join("db");
let mut db_config = DatabaseConfig::with_columns(columns::NUM_COLUMNS);
let _ = db_config.memory_budget
let _ = db_config
.memory_budget
.insert(columns::COL_AVAILABILITY_DATA, cache_sizes.availability_data);
let _ = db_config.memory_budget
let _ = db_config
.memory_budget
.insert(columns::COL_AVAILABILITY_META, cache_sizes.availability_meta);
let _ = db_config.memory_budget
let _ = db_config
.memory_budget
.insert(columns::COL_APPROVAL_DATA, cache_sizes.approval_data);
let path_str = path.to_str().ok_or_else(|| other_io_error(
format!("Bad database path: {:?}", path),
))?;
let path_str = path
.to_str()
.ok_or_else(|| other_io_error(format!("Bad database path: {:?}", path)))?;
std::fs::create_dir_all(&path_str)?;
upgrade::try_upgrade_db(&path)?;
@@ -13,13 +13,13 @@
//! Migration code for the parachain's DB.
#![cfg(feature = "full-node")]
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{
fs, io,
path::{Path, PathBuf},
str::FromStr,
};
type Version = u32;
@@ -36,10 +36,7 @@ pub enum Error {
#[error("The version file format is incorrect")]
CorruptedVersionFile,
#[error("Future version (expected {current:?}, found {got:?})")]
FutureVersion {
current: Version,
got: Version,
},
FutureVersion { current: Version, got: Version },
}
impl From<Error> for io::Error {
@@ -58,10 +55,7 @@ pub fn try_upgrade_db(db_path: &Path) -> Result<(), Error> {
match current_version(db_path)? {
0 => migrate_from_version_0_to_1(db_path)?,
CURRENT_VERSION => (),
v => return Err(Error::FutureVersion {
current: CURRENT_VERSION,
got: v,
}),
v => return Err(Error::FutureVersion { current: CURRENT_VERSION, got: v }),
}
}
@@ -92,13 +86,13 @@ fn version_file_path(path: &Path) -> PathBuf {
file_path
}
/// Migration from version 0 to version 1:
/// * the number of columns has changed from 3 to 5;
fn migrate_from_version_0_to_1(path: &Path) -> Result<(), Error> {
use kvdb_rocksdb::{Database, DatabaseConfig};
let db_path = path.to_str()
let db_path = path
.to_str()
.ok_or_else(|| super::other_io_error("Invalid database path".into()))?;
let db_cfg = DatabaseConfig::with_columns(super::columns::v0::NUM_COLUMNS);
let db = Database::open(&db_cfg, db_path)?;
@@ -35,16 +35,19 @@
#![cfg(feature = "full-node")]
use polkadot_primitives::v1::{
Hash, BlockNumber, Block as PolkadotBlock, Header as PolkadotHeader,
};
use polkadot_subsystem::messages::{ApprovalVotingMessage, HighestApprovedAncestorBlock, ChainSelectionMessage, DisputeCoordinatorMessage};
use polkadot_node_subsystem_util::metrics::{self, prometheus};
use futures::channel::oneshot;
use consensus_common::{Error as ConsensusError, SelectChain};
use std::sync::Arc;
use polkadot_overseer::{AllMessages, Handle, OverseerHandle};
use super::{HeaderProvider, HeaderProviderProvider};
use consensus_common::{Error as ConsensusError, SelectChain};
use futures::channel::oneshot;
use polkadot_node_subsystem_util::metrics::{self, prometheus};
use polkadot_overseer::{AllMessages, Handle, OverseerHandle};
use polkadot_primitives::v1::{
Block as PolkadotBlock, BlockNumber, Hash, Header as PolkadotHeader,
};
use polkadot_subsystem::messages::{
ApprovalVotingMessage, ChainSelectionMessage, DisputeCoordinatorMessage,
HighestApprovedAncestorBlock,
};
use std::sync::Arc;
/// The maximum amount of unfinalized blocks we are willing to allow due to approval checking
/// or disputes.
@@ -106,37 +109,25 @@ impl Metrics {
}
/// A chain-selection implementation which provides safety for relay chains.
pub struct SelectRelayChainWithFallback<
B: sc_client_api::Backend<PolkadotBlock>,
> {
pub struct SelectRelayChainWithFallback<B: sc_client_api::Backend<PolkadotBlock>> {
// A fallback to use in case the overseer is disconnected.
//
// This is used on relay chains which have not yet enabled
// parachains as well as situations where the node is offline.
fallback: sc_consensus::LongestChain<B, PolkadotBlock>,
selection: SelectRelayChain<
B,
Handle,
>,
selection: SelectRelayChain<B, Handle>,
}
impl<B> Clone for SelectRelayChainWithFallback<B>
where
B: sc_client_api::Backend<PolkadotBlock>,
SelectRelayChain<
B,
Handle,
>: Clone,
SelectRelayChain<B, Handle>: Clone,
{
fn clone(&self) -> Self {
Self {
fallback: self.fallback.clone(),
selection: self.selection.clone(),
}
Self { fallback: self.fallback.clone(), selection: self.selection.clone() }
}
}
impl<B> SelectRelayChainWithFallback<B>
where
B: sc_client_api::Backend<PolkadotBlock> + 'static,
@@ -146,11 +137,7 @@ where
pub fn new(backend: Arc<B>, overseer: Handle, metrics: Metrics) -> Self {
SelectRelayChainWithFallback {
fallback: sc_consensus::LongestChain::new(backend.clone()),
selection: SelectRelayChain::new(
backend,
overseer,
metrics,
),
selection: SelectRelayChain::new(backend, overseer, metrics),
}
}
}
@@ -161,15 +148,11 @@ where
{
/// Given an overseer handle, this connects the [`SelectRelayChainWithFallback`]'s
/// internal handle and its clones to the same overseer.
pub fn connect_to_overseer(
&mut self,
handle: OverseerHandle,
) {
pub fn connect_to_overseer(&mut self, handle: OverseerHandle) {
self.selection.overseer.connect_to_overseer(handle);
}
}
#[async_trait::async_trait]
impl<B> SelectChain<PolkadotBlock> for SelectRelayChainWithFallback<B>
where
@@ -202,7 +185,6 @@ where
}
}
/// A chain-selection implementation which provides safety for relay chains
/// but does not handle situations where the overseer is not yet connected.
pub struct SelectRelayChain<B, OH> {
@@ -219,24 +201,17 @@ where
/// Create a new [`SelectRelayChain`] wrapping the given chain backend
/// and a handle to the overseer.
pub fn new(backend: Arc<B>, overseer: OH, metrics: Metrics) -> Self {
SelectRelayChain {
backend,
overseer,
metrics,
}
SelectRelayChain { backend, overseer, metrics }
}
fn block_header(&self, hash: Hash) -> Result<PolkadotHeader, ConsensusError> {
match HeaderProvider::header(self.backend.header_provider(), hash) {
Ok(Some(header)) => Ok(header),
Ok(None) => Err(ConsensusError::ChainLookup(format!(
"Missing header with hash {:?}",
hash,
))),
Ok(None) =>
Err(ConsensusError::ChainLookup(format!("Missing header with hash {:?}", hash,))),
Err(e) => Err(ConsensusError::ChainLookup(format!(
"Lookup failed for header with hash {:?}: {:?}",
hash,
e,
hash, e,
))),
}
}
@@ -244,14 +219,11 @@ where
fn block_number(&self, hash: Hash) -> Result<BlockNumber, ConsensusError> {
match HeaderProvider::number(self.backend.header_provider(), hash) {
Ok(Some(number)) => Ok(number),
Ok(None) => Err(ConsensusError::ChainLookup(format!(
"Missing number with hash {:?}",
hash,
))),
Ok(None) =>
Err(ConsensusError::ChainLookup(format!("Missing number with hash {:?}", hash,))),
Err(e) => Err(ConsensusError::ChainLookup(format!(
"Lookup failed for number with hash {:?}: {:?}",
hash,
e,
hash, e,
))),
}
}
@@ -281,7 +253,6 @@ enum Error {
EmptyLeaves,
}
/// Decoupling trait for the overseer handle.
///
/// Required for testing purposes.
@@ -297,7 +268,6 @@ impl OverseerHandleT for Handle {
}
}
#[async_trait::async_trait]
impl<B, OH> SelectChain<PolkadotBlock> for SelectRelayChain<B, OH>
where
@@ -311,10 +281,8 @@ where
self.overseer
.clone()
.send_msg(
ChainSelectionMessage::Leaves(tx),
std::any::type_name::<Self>(),
).await;
.send_msg(ChainSelectionMessage::Leaves(tx), std::any::type_name::<Self>())
.await;
rx.await
.map_err(Error::OverseerDisconnected)
@@ -326,13 +294,13 @@ where
// The Chain Selection subsystem is supposed to treat the finalized
// block as the best leaf in the case that there are no viable
// leaves, so this should not happen in practice.
let best_leaf = self.leaves()
let best_leaf = self
.leaves()
.await?
.first()
.ok_or_else(|| ConsensusError::Other(Box::new(Error::EmptyLeaves)))?
.clone();
self.block_header(best_leaf)
}
@@ -354,12 +322,15 @@ where
let subchain_head = {
let (tx, rx) = oneshot::channel();
overseer.send_msg(
ChainSelectionMessage::BestLeafContaining(target_hash, tx),
std::any::type_name::<Self>(),
).await;
overseer
.send_msg(
ChainSelectionMessage::BestLeafContaining(target_hash, tx),
std::any::type_name::<Self>(),
)
.await;
let best = rx.await
let best = rx
.await
.map_err(Error::OverseerDisconnected)
.map_err(|e| ConsensusError::Other(Box::new(e)))?;
@@ -385,7 +356,7 @@ where
"`finality_target` max number is less than target number",
);
}
return Ok(Some(target_hash));
return Ok(Some(target_hash))
}
// find the current number.
let subchain_header = self.block_header(subchain_head)?;
@@ -393,15 +364,17 @@ where
if subchain_header.number <= max {
subchain_head
} else {
let (ancestor_hash, _) = crate::grandpa_support::walk_backwards_to_target_block(
self.backend.header_provider(),
max,
&subchain_header,
).map_err(|e| ConsensusError::ChainLookup(format!("{:?}", e)))?;
let (ancestor_hash, _) =
crate::grandpa_support::walk_backwards_to_target_block(
self.backend.header_provider(),
max,
&subchain_header,
)
.map_err(|e| ConsensusError::ChainLookup(format!("{:?}", e)))?;
ancestor_hash
}
}
},
};
let initial_leaf = subchain_head;
@@ -409,31 +382,30 @@ where
// 2. Constrain according to `ApprovedAncestor`.
let (subchain_head, subchain_number, subchain_block_descriptions) = {
let (tx, rx) = oneshot::channel();
overseer.send_msg(
ApprovalVotingMessage::ApprovedAncestor(
subchain_head,
target_number,
tx,
),
std::any::type_name::<Self>(),
).await;
overseer
.send_msg(
ApprovalVotingMessage::ApprovedAncestor(subchain_head, target_number, tx),
std::any::type_name::<Self>(),
)
.await;
match rx.await
match rx
.await
.map_err(Error::OverseerDisconnected)
.map_err(|e| ConsensusError::Other(Box::new(e)))?
{
// No approved ancestors means target hash is maximal vote.
None => (target_hash, target_number, Vec::new()),
Some(HighestApprovedAncestorBlock {
number, hash, descriptions
}) => (hash, number, descriptions),
Some(HighestApprovedAncestorBlock { number, hash, descriptions }) =>
(hash, number, descriptions),
}
};
// Prevent sending flawed data to the dispute-coordinator.
if Some(subchain_block_descriptions.len() as _) != subchain_number.checked_sub(target_number) {
if Some(subchain_block_descriptions.len() as _) !=
subchain_number.checked_sub(target_number)
{
tracing::error!(
LOG_TARGET,
present_block_descriptions = subchain_block_descriptions.len(),
@@ -441,7 +413,7 @@ where
subchain_number,
"Mismatch of anticipated block descriptions and block number difference.",
);
return Ok(Some(target_hash));
return Ok(Some(target_hash))
}
let lag = initial_leaf_number.saturating_sub(subchain_number);
@@ -449,14 +421,18 @@ where
// 3. Constrain according to disputes:
let (tx, rx) = oneshot::channel();
overseer.send_msg(DisputeCoordinatorMessage::DetermineUndisputedChain{
base_number: target_number,
block_descriptions: subchain_block_descriptions,
tx,
},
std::any::type_name::<Self>(),
).await;
let (subchain_number, subchain_head) = rx.await
overseer
.send_msg(
DisputeCoordinatorMessage::DetermineUndisputedChain {
base_number: target_number,
block_descriptions: subchain_block_descriptions,
tx,
},
std::any::type_name::<Self>(),
)
.await;
let (subchain_number, subchain_head) = rx
.await
.map_err(Error::OverseerDisconnected)
.map_err(|e| ConsensusError::Other(Box::new(e)))?
.unwrap_or_else(|| (subchain_number, subchain_head));
@@ -481,7 +457,8 @@ where
self.backend.header_provider(),
safe_target,
&initial_leaf_header,
).map_err(|e| ConsensusError::ChainLookup(format!("{:?}", e)))?;
)
.map_err(|e| ConsensusError::ChainLookup(format!("{:?}", e)))?;
Ok(Some(forced_target))
}
+93 -50
View File
@@ -14,34 +14,33 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use super::relay_chain_selection::*;
use super::*;
use super::{relay_chain_selection::*, *};
use futures::channel::oneshot::Receiver;
use polkadot_node_primitives::approval::{VRFOutput, VRFProof};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_subsystem::messages::AllMessages;
use polkadot_subsystem::messages::BlockDescription;
use polkadot_subsystem::messages::{AllMessages, BlockDescription};
use polkadot_test_client::Sr25519Keyring;
use sp_consensus_babe::digests::CompatibleDigestItem;
use sp_consensus_babe::digests::{PreDigest, SecondaryVRFPreDigest};
use sp_consensus_babe::Transcript;
use sp_runtime::testing::*;
use sp_runtime::DigestItem;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::iter::IntoIterator;
use sp_consensus_babe::{
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
Transcript,
};
use sp_runtime::{testing::*, DigestItem};
use std::{
collections::{BTreeMap, HashMap, HashSet},
iter::IntoIterator,
};
use assert_matches::assert_matches;
use std::sync::Arc;
use std::time::Duration;
use std::{sync::Arc, time::Duration};
use consensus_common::SelectChain;
use futures::channel::oneshot;
use futures::prelude::*;
use futures::{channel::oneshot, prelude::*};
use polkadot_primitives::v1::{Block, BlockNumber, Hash, Header};
use polkadot_subsystem::messages::{
ApprovalVotingMessage, ChainSelectionMessage, DisputeCoordinatorMessage, HighestApprovedAncestorBlock,
ApprovalVotingMessage, ChainSelectionMessage, DisputeCoordinatorMessage,
HighestApprovedAncestorBlock,
};
use polkadot_node_subsystem_test_helpers::TestSubsystemSender;
@@ -67,8 +66,14 @@ struct TestHarness {
#[derive(Default)]
struct HarnessConfig;
fn test_harness<T: Future<Output = VirtualOverseer>>(case_vars: CaseVars, test: impl FnOnce(TestHarness) -> T) {
let _ = env_logger::builder().is_test(true).filter_level(log::LevelFilter::Trace).try_init();
fn test_harness<T: Future<Output = VirtualOverseer>>(
case_vars: CaseVars,
test: impl FnOnce(TestHarness) -> T,
) {
let _ = env_logger::builder()
.is_test(true)
.filter_level(log::LevelFilter::Trace)
.try_init();
let pool = sp_core::testing::TaskExecutor::new();
let (mut context, virtual_overseer) = test_helpers::make_subsystem_context(pool);
@@ -111,7 +116,10 @@ async fn overseer_recv(overseer: &mut VirtualOverseer) -> AllMessages {
msg
}
async fn overseer_recv_with_timeout(overseer: &mut VirtualOverseer, timeout: Duration) -> Option<AllMessages> {
async fn overseer_recv_with_timeout(
overseer: &mut VirtualOverseer,
timeout: Duration,
) -> Option<AllMessages> {
tracing::trace!("Waiting for message...");
overseer.recv().timeout(timeout).await
}
@@ -165,7 +173,7 @@ impl TestChainStorage {
while let Some(block) = self.blocks_by_hash.get(&block_hash) {
if minimum_block_number >= block.number {
break;
break
}
descriptions.push(BlockDescription {
session: 1 as _, // dummy, not checked
@@ -183,12 +191,12 @@ impl TestChainStorage {
if &leaf != next {
block_hash = *next;
} else {
break;
break
}
}
if highest_approved_ancestor.is_none() {
return None;
return None
}
Some(HighestApprovedAncestorBlock {
@@ -199,9 +207,13 @@ impl TestChainStorage {
}
/// Traverse backwards from leave down to block number.
fn undisputed_chain(&self, base_blocknumber: BlockNumber, highest_approved_block_hash: Hash) -> Option<Hash> {
fn undisputed_chain(
&self,
base_blocknumber: BlockNumber,
highest_approved_block_hash: Hash,
) -> Option<Hash> {
if self.disputed_blocks.is_empty() {
return Some(highest_approved_block_hash);
return Some(highest_approved_block_hash)
}
let mut undisputed_chain = Some(highest_approved_block_hash);
@@ -209,14 +221,14 @@ impl TestChainStorage {
while let Some(block) = self.blocks_by_hash.get(&block_hash) {
block_hash = block.hash();
if ChainBuilder::GENESIS_HASH == block_hash {
return None;
return None
}
let next = block.parent_hash();
if self.disputed_blocks.contains(&block_hash) {
undisputed_chain = Some(*next);
}
if block.number() == &base_blocknumber {
return None;
return None
}
block_hash = *next;
}
@@ -256,14 +268,26 @@ impl ChainBuilder {
pub fn add_block<'a>(&'a mut self, hash: Hash, parent_hash: Hash, number: u32) -> &'a mut Self {
assert!(number != 0, "cannot add duplicate genesis block");
assert!(hash != Self::GENESIS_HASH, "cannot add block with genesis hash");
assert!(parent_hash != Self::GENESIS_PARENT_HASH, "cannot add block with genesis parent hash");
assert!(
parent_hash != Self::GENESIS_PARENT_HASH,
"cannot add block with genesis parent hash"
);
assert!(self.0.blocks_by_hash.len() < u8::MAX.into());
self.add_block_inner(hash, parent_hash, number)
}
fn add_block_inner<'a>(&'a mut self, hash: Hash, parent_hash: Hash, number: u32) -> &'a mut Self {
fn add_block_inner<'a>(
&'a mut self,
hash: Hash,
parent_hash: Hash,
number: u32,
) -> &'a mut Self {
let header = ChainBuilder::make_header(parent_hash, number);
assert!(self.0.blocks_by_hash.insert(hash, header).is_none(), "block with hash {:?} already exists", hash,);
assert!(
self.0.blocks_by_hash.insert(hash, header).is_none(),
"block with hash {:?} already exists",
hash,
);
self.0.blocks_at_height.entry(number).or_insert_with(Vec::new).push(hash);
self
}
@@ -292,7 +316,12 @@ impl ChainBuilder {
block
}
pub fn fast_forward(&mut self, branch_tag: u8, parent: Hash, block_number: BlockNumber) -> Hash {
pub fn fast_forward(
&mut self,
branch_tag: u8,
parent: Hash,
block_number: BlockNumber,
) -> Hash {
let hash = Hash::repeat_byte((block_number as u8 | branch_tag) as u8);
let _ = self.add_block(hash, parent, block_number);
hash
@@ -310,16 +339,24 @@ impl ChainBuilder {
let digest = {
let mut digest = Digest::default();
let (vrf_output, vrf_proof) = garbage_vrf();
digest.push(DigestItem::babe_pre_digest(PreDigest::SecondaryVRF(SecondaryVRFPreDigest {
authority_index: 0,
slot: 1.into(), // slot, unused
vrf_output,
vrf_proof,
})));
digest.push(DigestItem::babe_pre_digest(PreDigest::SecondaryVRF(
SecondaryVRFPreDigest {
authority_index: 0,
slot: 1.into(), // slot, unused
vrf_output,
vrf_proof,
},
)));
digest
};
Header { digest, extrinsics_root: Default::default(), number, state_root: Default::default(), parent_hash }
Header {
digest,
extrinsics_root: Default::default(),
number,
state_root: Default::default(),
parent_hash,
}
}
}
@@ -353,7 +390,7 @@ async fn test_skeleton(
);
if best_chain_containing_block.is_none() {
return;
return
}
tracing::trace!("approved ancestor response: {:?}", undisputed_chain);
@@ -404,22 +441,28 @@ fn run_specialized_test_w_harness<F: FnOnce() -> CaseVars>(case_var_provider: F)
// Verify test integrity: the provided highest approved
// ancestor must match the chain derived one.
let highest_approved_ancestor_w_desc = best_chain_containing_block.and_then(|best_chain_containing_block| {
let min_blocknumber =
chain.blocks_by_hash.get(&best_chain_containing_block).map(|x| x.number).unwrap_or_default();
let highest_approved_ancestor_w_desc =
chain.highest_approved_ancestors(min_blocknumber, best_chain_containing_block);
if let (Some(highest_approved_ancestor_w_desc), Some(highest_approved_ancestor_block)) =
(&highest_approved_ancestor_w_desc, highest_approved_ancestor_block)
{
assert_eq!(
let highest_approved_ancestor_w_desc =
best_chain_containing_block.and_then(|best_chain_containing_block| {
let min_blocknumber = chain
.blocks_by_hash
.get(&best_chain_containing_block)
.map(|x| x.number)
.unwrap_or_default();
let highest_approved_ancestor_w_desc =
chain.highest_approved_ancestors(min_blocknumber, best_chain_containing_block);
if let (
Some(highest_approved_ancestor_w_desc),
Some(highest_approved_ancestor_block),
) = (&highest_approved_ancestor_w_desc, highest_approved_ancestor_block)
{
assert_eq!(
highest_approved_ancestor_block, highest_approved_ancestor_w_desc.hash,
"TestCaseIntegrity: Provided and expected approved ancestor hash mismatch: {:?} vs {:?}",
highest_approved_ancestor_block, highest_approved_ancestor_w_desc.hash,
);
}
highest_approved_ancestor_w_desc
});
}
highest_approved_ancestor_w_desc
});
if let Some(haacwd) = &highest_approved_ancestor_w_desc {
let expected = chain.undisputed_chain(haacwd.number, haacwd.hash);
assert_eq!(