Add GenesisConfig for Millau and Rialto Runtimes (#401)

* Add Rialto as a target for the Millau node

* Rename Rialto module to Rialto-PoA

This will reduce confusion as the Millau runtime has a
Rialto module as well which refers to the Substrate chain.

* Add Millau as a target for the Rialto node

* Be more explicit about Rialto PoA related code

* Missed some name changes in the Ethereum PoA relay

* Re-export Substrate pallet structs used by node

* Remove `first_scheduled_change` of Millau in Rialto node

* Make Millau's genesis config for Rialto bridge more accurate

* Set initial header for Millau config

* Update initial Millau authorities

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>

* RustFmt Millau authorities

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
This commit is contained in:
Hernando Castano
2020-10-09 02:09:06 -04:00
committed by Bastian Köcher
parent 9e9ac8df3c
commit f52c839d6e
13 changed files with 210 additions and 35 deletions
+87
View File
@@ -0,0 +1,87 @@
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Configuration parameters for the Millau Substrate chain.
use bp_rialto::Header;
use hex_literal::hex;
use pallet_substrate_bridge::AuthoritySet;
use sp_core::crypto::Public;
use sp_finality_grandpa::AuthorityId;
use sp_std::vec;
/// The first header known to the pallet.
///
/// Note that this does not need to be the genesis header of the Millau
/// chain since the pallet may start at any arbitrary header.
// To get this we first need to call the `chain_getBlockHash` RPC method, and then
// we can use the result from that and call the `chain_getBlock` RPC method to get
// the rest of the info.
//
// In this case we've grabbed the genesis block of the Millau Substrate chain.
pub fn initial_header() -> Header {
Header {
parent_hash: Default::default(),
number: Default::default(),
state_root: hex!("bb65e8ba99408ebfefea9d28f74403d41da6858fa075c51fcc71dc383455c530").into(),
extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(),
digest: Default::default(),
}
}
/// The first set of Grandpa authorities known to the pallet.
///
/// Note that this doesn't have to be the "genesis" authority set, as the
/// pallet can be configured to start from any height.
pub fn initial_authority_set() -> AuthoritySet {
let set_id = 0;
// These authorities are: Alice, Bob, Charlie, Dave, and Eve.
let authorities = vec![
(
AuthorityId::from_slice(&hex!(
"88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee"
)),
1,
),
(
AuthorityId::from_slice(&hex!(
"d17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae69"
)),
1,
),
(
AuthorityId::from_slice(&hex!(
"439660b36c6c03afafca027b910b4fecf99801834c62a5e6006f27d978de234f"
)),
1,
),
(
AuthorityId::from_slice(&hex!(
"5e639b43e0052c47447dac87d6fd2b6ec50bdd4d0f614e4299c665249bbd09d9"
)),
1,
),
(
AuthorityId::from_slice(&hex!(
"1dfe3e22cc0d45c70779c1095f7489a8ef3cf52d62fbd8c2fa38c9f1723502b5"
)),
1,
),
];
AuthoritySet::new(authorities, set_id)
}