From 35d6755596038bbc62bc30e6a2d4f6cd6f8e704c Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Mon, 16 Nov 2020 14:18:49 -0500 Subject: [PATCH] Fixes for Millau-Rialto Deployment (#493) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Expose two nodes publicly through brucke.link * Use flags for GNU `sed` instead of BSD `sed` * Update Substrate relay entrypoint scripts to initialize bridge * Add Rialto to Millau relay to Compose deployment * Stop initializing Rialto chain through chainspec * Include logging for Substrate pallet * Make Rialto to Millau entrypoint executable * Use YAML references for relay components * Use published Substrate Relay image * Relay messages from Millau to Rialto * Use Bob nodes to serve message lane * Fix some port number issues for PoA-Rialto deployment * Stop directly referencing `environment` anchor in nodes * Add probable cause to relayer error message * Edit monitoring config file in-place * Add some sleep time between bridge init call and starting relays * Expose grafana. * Use Root key as bridge pallet owner In our case that's going to be Alice since she's Root for our Dev and Local chains. Co-authored-by: Tomasz Drwięga --- bridges/bin/millau/node/src/chain_spec.rs | 2 +- bridges/bin/rialto/node/src/chain_spec.rs | 13 +++++-------- bridges/relays/substrate/src/headers_target.rs | 10 +++++----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/bridges/bin/millau/node/src/chain_spec.rs b/bridges/bin/millau/node/src/chain_spec.rs index 541d240b6a1a..957ee4750c4a 100644 --- a/bridges/bin/millau/node/src/chain_spec.rs +++ b/bridges/bin/millau/node/src/chain_spec.rs @@ -158,7 +158,7 @@ fn testnet_genesis( pallet_substrate_bridge: Some(BridgeRialtoConfig { // We'll initialize the pallet with a dispatchable instead. init_data: None, - owner: None, + owner: Some(root_key.clone()), }), pallet_sudo: Some(SudoConfig { key: root_key }), pallet_session: Some(SessionConfig { diff --git a/bridges/bin/rialto/node/src/chain_spec.rs b/bridges/bin/rialto/node/src/chain_spec.rs index 8dd57e2d6e86..50f141465ba1 100644 --- a/bridges/bin/rialto/node/src/chain_spec.rs +++ b/bridges/bin/rialto/node/src/chain_spec.rs @@ -157,7 +157,11 @@ fn testnet_genesis( pallet_grandpa: Some(GrandpaConfig { authorities: Vec::new(), }), - pallet_substrate_bridge: load_millau_bridge_config(), + pallet_substrate_bridge: Some(BridgeMillauConfig { + // We'll initialize the pallet with a dispatchable instead. + init_data: None, + owner: Some(root_key.clone()), + }), pallet_sudo: Some(SudoConfig { key: root_key }), pallet_session: Some(SessionConfig { keys: initial_authorities @@ -183,10 +187,3 @@ fn load_kovan_bridge_config() -> Option { initial_validators: rialto_runtime::kovan::genesis_validators(), }) } - -fn load_millau_bridge_config() -> Option { - Some(BridgeMillauConfig { - init_data: None, - owner: Some([0; 32].into()), - }) -} diff --git a/bridges/relays/substrate/src/headers_target.rs b/bridges/relays/substrate/src/headers_target.rs index 6f23706d171c..6fb4a1500af6 100644 --- a/bridges/relays/substrate/src/headers_target.rs +++ b/bridges/relays/substrate/src/headers_target.rs @@ -91,11 +91,11 @@ where let decoded_response: Vec<(P::Number, P::Hash)> = Decode::decode(&mut &encoded_response.0[..]).map_err(SubstrateError::ResponseParseFailed)?; - let best_header = decoded_response.last().ok_or_else(|| { - SubstrateError::ResponseParseFailed( - "Parsed an empty list of headers, we should always have at least one.".into(), - ) - })?; + const WARNING_MSG: &str = "Parsed an empty list of headers, we should always have at least + one. Has the bridge pallet been initialized yet?"; + let best_header = decoded_response + .last() + .ok_or_else(|| SubstrateError::ResponseParseFailed(WARNING_MSG.into()))?; let best_header_id = HeaderId(best_header.0, best_header.1); Ok(best_header_id) }