Rialto to Millau Transfer Generator (#568)

* Add option to relay for sending transfers to Millau chain

* Endow derived accounts on Millau chain

* Update message generator entrypoint script to send transfers

* Use correct command when sending messages

* Send Root messages from Root origin on source chain

* Wrap calls from Root Origin in Sudo Call

* Allow Root to send messages without paying fees

* Use correct variable when sending messages to Rialto

* Print warning if no message type is provided to script.

* Add note mentioning that certain source origins aren't supported yet

* Use correct runtime when initializing header sync

* Remove option to send messages as Root

* Remove endowment of derived Root accounts

* Fix indentation.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
Hernando Castano
2020-12-16 06:24:35 -05:00
committed by Bastian Köcher
parent ee655b1057
commit f26775d690
8 changed files with 80 additions and 44 deletions
+14
View File
@@ -29,6 +29,7 @@ use frame_support::{
RuntimeDebug,
};
use sp_core::Hasher as HasherT;
use sp_runtime::traits::Convert;
use sp_runtime::{
traits::{IdentifyAccount, Verify},
MultiSignature, MultiSigner, Perbill,
@@ -161,6 +162,19 @@ impl sp_runtime::traits::Convert<sp_core::H256, AccountId> for AccountIdConverte
}
}
/// We use this to get the account on Millau (target) which is derived from Rialto's (source)
/// account. We do this so we can fund the derived account on Millau at Genesis to it can pay
/// transaction fees.
///
/// The reason we can use the same `AccountId` type for both chains is because they share the same
/// development seed phrase.
///
/// Note that this should only be used for testing.
pub fn derive_account_from_rialto_id(id: bp_runtime::SourceAccount<AccountId>) -> AccountId {
let encoded_id = bp_runtime::derive_account_id(bp_runtime::RIALTO_BRIDGE_INSTANCE, id);
AccountIdConverter::convert(encoded_id)
}
/// Get a struct which defines the weight limits and values used during extrinsic execution.
pub fn runtime_block_weights() -> frame_system::limits::BlockWeights {
frame_system::limits::BlockWeights::builder()