diff --git a/substrate/node/src/chain_spec.rs b/substrate/node/src/chain_spec.rs index 32c32d035..0e5c0a77c 100644 --- a/substrate/node/src/chain_spec.rs +++ b/substrate/node/src/chain_spec.rs @@ -55,8 +55,15 @@ fn testnet_genesis( }, validator_sets: ValidatorSetsConfig { - stake: Amount(1_000_000 * 10_u64.pow(8)), - networks: serai_runtime::primitives::NETWORKS.to_vec(), + networks: serai_runtime::primitives::NETWORKS + .iter() + .map(|network| match network { + NetworkId::Serai => (NetworkId::Serai, Amount(100_000 * 10_u64.pow(8))), + NetworkId::Bitcoin => (NetworkId::Bitcoin, Amount(1_000_000 * 10_u64.pow(8))), + NetworkId::Ethereum => (NetworkId::Bitcoin, Amount(1_000_000 * 10_u64.pow(8))), + NetworkId::Monero => (NetworkId::Bitcoin, Amount(100_000 * 10_u64.pow(8))), + }) + .collect(), participants: validators.iter().map(|name| account_from_name(name)).collect(), }, session: SessionConfig { keys: validators.iter().map(|name| session_key(*name)).collect() }, diff --git a/substrate/validator-sets/pallet/src/lib.rs b/substrate/validator-sets/pallet/src/lib.rs index fa20632f8..2927e1a7b 100644 --- a/substrate/validator-sets/pallet/src/lib.rs +++ b/substrate/validator-sets/pallet/src/lib.rs @@ -29,13 +29,12 @@ pub mod pallet { #[derive(Clone, PartialEq, Eq, Debug, Encode, Decode)] pub struct GenesisConfig { /// Stake requirement to join the initial validator sets. + + /// Networks to spawn Serai with, and the stake requirement per key share. /// /// Every participant at genesis will automatically be assumed to have this much stake. /// This stake cannot be withdrawn however as there's no actual stake behind it. - // TODO: Localize stake to network - pub stake: Amount, - /// Networks to spawn Serai with. - pub networks: Vec, + pub networks: Vec<(NetworkId, Amount)>, /// List of participants to place in the initial validator sets. pub participants: Vec, } @@ -43,7 +42,6 @@ pub mod pallet { impl Default for GenesisConfig { fn default() -> Self { GenesisConfig { - stake: Amount(1), networks: Default::default(), participants: Default::default(), } @@ -327,10 +325,10 @@ pub mod pallet { } } - for id in self.networks.clone() { - AllocationPerKeyShare::::set(id, Some(self.stake)); + for (id, stake) in self.networks.clone() { + AllocationPerKeyShare::::set(id, Some(stake)); for participant in self.participants.clone() { - Pallet::::set_allocation(id, participant, self.stake); + Pallet::::set_allocation(id, participant, stake); } Pallet::::new_set(id); }