Change account names to something meaningful (#1497)

* change testnets account "names" to something meaningful

* fixes

* fix doc

* fmt

* account names as consts

* fmt

* spelling
This commit is contained in:
Svyatoslav Nikolsky
2022-07-08 21:04:39 +03:00
committed by Bastian Köcher
parent 00f1225b19
commit d327b25724
4 changed files with 146 additions and 151 deletions
+58 -69
View File
@@ -15,7 +15,6 @@
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>. // along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use beefy_primitives::crypto::AuthorityId as BeefyId; use beefy_primitives::crypto::AuthorityId as BeefyId;
use bp_millau::derive_account_from_rialto_id;
use millau_runtime::{ use millau_runtime::{
AccountId, AuraConfig, BalancesConfig, BeefyConfig, BridgeRialtoMessagesConfig, AccountId, AuraConfig, BalancesConfig, BeefyConfig, BridgeRialtoMessagesConfig,
BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GenesisConfig, GrandpaConfig, BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GenesisConfig, GrandpaConfig,
@@ -26,6 +25,21 @@ use sp_core::{sr25519, Pair, Public};
use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_finality_grandpa::AuthorityId as GrandpaId;
use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_runtime::traits::{IdentifyAccount, Verify};
/// "Names" of the authorities accounts at local testnet.
const LOCAL_AUTHORITIES_ACCOUNTS: [&str; 5] = ["Alice", "Bob", "Charlie", "Dave", "Eve"];
/// "Names" of the authorities accounts at development testnet.
const DEV_AUTHORITIES_ACCOUNTS: [&str; 1] = [LOCAL_AUTHORITIES_ACCOUNTS[0]];
/// "Names" of all possible authorities accounts.
const ALL_AUTHORITIES_ACCOUNTS: [&str; 5] = LOCAL_AUTHORITIES_ACCOUNTS;
/// "Name" of the `sudo` account.
const SUDO_ACCOUNT: &str = "Sudo";
/// "Name" of the account, which owns the with-Westend GRANDPA pallet.
const WESTEND_GRANDPA_PALLET_OWNER: &str = "Westend.GrandpaOwner";
/// "Name" of the account, which owns the with-Rialto messages pallet.
const RIALTO_MESSAGES_PALLET_OWNER: &str = "Rialto.MessagesOwner";
/// "Name" of the account, which owns the with-RialtoParachain messages pallet.
const RIALTO_PARACHAIN_MESSAGES_PALLET_OWNER: &str = "RialtoParachain.MessagesOwner";
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>; pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
@@ -86,8 +100,11 @@ impl Alternative {
sc_service::ChainType::Development, sc_service::ChainType::Development,
|| { || {
testnet_genesis( testnet_genesis(
vec![get_authority_keys_from_seed("Alice")], DEV_AUTHORITIES_ACCOUNTS
get_account_id_from_seed::<sr25519::Public>("Alice"), .into_iter()
.map(get_authority_keys_from_seed)
.collect(),
get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
endowed_accounts(), endowed_accounts(),
true, true,
) )
@@ -105,14 +122,11 @@ impl Alternative {
sc_service::ChainType::Local, sc_service::ChainType::Local,
|| { || {
testnet_genesis( testnet_genesis(
vec![ LOCAL_AUTHORITIES_ACCOUNTS
get_authority_keys_from_seed("Alice"), .into_iter()
get_authority_keys_from_seed("Bob"), .map(get_authority_keys_from_seed)
get_authority_keys_from_seed("Charlie"), .collect(),
get_authority_keys_from_seed("Dave"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
get_authority_keys_from_seed("Eve"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
endowed_accounts(), endowed_accounts(),
true, true,
) )
@@ -133,56 +147,39 @@ impl Alternative {
/// accounts used by relayers in our test deployments, accounts used for demonstration /// accounts used by relayers in our test deployments, accounts used for demonstration
/// purposes), are all available on these chains. /// purposes), are all available on these chains.
fn endowed_accounts() -> Vec<AccountId> { fn endowed_accounts() -> Vec<AccountId> {
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
[
get_account_id_from_seed::<sr25519::Public>(x),
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
]
});
vec![ vec![
get_account_id_from_seed::<sr25519::Public>("Alice"), // Sudo account
get_account_id_from_seed::<sr25519::Public>("Bob"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
get_account_id_from_seed::<sr25519::Public>("Charlie"), // Regular (unused) accounts
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"), get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("George"),
get_account_id_from_seed::<sr25519::Public>("Harry"),
get_account_id_from_seed::<sr25519::Public>("Iden"),
get_account_id_from_seed::<sr25519::Public>("Ken"),
get_account_id_from_seed::<sr25519::Public>("Leon"),
get_account_id_from_seed::<sr25519::Public>("Mary"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
get_account_id_from_seed::<sr25519::Public>("George//stash"), // Accounts, used by Westend<>Millau bridge
get_account_id_from_seed::<sr25519::Public>("Harry//stash"), get_account_id_from_seed::<sr25519::Public>(WESTEND_GRANDPA_PALLET_OWNER),
get_account_id_from_seed::<sr25519::Public>("Iden//stash"), get_account_id_from_seed::<sr25519::Public>("Westend.HeadersRelay1"),
get_account_id_from_seed::<sr25519::Public>("Ken//stash"), get_account_id_from_seed::<sr25519::Public>("Westend.HeadersRelay2"),
get_account_id_from_seed::<sr25519::Public>("Leon//stash"), get_account_id_from_seed::<sr25519::Public>("Westend.WestmintHeaders1"),
get_account_id_from_seed::<sr25519::Public>("Mary//stash"), get_account_id_from_seed::<sr25519::Public>("Westend.WestmintHeaders2"),
get_account_id_from_seed::<sr25519::Public>("RialtoMessagesOwner"), // Accounts, used by Rialto<>Millau bridge
get_account_id_from_seed::<sr25519::Public>("RialtoParachainMessagesOwner"), get_account_id_from_seed::<sr25519::Public>(RIALTO_MESSAGES_PALLET_OWNER),
pallet_bridge_messages::relayer_fund_account_id::< get_account_id_from_seed::<sr25519::Public>("Rialto.HeadersAndMessagesRelay"),
bp_millau::AccountId, get_account_id_from_seed::<sr25519::Public>("Rialto.OutboundMessagesRelay.Lane00000001"),
bp_millau::AccountIdConverter, get_account_id_from_seed::<sr25519::Public>("Rialto.InboundMessagesRelay.Lane00000001"),
>(), get_account_id_from_seed::<sr25519::Public>("Rialto.MessagesSender"),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account( // Accounts, used by RialtoParachain<>Millau bridge
get_account_id_from_seed::<sr25519::Public>("Alice"), get_account_id_from_seed::<sr25519::Public>(RIALTO_PARACHAIN_MESSAGES_PALLET_OWNER),
)), get_account_id_from_seed::<sr25519::Public>("RialtoParachain.HeadersAndMessagesRelay"),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account( get_account_id_from_seed::<sr25519::Public>("RialtoParachain.RialtoHeadersRelay"),
get_account_id_from_seed::<sr25519::Public>("Bob"), get_account_id_from_seed::<sr25519::Public>("RialtoParachain.MessagesSender"),
)),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Charlie"),
)),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Dave"),
)),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Eve"),
)),
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
)),
] ]
.into_iter()
.chain(all_authorities)
.collect()
} }
fn session_keys(aura: AuraId, beefy: BeefyId, grandpa: GrandpaId) -> SessionKeys { fn session_keys(aura: AuraId, beefy: BeefyId, grandpa: GrandpaId) -> SessionKeys {
@@ -217,28 +214,20 @@ fn testnet_genesis(
bridge_westend_grandpa: BridgeWestendGrandpaConfig { bridge_westend_grandpa: BridgeWestendGrandpaConfig {
// for our deployments to avoid multiple same-nonces transactions: // for our deployments to avoid multiple same-nonces transactions:
// //Alice is already used to initialize Rialto<->Millau bridge // //Alice is already used to initialize Rialto<->Millau bridge
// => let's use //George to initialize Westend->Millau bridge // => let's use //Westend.GrandpaOwner to initialize Westend->Millau bridge
owner: Some(get_account_id_from_seed::<sr25519::Public>("George")), owner: Some(get_account_id_from_seed::<sr25519::Public>(WESTEND_GRANDPA_PALLET_OWNER)),
..Default::default() ..Default::default()
}, },
bridge_rialto_messages: BridgeRialtoMessagesConfig { bridge_rialto_messages: BridgeRialtoMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>("RialtoMessagesOwner")), owner: Some(get_account_id_from_seed::<sr25519::Public>(RIALTO_MESSAGES_PALLET_OWNER)),
..Default::default() ..Default::default()
}, },
bridge_rialto_parachain_messages: BridgeRialtoParachainMessagesConfig { bridge_rialto_parachain_messages: BridgeRialtoParachainMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>( owner: Some(get_account_id_from_seed::<sr25519::Public>(
"RialtoParachainMessagesOwner", RIALTO_PARACHAIN_MESSAGES_PALLET_OWNER,
)), )),
..Default::default() ..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
} }
} }
#[test]
fn derived_dave_account_is_as_expected() {
let dave = get_account_id_from_seed::<sr25519::Public>("Dave");
let derived: AccountId =
derive_account_from_rialto_id(bp_runtime::SourceAccount::Account(dave));
assert_eq!(derived.to_string(), "5DNW6UVnb7TN6wX5KwXtDYR3Eccecbdzuw89HqjyNfkzce6J".to_string());
}
@@ -22,6 +22,17 @@ use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair, Public}; use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_runtime::traits::{IdentifyAccount, Verify};
/// "Names" of the authorities accounts at local testnet.
const LOCAL_AUTHORITIES_ACCOUNTS: [&str; 2] = ["Alice", "Bob"];
/// "Names" of the authorities accounts at development testnet.
const DEV_AUTHORITIES_ACCOUNTS: [&str; 2] = LOCAL_AUTHORITIES_ACCOUNTS;
/// "Names" of all possible authorities accounts.
const ALL_AUTHORITIES_ACCOUNTS: [&str; 2] = LOCAL_AUTHORITIES_ACCOUNTS;
/// "Name" of the `sudo` account.
const SUDO_ACCOUNT: &str = "Sudo";
/// "Name" of the account, which owns the with-Millau messages pallet.
const MILLAU_MESSAGES_PALLET_OWNER: &str = "Millau.MessagesOwner";
/// Specialized `ChainSpec` for the normal parachain runtime. /// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = pub type ChainSpec =
sc_service::GenericChainSpec<rialto_parachain_runtime::GenesisConfig, Extensions>; sc_service::GenericChainSpec<rialto_parachain_runtime::GenesisConfig, Extensions>;
@@ -67,27 +78,32 @@ where
/// accounts used by relayers in our test deployments, accounts used for demonstration /// accounts used by relayers in our test deployments, accounts used for demonstration
/// purposes), are all available on these chains. /// purposes), are all available on these chains.
fn endowed_accounts() -> Vec<AccountId> { fn endowed_accounts() -> Vec<AccountId> {
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
[
get_account_id_from_seed::<sr25519::Public>(x),
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
]
});
vec![ vec![
get_account_id_from_seed::<sr25519::Public>("Alice"), // Sudo account
get_account_id_from_seed::<sr25519::Public>("Bob"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
// Regular (unused) accounts
get_account_id_from_seed::<sr25519::Public>("Charlie"), get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"), get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"), get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"), get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("George"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"), get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"), get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"), get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
get_account_id_from_seed::<sr25519::Public>("George//stash"), // Accounts, used by RialtoParachain<>Millau bridge
get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner"), get_account_id_from_seed::<sr25519::Public>(MILLAU_MESSAGES_PALLET_OWNER),
pallet_bridge_messages::relayer_fund_account_id::< get_account_id_from_seed::<sr25519::Public>("Millau.HeadersAndMessagesRelay"),
bp_rialto_parachain::AccountId, get_account_id_from_seed::<sr25519::Public>("Millau.MessagesSender"),
bp_rialto_parachain::AccountIdConverter,
>(),
] ]
.into_iter()
.chain(all_authorities)
.collect()
} }
pub fn development_config(id: ParaId) -> ChainSpec { pub fn development_config(id: ParaId) -> ChainSpec {
@@ -104,8 +120,11 @@ pub fn development_config(id: ParaId) -> ChainSpec {
ChainType::Local, ChainType::Local,
move || { move || {
testnet_genesis( testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
vec![get_from_seed::<AuraId>("Alice"), get_from_seed::<AuraId>("Bob")], DEV_AUTHORITIES_ACCOUNTS
.into_iter()
.map(|x| get_from_seed::<AuraId>(x))
.collect(),
endowed_accounts(), endowed_accounts(),
id, id,
) )
@@ -136,8 +155,11 @@ pub fn local_testnet_config(id: ParaId) -> ChainSpec {
ChainType::Local, ChainType::Local,
move || { move || {
testnet_genesis( testnet_genesis(
get_account_id_from_seed::<sr25519::Public>("Alice"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
vec![get_from_seed::<AuraId>("Alice"), get_from_seed::<AuraId>("Bob")], LOCAL_AUTHORITIES_ACCOUNTS
.into_iter()
.map(|x| get_from_seed::<AuraId>(x))
.collect(),
endowed_accounts(), endowed_accounts(),
id, id,
) )
@@ -174,7 +196,7 @@ fn testnet_genesis(
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities }, aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
aura_ext: Default::default(), aura_ext: Default::default(),
bridge_millau_messages: BridgeMillauMessagesConfig { bridge_millau_messages: BridgeMillauMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner")), owner: Some(get_account_id_from_seed::<sr25519::Public>(MILLAU_MESSAGES_PALLET_OWNER)),
..Default::default() ..Default::default()
}, },
} }
+40 -58
View File
@@ -15,7 +15,6 @@
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>. // along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use beefy_primitives::crypto::AuthorityId as BeefyId; use beefy_primitives::crypto::AuthorityId as BeefyId;
use bp_rialto::derive_account_from_millau_id;
use polkadot_primitives::v2::{AssignmentId, ValidatorId}; use polkadot_primitives::v2::{AssignmentId, ValidatorId};
use rialto_runtime::{ use rialto_runtime::{
AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig, AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig,
@@ -29,6 +28,17 @@ use sp_core::{sr25519, Pair, Public};
use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_finality_grandpa::AuthorityId as GrandpaId;
use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_runtime::traits::{IdentifyAccount, Verify};
/// "Names" of the authorities accounts at local testnet.
const LOCAL_AUTHORITIES_ACCOUNTS: [&str; 5] = ["Alice", "Bob", "Charlie", "Dave", "Eve"];
/// "Names" of the authorities accounts at development testnet.
const DEV_AUTHORITIES_ACCOUNTS: [&str; 1] = [LOCAL_AUTHORITIES_ACCOUNTS[0]];
/// "Names" of all possible authorities accounts.
const ALL_AUTHORITIES_ACCOUNTS: [&str; 5] = LOCAL_AUTHORITIES_ACCOUNTS;
/// "Name" of the `sudo` account.
const SUDO_ACCOUNT: &str = "Sudo";
/// "Name" of the account, which owns the with-Millau messages pallet.
const MILLAU_MESSAGES_PALLET_OWNER: &str = "Millau.MessagesOwner";
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = pub type ChainSpec =
sc_service::GenericChainSpec<GenesisConfig, polkadot_service::chain_spec::Extensions>; sc_service::GenericChainSpec<GenesisConfig, polkadot_service::chain_spec::Extensions>;
@@ -95,8 +105,11 @@ impl Alternative {
sc_service::ChainType::Development, sc_service::ChainType::Development,
|| { || {
testnet_genesis( testnet_genesis(
vec![get_authority_keys_from_seed("Alice")], DEV_AUTHORITIES_ACCOUNTS
get_account_id_from_seed::<sr25519::Public>("Alice"), .into_iter()
.map(get_authority_keys_from_seed)
.collect(),
get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
endowed_accounts(), endowed_accounts(),
true, true,
) )
@@ -114,14 +127,11 @@ impl Alternative {
sc_service::ChainType::Local, sc_service::ChainType::Local,
|| { || {
testnet_genesis( testnet_genesis(
vec![ LOCAL_AUTHORITIES_ACCOUNTS
get_authority_keys_from_seed("Alice"), .into_iter()
get_authority_keys_from_seed("Bob"), .map(get_authority_keys_from_seed)
get_authority_keys_from_seed("Charlie"), .collect(),
get_authority_keys_from_seed("Dave"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
get_authority_keys_from_seed("Eve"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
endowed_accounts(), endowed_accounts(),
true, true,
) )
@@ -142,48 +152,28 @@ impl Alternative {
/// accounts used by relayers in our test deployments, accounts used for demonstration /// accounts used by relayers in our test deployments, accounts used for demonstration
/// purposes), are all available on these chains. /// purposes), are all available on these chains.
fn endowed_accounts() -> Vec<AccountId> { fn endowed_accounts() -> Vec<AccountId> {
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
[
get_account_id_from_seed::<sr25519::Public>(x),
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
]
});
vec![ vec![
get_account_id_from_seed::<sr25519::Public>("Alice"), // Sudo account
get_account_id_from_seed::<sr25519::Public>("Bob"), get_account_id_from_seed::<sr25519::Public>(SUDO_ACCOUNT),
get_account_id_from_seed::<sr25519::Public>("Charlie"), // Regular (unused) accounts
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"), get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("George"),
get_account_id_from_seed::<sr25519::Public>("Harry"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"), get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
get_account_id_from_seed::<sr25519::Public>("George//stash"), // Accounts, used by Rialto<>Millau bridge
get_account_id_from_seed::<sr25519::Public>("Harry//stash"), get_account_id_from_seed::<sr25519::Public>(MILLAU_MESSAGES_PALLET_OWNER),
get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner"), get_account_id_from_seed::<sr25519::Public>("Millau.HeadersAndMessagesRelay"),
get_account_id_from_seed::<sr25519::Public>("WithMillauTokenSwap"), get_account_id_from_seed::<sr25519::Public>("Millau.OutboundMessagesRelay.Lane00000001"),
pallet_bridge_messages::relayer_fund_account_id::< get_account_id_from_seed::<sr25519::Public>("Millau.InboundMessagesRelay.Lane00000001"),
bp_rialto::AccountId, get_account_id_from_seed::<sr25519::Public>("Millau.MessagesSender"),
bp_rialto::AccountIdConverter,
>(),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Alice"),
)),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Bob"),
)),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Charlie"),
)),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Dave"),
)),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Eve"),
)),
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
)),
] ]
.into_iter()
.chain(all_authorities)
.collect()
} }
fn session_keys( fn session_keys(
@@ -287,17 +277,9 @@ fn testnet_genesis(
}, },
paras: Default::default(), paras: Default::default(),
bridge_millau_messages: BridgeMillauMessagesConfig { bridge_millau_messages: BridgeMillauMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>("MillauMessagesOwner")), owner: Some(get_account_id_from_seed::<sr25519::Public>(MILLAU_MESSAGES_PALLET_OWNER)),
..Default::default() ..Default::default()
}, },
xcm_pallet: Default::default(), xcm_pallet: Default::default(),
} }
} }
#[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(), "5HZhdv53gSJmWWtD8XR5Ypu4PgbT5JNWwGw2mkE75cN61w9t".to_string());
}
@@ -754,7 +754,7 @@ mod tests {
"--millau-signer", "--millau-signer",
"//Charlie", "//Charlie",
"--millau-messages-pallet-owner", "--millau-messages-pallet-owner",
"//RialtoMessagesOwner", "//Rialto.MessagesOwner",
"--millau-transactions-mortality", "--millau-transactions-mortality",
"64", "64",
"--rialto-host", "--rialto-host",
@@ -764,7 +764,7 @@ mod tests {
"--rialto-signer", "--rialto-signer",
"//Charlie", "//Charlie",
"--rialto-messages-pallet-owner", "--rialto-messages-pallet-owner",
"//MillauMessagesOwner", "//Millau.MessagesOwner",
"--rialto-transactions-mortality", "--rialto-transactions-mortality",
"64", "64",
"--lane", "--lane",
@@ -811,7 +811,7 @@ mod tests {
millau_transactions_mortality: Some(64), millau_transactions_mortality: Some(64),
}, },
left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams { left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams {
millau_messages_pallet_owner: Some("//RialtoMessagesOwner".into()), millau_messages_pallet_owner: Some("//Rialto.MessagesOwner".into()),
millau_messages_pallet_owner_password: None, millau_messages_pallet_owner_password: None,
}, },
left_headers_to_right_sign_override: MillauHeadersToRialtoSigningParams { left_headers_to_right_sign_override: MillauHeadersToRialtoSigningParams {
@@ -839,7 +839,7 @@ mod tests {
rialto_transactions_mortality: Some(64), rialto_transactions_mortality: Some(64),
}, },
right_messages_pallet_owner: RialtoMessagesPalletOwnerSigningParams { right_messages_pallet_owner: RialtoMessagesPalletOwnerSigningParams {
rialto_messages_pallet_owner: Some("//MillauMessagesOwner".into()), rialto_messages_pallet_owner: Some("//Millau.MessagesOwner".into()),
rialto_messages_pallet_owner_password: None, rialto_messages_pallet_owner_password: None,
}, },
right_headers_to_left_sign_override: RialtoHeadersToMillauSigningParams { right_headers_to_left_sign_override: RialtoHeadersToMillauSigningParams {
@@ -868,7 +868,7 @@ mod tests {
"--rialto-headers-to-millau-signer", "--rialto-headers-to-millau-signer",
"//Ken", "//Ken",
"--millau-messages-pallet-owner", "--millau-messages-pallet-owner",
"//RialtoParachainMessagesOwner", "//RialtoParachain.MessagesOwner",
"--millau-transactions-mortality", "--millau-transactions-mortality",
"64", "64",
"--rialto-parachain-host", "--rialto-parachain-host",
@@ -878,7 +878,7 @@ mod tests {
"--rialto-parachain-signer", "--rialto-parachain-signer",
"//George", "//George",
"--rialto-parachain-messages-pallet-owner", "--rialto-parachain-messages-pallet-owner",
"//MillauMessagesOwner", "//Millau.MessagesOwner",
"--rialto-parachain-transactions-mortality", "--rialto-parachain-transactions-mortality",
"64", "64",
"--rialto-host", "--rialto-host",
@@ -925,7 +925,9 @@ mod tests {
millau_transactions_mortality: Some(64), millau_transactions_mortality: Some(64),
}, },
left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams { left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams {
millau_messages_pallet_owner: Some("//RialtoParachainMessagesOwner".into()), millau_messages_pallet_owner: Some(
"//RialtoParachain.MessagesOwner".into()
),
millau_messages_pallet_owner_password: None, millau_messages_pallet_owner_password: None,
}, },
left_headers_to_right_sign_override: left_headers_to_right_sign_override:
@@ -955,7 +957,7 @@ mod tests {
}, },
right_messages_pallet_owner: RialtoParachainMessagesPalletOwnerSigningParams { right_messages_pallet_owner: RialtoParachainMessagesPalletOwnerSigningParams {
rialto_parachain_messages_pallet_owner: Some( rialto_parachain_messages_pallet_owner: Some(
"//MillauMessagesOwner".into() "//Millau.MessagesOwner".into()
), ),
rialto_parachain_messages_pallet_owner_password: None, rialto_parachain_messages_pallet_owner_password: None,
}, },