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
+28 -9
View File
@@ -101,12 +101,15 @@ pub enum Command {
/// Hex-encoded lane id.
#[structopt(long)]
lane: HexLaneId,
/// Message type.
#[structopt(long, possible_values = &ToRialtoMessage::variants())]
message: ToRialtoMessage,
/// Delivery and dispatch fee.
#[structopt(long)]
fee: bp_millau::Balance,
/// Message type.
#[structopt(subcommand)]
message: ToRialtoMessage,
/// The origin to use when dispatching the message on the target chain.
#[structopt(long, possible_values = &Origins::variants())]
origin: Origins,
},
/// Serve given lane of Rialto -> Millau messages.
RialtoMessagesToMillau {
@@ -144,12 +147,18 @@ pub enum Command {
},
}
arg_enum! {
#[derive(Debug)]
/// All possible messages that may be delivered to the Rialto chain.
pub enum ToRialtoMessage {
Remark,
}
/// All possible messages that may be delivered to the Rialto chain.
#[derive(StructOpt, Debug)]
pub enum ToRialtoMessage {
/// Make an on-chain remark (comment).
Remark,
/// Transfer the specified `amount` of native tokens to a particular `recipient`.
Transfer {
#[structopt(long)]
recipient: bp_rialto::AccountId,
#[structopt(long)]
amount: bp_rialto::Balance,
},
}
arg_enum! {
@@ -160,6 +169,16 @@ arg_enum! {
}
}
arg_enum! {
#[derive(Debug)]
/// The origin to use when dispatching the message on the target chain.
pub enum Origins {
Root,
Target,
Source,
}
}
/// Lane id.
#[derive(Debug)]
pub struct HexLaneId(LaneId);