Cross-Chain Transfer Generator (#535)

* Attempt at adding Cross-Chain Transfer Generator

* Add Transfer subcommand for sending messages to Rialto

* Add temp helper script for sending messages

* Remove Message and Lane Ids from Dispatch Event

* Increase transfer amount used by script

* Endow derived Dave account on Rialto with funds

* Update Message generator to send more types of messages

This commit first of all updates the script to use the new CLI
commands for sending messages. Second, it adds messages which are
sent from both Target and Source origins.

* Generate messages from Root origin

* Remove dbg! logs from relayer

* Log AccountId as well as HexId

* Remove Balances logs

* Add InstanceId and MessageId back to Dispatch Event

* Add InstanceId and MessageId types for Apps

* Add missing comment

* Document derived accounts as tests

* Move shared commands to variables

* Add example usage for send_message script

* Add docs to message variants

* Fix Clippy complaint
This commit is contained in:
Hernando Castano
2020-12-09 07:30:52 -05:00
committed by Bastian Köcher
parent 6f6c8c2417
commit 0ff8c2437c
6 changed files with 112 additions and 27 deletions
+1
View File
@@ -17,6 +17,7 @@ structopt = "0.3.21"
bp-message-lane = { path = "../../../primitives/message-lane" }
bp-runtime = { path = "../../../primitives/runtime" }
bp-rialto = { path = "../../../primitives/rialto" }
pallet-message-lane-rpc = { path = "../../../modules/message-lane/rpc" }
rialto-runtime = { path = "../runtime" }
+24
View File
@@ -14,6 +14,7 @@
// 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/>.
use bp_rialto::derive_account_from_millau_id;
use rialto_runtime::{
AccountId, AuraConfig, BalancesConfig, BridgeKovanConfig, BridgeMillauConfig, BridgeRialtoPoAConfig, GenesisConfig,
GrandpaConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
@@ -121,6 +122,10 @@ impl Alternative {
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
get_account_id_from_seed::<sr25519::Public>("George//stash"),
get_account_id_from_seed::<sr25519::Public>("Harry//stash"),
derive_account_from_millau_id(bp_runtime::SourceAccount::Root),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Dave"),
)),
],
true,
)
@@ -191,3 +196,22 @@ fn load_kovan_bridge_config() -> BridgeKovanConfig {
initial_validators: rialto_runtime::kovan::genesis_validators(),
}
}
#[test]
fn derived_dave_account_is_as_expected() {
let dave = get_account_id_from_seed::<sr25519::Public>("Dave");
let derived: AccountId = derive_account_from_millau_id(bp_runtime::SourceAccount::Account(dave));
assert_eq!(
derived.to_string(),
"5Hg7WQyk8C1FmPzxY3xSjR7S6zZZC5sAL35vMr6NpW17jBhQ".to_string()
);
}
#[test]
fn derived_root_account_is_as_expected() {
let root: AccountId = derive_account_from_millau_id(bp_runtime::SourceAccount::Root);
assert_eq!(
root.to_string(),
"5HYYwXQvxhgdcBYs6kzqfK1HW6M3UF3Kh4YM7j288yiqbhnt".to_string()
);
}