Bump Substrate to 286d7ce (#1006)

* Bump dependencies

- Substrate to `74a1bfdcc`
- `finality-grandpa` to `0.14.1`
- `fs-swap` to `0.2.6`

* Add `pallet_randomness_collective_flip` to runtimes

* Rename GenesisConfig fields

See Substrate PR: https://github.com/paritytech/substrate/pull/8990

* Missed PoA renames in Rialto GenesisConfig

* Use `spawn_essential_handle` for transaction pool

See Substrate PR: https://github.com/paritytech/substrate/pull/9074
This commit is contained in:
Hernando Castano
2021-06-17 12:44:04 -04:00
committed by Bastian Köcher
parent c69c682a4c
commit 613803a15d
10 changed files with 49 additions and 45 deletions
+7 -7
View File
@@ -175,27 +175,27 @@ fn testnet_genesis(
_enable_println: bool,
) -> GenesisConfig {
GenesisConfig {
frame_system: SystemConfig {
system: SystemConfig {
code: WASM_BINARY.expect("Millau development WASM not available").to_vec(),
changes_trie_config: Default::default(),
},
pallet_balances: BalancesConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
},
pallet_aura: AuraConfig {
aura: AuraConfig {
authorities: Vec::new(),
},
pallet_grandpa: GrandpaConfig {
grandpa: GrandpaConfig {
authorities: Vec::new(),
},
pallet_sudo: SudoConfig { key: root_key },
pallet_session: SessionConfig {
sudo: SudoConfig { key: root_key },
session: SessionConfig {
keys: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone())))
.collect::<Vec<_>>(),
},
pallet_bridge_grandpa_Instance1: BridgeWestendGrandpaConfig {
bridge_westend_grandpa: BridgeWestendGrandpaConfig {
// for our deployments to avoid multiple same-nonces transactions:
// //Alice is already used to initialize Rialto<->Millau bridge
// => let's use //George to initialize Westend->Millau bridge
+2 -2
View File
@@ -103,7 +103,7 @@ pub fn new_partial(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_handle(),
task_manager.spawn_essential_handle(),
client.clone(),
);
@@ -389,7 +389,7 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(),
config.prometheus_registry(),
task_manager.spawn_handle(),
task_manager.spawn_essential_handle(),
client.clone(),
on_demand.clone(),
));
+3 -1
View File
@@ -205,6 +205,8 @@ impl frame_system::Config for Runtime {
type OnSetCode = ();
}
impl pallet_randomness_collective_flip::Config for Runtime {}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
}
@@ -398,7 +400,7 @@ construct_runtime!(
BridgeRialtoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage},
BridgeWestendGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Config<T>, Storage},
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Aura: pallet_aura::{Pallet, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event},
+11 -11
View File
@@ -16,7 +16,7 @@
use bp_rialto::derive_account_from_millau_id;
use rialto_runtime::{
AccountId, AuraConfig, BalancesConfig, BridgeKovanConfig, BridgeRialtoPoAConfig, GenesisConfig, GrandpaConfig,
AccountId, AuraConfig, BalancesConfig, BridgeKovanConfig, BridgeRialtoPoaConfig, GenesisConfig, GrandpaConfig,
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
};
use serde_json::json;
@@ -176,23 +176,23 @@ fn testnet_genesis(
_enable_println: bool,
) -> GenesisConfig {
GenesisConfig {
frame_system: SystemConfig {
system: SystemConfig {
code: WASM_BINARY.expect("Rialto development WASM not available").to_vec(),
changes_trie_config: Default::default(),
},
pallet_balances: BalancesConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
},
pallet_aura: AuraConfig {
aura: AuraConfig {
authorities: Vec::new(),
},
pallet_bridge_eth_poa_Instance1: load_rialto_poa_bridge_config(),
pallet_bridge_eth_poa_Instance2: load_kovan_bridge_config(),
pallet_grandpa: GrandpaConfig {
bridge_rialto_poa: load_rialto_poa_bridge_config(),
bridge_kovan: load_kovan_bridge_config(),
grandpa: GrandpaConfig {
authorities: Vec::new(),
},
pallet_sudo: SudoConfig { key: root_key },
pallet_session: SessionConfig {
sudo: SudoConfig { key: root_key },
session: SessionConfig {
keys: initial_authorities
.iter()
.map(|x| (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone())))
@@ -201,8 +201,8 @@ fn testnet_genesis(
}
}
fn load_rialto_poa_bridge_config() -> BridgeRialtoPoAConfig {
BridgeRialtoPoAConfig {
fn load_rialto_poa_bridge_config() -> BridgeRialtoPoaConfig {
BridgeRialtoPoaConfig {
initial_header: rialto_runtime::rialto_poa::genesis_header(),
initial_difficulty: 0.into(),
initial_validators: rialto_runtime::rialto_poa::genesis_validators(),
+2 -2
View File
@@ -105,7 +105,7 @@ pub fn new_partial(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_handle(),
task_manager.spawn_essential_handle(),
client.clone(),
);
@@ -393,7 +393,7 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(),
config.prometheus_registry(),
task_manager.spawn_handle(),
task_manager.spawn_essential_handle(),
client.clone(),
on_demand.clone(),
));
+8 -6
View File
@@ -212,6 +212,8 @@ impl frame_system::Config for Runtime {
type OnSetCode = ();
}
impl pallet_randomness_collective_flip::Config for Runtime {}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
}
@@ -500,7 +502,7 @@ construct_runtime!(
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
BridgeRialtoPoA: pallet_bridge_eth_poa::<Instance1>::{Pallet, Call, Config, Storage, ValidateUnsigned},
BridgeRialtoPoa: pallet_bridge_eth_poa::<Instance1>::{Pallet, Call, Config, Storage, ValidateUnsigned},
BridgeKovan: pallet_bridge_eth_poa::<Instance2>::{Pallet, Call, Config, Storage, ValidateUnsigned},
BridgeRialtoCurrencyExchange: pallet_bridge_currency_exchange::<Instance1>::{Pallet, Call},
BridgeKovanCurrencyExchange: pallet_bridge_currency_exchange::<Instance2>::{Pallet, Call},
@@ -508,7 +510,7 @@ construct_runtime!(
BridgeDispatch: pallet_bridge_dispatch::{Pallet, Event<T>},
BridgeMillauMessages: pallet_bridge_messages::{Pallet, Call, Storage, Event<T>},
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Aura: pallet_aura::{Pallet, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event},
@@ -600,21 +602,21 @@ impl_runtime_apis! {
impl bp_eth_poa::RialtoPoAHeaderApi<Block> for Runtime {
fn best_block() -> (u64, bp_eth_poa::H256) {
let best_block = BridgeRialtoPoA::best_block();
let best_block = BridgeRialtoPoa::best_block();
(best_block.number, best_block.hash)
}
fn finalized_block() -> (u64, bp_eth_poa::H256) {
let finalized_block = BridgeRialtoPoA::finalized_block();
let finalized_block = BridgeRialtoPoa::finalized_block();
(finalized_block.number, finalized_block.hash)
}
fn is_import_requires_receipts(header: bp_eth_poa::AuraHeader) -> bool {
BridgeRialtoPoA::is_import_requires_receipts(header)
BridgeRialtoPoa::is_import_requires_receipts(header)
}
fn is_known_block(hash: bp_eth_poa::H256) -> bool {
BridgeRialtoPoA::is_known_block(hash)
BridgeRialtoPoa::is_known_block(hash)
}
}
+1 -1
View File
@@ -130,7 +130,7 @@ impl InclusionProofVerifier for RialtoBlockchain {
fn verify_transaction_inclusion_proof(proof: &Self::TransactionInclusionProof) -> Option<Self::Transaction> {
let is_transaction_finalized =
crate::BridgeRialtoPoA::verify_transaction_finalized(proof.block, proof.index, &proof.proof);
crate::BridgeRialtoPoa::verify_transaction_finalized(proof.block, proof.index, &proof.proof);
if !is_transaction_finalized {
return None;
+9 -9
View File
@@ -531,7 +531,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageVersionSpecMismatch(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageVersionSpecMismatch(
SOURCE_CHAIN_ID,
id,
TEST_SPEC_VERSION,
@@ -558,7 +558,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
SOURCE_CHAIN_ID,
id,
1345000,
@@ -588,7 +588,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageSignatureMismatch(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageSignatureMismatch(
SOURCE_CHAIN_ID,
id
)),
@@ -610,7 +610,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageRejected(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageRejected(
SOURCE_CHAIN_ID,
id
)),
@@ -636,7 +636,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageCallDecodeFailed(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageCallDecodeFailed(
SOURCE_CHAIN_ID,
id
)),
@@ -663,7 +663,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageCallRejected(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageCallRejected(
SOURCE_CHAIN_ID,
id
)),
@@ -686,7 +686,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
SOURCE_CHAIN_ID,
id,
Ok(())
@@ -712,7 +712,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
SOURCE_CHAIN_ID,
id,
Ok(())
@@ -738,7 +738,7 @@ mod tests {
System::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
event: Event::Dispatch(call_dispatch::Event::<TestRuntime>::MessageDispatched(
SOURCE_CHAIN_ID,
id,
Ok(())
+4 -4
View File
@@ -891,7 +891,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::pallet_bridge_messages(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
event: TestEvent::Messages(RawEvent::MessageAccepted(TEST_LANE_ID, 1)),
topics: vec![],
}],
);
@@ -920,7 +920,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::pallet_bridge_messages(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
event: TestEvent::Messages(RawEvent::MessagesDelivered(TEST_LANE_ID, 1, 1)),
topics: vec![],
}],
);
@@ -1021,7 +1021,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::pallet_bridge_messages(RawEvent::ParameterUpdated(parameter)),
event: TestEvent::Messages(RawEvent::ParameterUpdated(parameter)),
topics: vec![],
}],
);
@@ -1045,7 +1045,7 @@ mod tests {
System::<TestRuntime>::events(),
vec![EventRecord {
phase: Phase::Initialization,
event: TestEvent::pallet_bridge_messages(RawEvent::ParameterUpdated(parameter)),
event: TestEvent::Messages(RawEvent::ParameterUpdated(parameter)),
topics: vec![],
}],
);
+2 -2
View File
@@ -60,7 +60,7 @@ impl BridgeInstance for RialtoPoA {
.collect(),
);
rialto_runtime::Call::BridgeRialtoPoA(pallet_call)
rialto_runtime::Call::BridgeRialtoPoa(pallet_call)
}
fn build_unsigned_header_call(&self, header: QueuedEthereumHeader) -> Call {
@@ -69,7 +69,7 @@ impl BridgeInstance for RialtoPoA {
into_substrate_ethereum_receipts(header.extra()),
);
rialto_runtime::Call::BridgeRialtoPoA(pallet_call)
rialto_runtime::Call::BridgeRialtoPoa(pallet_call)
}
fn build_currency_exchange_call(&self, proof: Proof) -> Call {