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
+1 -4
View File
@@ -186,9 +186,6 @@ fn load_kovan_bridge_config() -> Option<BridgeKovanConfig> {
fn load_millau_bridge_config() -> Option<BridgeMillauConfig> {
Some(BridgeMillauConfig {
initial_header: Some(rialto_runtime::millau::initial_header()),
initial_authority_list: rialto_runtime::millau::initial_authority_set().authorities,
initial_set_id: rialto_runtime::millau::initial_authority_set().set_id,
first_scheduled_change: None,
init_data: Some(rialto_runtime::millau::init_data()),
})
}
+13 -1
View File
@@ -18,11 +18,23 @@
use bp_rialto::Header;
use hex_literal::hex;
use pallet_substrate_bridge::AuthoritySet;
use pallet_substrate_bridge::{AuthoritySet, InitializationData};
use sp_core::crypto::Public;
use sp_finality_grandpa::AuthorityId;
use sp_std::vec;
/// Information about where the bridge palelt should start syncing from. This includes things like
/// the initial header and the initial authorities of the briged chain.
pub fn init_data() -> InitializationData<Header> {
let authority_set = initial_authority_set();
InitializationData {
header: initial_header(),
authority_list: authority_set.authorities,
set_id: authority_set.set_id,
scheduled_change: None,
}
}
/// The first header known to the pallet.
///
/// Note that this does not need to be the genesis header of the Millau