Allow Substrate Pallet to be Initialized via Dipatchable (#481)

* Add dispatchable for intializing pallet

* Add Polkadot JS types for Substrate bridge pallet

* Ensure Root is the only one that can initialize the pallet

* Add some tests

* Pack initialization data into struct

* Only allow pallet to be initialized once

* Use new initialization config in nodes

* Rename ScheduledChange in Ethereum pallet

We're renaming it to prevent clashes with Substrate bridge pallet type
of the same name. This is relevant when importing types to Polkadot JS
Apps.

* Move all Polkadot JS types into one file

* Appease Clippy
This commit is contained in:
Hernando Castano
2020-11-05 14:19:20 -05:00
committed by Bastian Köcher
parent d4fc7bebdc
commit cac8319480
8 changed files with 193 additions and 76 deletions
+4 -10
View File
@@ -155,7 +155,10 @@ fn testnet_genesis(
pallet_grandpa: Some(GrandpaConfig {
authorities: Vec::new(),
}),
pallet_substrate_bridge: load_rialto_bridge_config(),
pallet_substrate_bridge: Some(BridgeRialtoConfig {
// We'll initialize the pallet with a dispatchable instead.
init_data: None,
}),
pallet_sudo: Some(SudoConfig { key: root_key }),
pallet_session: Some(SessionConfig {
keys: initial_authorities
@@ -165,12 +168,3 @@ fn testnet_genesis(
}),
}
}
fn load_rialto_bridge_config() -> Option<BridgeRialtoConfig> {
Some(BridgeRialtoConfig {
initial_header: Some(millau_runtime::rialto::initial_header()),
initial_authority_list: millau_runtime::rialto::initial_authority_set().authorities,
initial_set_id: millau_runtime::rialto::initial_authority_set().set_id,
first_scheduled_change: None,
})
}