Skip to content

Commit

Permalink
chore: update chainspecs (#4615)
Browse files Browse the repository at this point in the history
* chore: update chainspecs

* chore: fix format

* chore: mark goerli as deprecated

* chore: move genesis funding to sisy/persa

* chore: new protocol ids

---------

Co-authored-by: Daniel <daniel@chainflip.io>
(cherry picked from commit b4a1d71)
  • Loading branch information
tomjohnburton authored and actions-user committed Mar 7, 2024
1 parent 909ffa7 commit c55531f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 61 deletions.
2 changes: 2 additions & 0 deletions state-chain/chains/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ use sp_std::{cmp::min, convert::TryInto, str};
// Reference constants for the chain spec
pub const CHAIN_ID_MAINNET: u64 = 1;
pub const CHAIN_ID_ROPSTEN: u64 = 3;
#[deprecated]
pub const CHAIN_ID_GOERLI: u64 = 5;
pub const CHAIN_ID_SEPOLIA: u64 = 11155111;
pub const CHAIN_ID_KOVAN: u64 = 42;

impl Chain for Ethereum {
Expand Down
77 changes: 27 additions & 50 deletions state-chain/node/src/chain_spec/perseverance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub use super::{
testnet::{BITCOIN_EXPIRY_BLOCKS, ETHEREUM_EXPIRY_BLOCKS, POLKADOT_EXPIRY_BLOCKS},
};
use super::{parse_account, StateChainEnvironment};
use cf_chains::{dot::RuntimeVersion, eth::CHAIN_ID_GOERLI};
use cf_chains::{dot::RuntimeVersion, eth::CHAIN_ID_SEPOLIA};
use cf_primitives::{AccountId, AccountRole, BlockNumber, FlipBalance, NetworkEnvironment};
use sc_service::ChainType;
use sp_core::H256;
Expand All @@ -13,20 +13,22 @@ pub struct Config;
pub const NETWORK_NAME: &str = "Chainflip-Perseverance";
pub const CHAIN_TYPE: ChainType = ChainType::Live;
pub const NETWORK_ENVIRONMENT: NetworkEnvironment = NetworkEnvironment::Testnet;
pub const PROTOCOL_ID: &str = "flip-pers";
pub const PROTOCOL_ID: &str = "flip-pers-2";

pub const GENESIS_FUNDING_AMOUNT: FlipBalance = 1_000 * FLIPPERINOS_PER_FLIP;

pub const ENV: StateChainEnvironment = StateChainEnvironment {
flip_token_address: hex_literal::hex!("0485D65da68b2A6b48C3fA28D7CCAce196798B94"),
eth_usdc_address: hex_literal::hex!("07865c6e87b9f70255377e024ace6630c1eaa37f"),
state_chain_gateway_address: hex_literal::hex!("38AA40B7b5a70d738baBf6699a45DacdDBBEB3fc"),
key_manager_address: hex_literal::hex!("Aa4376388C6432d36CFF33198D9f80295482f120"),
eth_vault_address: hex_literal::hex!("40caFF3f3B6706Da904a7895e0fC7F7922437e9B"),
eth_address_checker_address: hex_literal::hex!("6Ab555596F452Ba302163d1cBFEFfDFCA7423F07"),
ethereum_chain_id: CHAIN_ID_GOERLI,
flip_token_address: hex_literal::hex!("dC27c60956cB065D19F08bb69a707E37b36d8086"),
eth_usdc_address: hex_literal::hex!("5fd84259d66Cd46123540766Be93DFE6D43130D7"),
state_chain_gateway_address: hex_literal::hex!("A34a967197Ee90BB7fb28e928388a573c5CFd099"),
key_manager_address: hex_literal::hex!("4981b1329F29E720642266fc6e172C3f78159dff"),
eth_vault_address: hex_literal::hex!("36eaD71325604DC15d35FAE584D7b50646D81753"),
eth_address_checker_address: hex_literal::hex!("58eaCD5A40EEbCbBCb660f178F9A46B1Ad63F846"),
ethereum_chain_id: CHAIN_ID_SEPOLIA,
eth_init_agg_key: hex_literal::hex!(
"02661d4b647d4b49660976ad402f4890cb8f2f4d872dfa5e1c5f33b1da53f4a637"
"021cf3c105fbc7112f3394c3e176463ec59600f1e7005ad8d68f66840264998667"
),
ethereum_deployment_block: 9595582u64,
ethereum_deployment_block: 5429883u64,
genesis_funding_amount: GENESIS_FUNDING_AMOUNT,
min_funding: MIN_FUNDING,
dot_genesis_hash: H256(hex_literal::hex!(
Expand Down Expand Up @@ -58,49 +60,24 @@ pub const SNOW_WHITE_SR25519: [u8; 32] =
hex_literal::hex!["84f131a66e88e3e5f8dce20d413cab3fbb13769a14a4c7b640b7222863ef353d"];

pub fn extra_accounts() -> Vec<(AccountId, AccountRole, FlipBalance, Option<Vec<u8>>)> {
[
vec![
(
parse_account("cFMTNSQQVfBo2HqtekvhLPfZY764kuJDVFG1EvnnDGYxc3LRW"),
AccountRole::Broker,
1_000 * FLIPPERINOS_PER_FLIP,
Some(b"Chainflip Genesis Broker".to_vec()),
),
(
parse_account("cFN2sr3eDPoyp3G4CAg3EBRMo2VMoYJ7x3rBn51tmXsguYzMX"),
AccountRole::LiquidityProvider,
1_000 * FLIPPERINOS_PER_FLIP,
Some(b"Chainflip Genesis Liquidity Provider".to_vec()),
),
],
phoenix_accounts(),
]
[vec![
(
parse_account("cFMTNSQQVfBo2HqtekvhLPfZY764kuJDVFG1EvnnDGYxc3LRW"),
AccountRole::Broker,
1_000 * FLIPPERINOS_PER_FLIP,
Some(b"Chainflip Genesis Broker".to_vec()),
),
(
parse_account("cFN2sr3eDPoyp3G4CAg3EBRMo2VMoYJ7x3rBn51tmXsguYzMX"),
AccountRole::LiquidityProvider,
1_000 * FLIPPERINOS_PER_FLIP,
Some(b"Chainflip Genesis Liquidity Provider".to_vec()),
),
]]
.into_iter()
.flatten()
.collect()
}

#[ignore = "Only used as a convenience."]
#[test]
fn print_total() {
let s = phoenix_accounts().iter().map(|(_, _, s, _)| *s).sum::<u128>();
println!("{s} / {}", s / FLIPPERINOS_PER_FLIP);
}

// Remember to add some extra funds to the dwarves to ensure they remain in the authority set.
fn phoenix_accounts() -> Vec<(AccountId, AccountRole, FlipBalance, Option<Vec<u8>>)> {
include!("perseverance.snapshot")
.into_iter()
.map(|(addr, name, balance): (&str, &str, u128)| {
(
parse_account(addr),
AccountRole::Validator,
balance,
if name.is_empty() { None } else { Some(name.as_bytes().to_vec()) },
)
})
.collect::<Vec<_>>()
}

pub const BITCOIN_SAFETY_MARGIN: u64 = 5;
pub const ETHEREUM_SAFETY_MARGIN: u64 = 6;
24 changes: 13 additions & 11 deletions state-chain/node/src/chain_spec/sisyphos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub use super::{
common::*,
testnet::{BITCOIN_EXPIRY_BLOCKS, ETHEREUM_EXPIRY_BLOCKS, POLKADOT_EXPIRY_BLOCKS},
};
use cf_chains::{dot::RuntimeVersion, eth::CHAIN_ID_GOERLI};
use cf_chains::{dot::RuntimeVersion, eth::CHAIN_ID_SEPOLIA};
use cf_primitives::{AccountId, AccountRole, BlockNumber, FlipBalance, NetworkEnvironment};
use sc_service::ChainType;
use sp_core::H256;
Expand All @@ -13,20 +13,22 @@ pub struct Config;
pub const NETWORK_NAME: &str = "Chainflip-Sisyphos";
pub const CHAIN_TYPE: ChainType = ChainType::Live;
pub const NETWORK_ENVIRONMENT: NetworkEnvironment = NetworkEnvironment::Testnet;
pub const PROTOCOL_ID: &str = "flip-sisy";
pub const PROTOCOL_ID: &str = "flip-sisy-2";

pub const GENESIS_FUNDING_AMOUNT: FlipBalance = 1_000 * FLIPPERINOS_PER_FLIP;

pub const ENV: StateChainEnvironment = StateChainEnvironment {
flip_token_address: hex_literal::hex!("2BbB561C6eaB74f358cA9e8a961E3A20CAE3D100"),
eth_usdc_address: hex_literal::hex!("07865c6e87b9f70255377e024ace6630c1eaa37f"),
state_chain_gateway_address: hex_literal::hex!("E8bE4B7F8a38C1913387c9C20B94402bc3Db9F70"),
key_manager_address: hex_literal::hex!("Aea44be51d86eA635D51cFB2Fd5EB17Fd2A322BC"),
eth_vault_address: hex_literal::hex!("C17CCec5015081EB2DF26d20A9e02c5484C1d641"),
eth_address_checker_address: hex_literal::hex!("e7f1725E7734CE288F8367e1Bb143E90bb3F0512"),
ethereum_chain_id: CHAIN_ID_GOERLI,
flip_token_address: hex_literal::hex!("cD079EAB6B5443b545788Fd210C8800FEADd87fa"),
eth_usdc_address: hex_literal::hex!("5fd84259d66Cd46123540766Be93DFE6D43130D7"),
state_chain_gateway_address: hex_literal::hex!("1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9"),
key_manager_address: hex_literal::hex!("22f5562e6859924Db082b8B248ea0C974f148a17"),
eth_vault_address: hex_literal::hex!("a94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85"),
eth_address_checker_address: hex_literal::hex!("638e16DD15588B81257eBe9676FA1a0175FDB70a"),
ethereum_chain_id: CHAIN_ID_SEPOLIA,
eth_init_agg_key: hex_literal::hex!(
"025fe47808af34826795b6dc483f95076cbd3779f420ea01d2e12396cdd049e224"
"025e790770ed8e79c08d68fa781b2848651f3e94ef8b1305a7fb6de782798735ad"
),
ethereum_deployment_block: 9572976u64,
ethereum_deployment_block: 5429873u64,
genesis_funding_amount: GENESIS_FUNDING_AMOUNT,
min_funding: MIN_FUNDING,
dot_genesis_hash: H256(hex_literal::hex!(
Expand Down

0 comments on commit c55531f

Please sign in to comment.