From 3eec1a738511eaf9071dc61421f34b498286048b Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 07:14:48 +0100 Subject: [PATCH 01/12] runtime parameters modifications --- rollup/runtime/src/lib.rs | 2 +- rollup/runtime/src/runtime_config.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rollup/runtime/src/lib.rs b/rollup/runtime/src/lib.rs index 2bd24b52d..4a88c08bc 100644 --- a/rollup/runtime/src/lib.rs +++ b/rollup/runtime/src/lib.rs @@ -813,7 +813,7 @@ impl pallet_sequencer_staking::Config for Runtime { type MinimumSequencers = frame_support::traits::ConstU32<2>; type RolldownProvider = Rolldown; type NoOfPastSessionsForEligibility = frame_support::traits::ConstU32<10>; - type MaxSequencers = frame_support::traits::ConstU32<10>; + type MaxSequencers = frame_support::traits::ConstU32<3>; type BlocksForSequencerUpdate = frame_support::traits::ConstU32<10>; type CancellerRewardPercentage = cfg::pallet_sequencer_staking::CancellerRewardPercentage; type ChainId = pallet_rolldown::messages::Chain; diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index a8af6e423..913fdbd02 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -62,7 +62,7 @@ pub mod tokens { pub const RxTokenId: TokenId = RX_TOKEN_ID; pub const EthTokenId: TokenId = ETH_TOKEN_ID; pub ArbitrageBotAddr: AccountId = sp_runtime::AccountId20::from( - hex_literal::hex!["fc741134c82b81b7ab7efbf334b0c90ff8dbf22c"] + hex_literal::hex!["0286Ffa54213778E064179E9B6F083ecb584E862"] ); } } @@ -1331,9 +1331,9 @@ pub mod config { impl Convert<::pallet_rolldown::messages::Chain, Balance> for WithdrawFee { fn convert(chain: ::pallet_rolldown::messages::Chain) -> Balance { match chain { - ::pallet_rolldown::messages::Chain::Ethereum => 50 * currency::DOLLARS, - ::pallet_rolldown::messages::Chain::Arbitrum => 50 * currency::DOLLARS, - ::pallet_rolldown::messages::Chain::Base => 50 * currency::DOLLARS, + ::pallet_rolldown::messages::Chain::Ethereum => 5 * currency::DOLLARS, + ::pallet_rolldown::messages::Chain::Arbitrum => 5 * currency::DOLLARS, + ::pallet_rolldown::messages::Chain::Base => 5 * currency::DOLLARS, } } } From 9740c9e6fda5c53fac676ccf72267f2f2a7c15d1 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 07:16:26 +0100 Subject: [PATCH 02/12] duplicate existing config --- rollup/node/src/chain_spec.rs | 185 ++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index bddf9da53..74ea0c5a8 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -241,6 +241,191 @@ pub fn rollup_local_config( ) } +pub fn alpha_config( + randomize_chain_genesis_salt: bool, + chain_genesis_salt: Option, + eth_sequencers: Vec, + arb_sequencers: Vec, + base_sequencers: Vec, + evm_chain: EvmChain, + decode_url: Option, +) -> ChainSpec { + let (gasp_token_address, eth_chain_id) = match evm_chain { + EvmChain::Holesky => ( + array_bytes::hex2array("0x5620cDb94BaAaD10c20483bd8705DA711b2Bc0a3") + .expect("is correct address"), + 17000u64, + ), + EvmChain::Anvil => ( + array_bytes::hex2array("0xc351628EB244ec633d5f21fBD6621e1a683B1181") + .expect("is correct address"), + 31337u64, + ), + EvmChain::Reth => ( + array_bytes::hex2array("0xc351628EB244ec633d5f21fBD6621e1a683B1181") + .expect("is correct address"), + 1337u64, + ), + }; + + let mut chain_genesis_salt_arr: [u8; 32] = [0u8; 32]; + if randomize_chain_genesis_salt { + thread_rng().fill(&mut chain_genesis_salt_arr[..]); + } else if let Some(salt) = chain_genesis_salt { + chain_genesis_salt_arr = array_bytes::hex2bytes(salt) + .expect("chain_genesis_salt should be hex") + .iter() + .chain(sp_std::iter::repeat(&0u8)) + .take(32) + .cloned() + .collect::>() + .try_into() + .expect("32 bytes"); + } + + // Give your base currency a unit name and decimal places + let mut properties = sc_chain_spec::Properties::new(); + properties.insert("tokenSymbol".into(), "GASP".into()); + properties.insert("tokenDecimals".into(), 18u32.into()); + properties.insert("ss58Format".into(), 42u32.into()); + properties.insert("isEthereum".into(), true.into()); + // This is quite useless here :/ + properties.insert( + "chainGenesisSalt".into(), + array_bytes::bytes2hex("0x", chain_genesis_salt_arr).into(), + ); + + let decode_url = decode_url.unwrap_or(String::from( + "https://polkadot.js.org/apps/?rpc=ws%253A%252F%252F127.0.0.1%253A9944#/extrinsics/decode/", + )); + // todo builder + ChainSpec::from_genesis( + // Name + "Rollup Local", + // ID + "rollup_local", + ChainType::Local, + move || { + let eth = eth_sequencers.clone(); + let arb = arb_sequencers.clone(); + let base = base_sequencers.clone(); + + let tokens_endowment = [ + eth_sequencers.clone(), + arb_sequencers.clone(), + base_sequencers.clone(), + vec![ + get_account_id_from_seed::("Alith"), + get_account_id_from_seed::("Baltathar"), + get_account_id_from_seed::("Charleth"), + ], + ] + .iter() + .flatten() + .cloned() + .map(|account_id| (0u32, 300_000_000__000_000_000_000_000_000u128, account_id)) + .collect::>(); + + rollup_genesis( + // chain genesis salt + H256::from(chain_genesis_salt_arr), + // initial collators. + vec![ + ( + get_account_id_from_seed::("Alith"), + authority_keys_from_seed("Alith"), + ), + ( + get_account_id_from_seed::("Baltathar"), + authority_keys_from_seed("Baltathar"), + ), + ], + // Sudo account + get_account_id_from_seed::("Alith"), + // Tokens endowment + tokens_endowment, + // Config for Staking + // Make sure it works with initial-authorities as staking uses both + ( + vec![ + ( + // Who gets to stake initially + get_account_id_from_seed::("Alith"), + // Id of MGA token, + 0u32, + // How much mangata they stake + 100_000_000__000_000_000_000_000_000_u128, + ), + ( + // Who gets to stake initially + get_account_id_from_seed::("Baltathar"), + // Id of MGA token, + 0u32, + // How much mangata they stake + 80_000_000__000_000_000_000_000_000_u128, + ), + ], + vec![ + // Who gets to stake initially + // Id of MGA token, + // How much mangata they pool + // Id of the dummy token, + // How many dummy tokens they pool, + // Id of the liquidity token that is generated + // How many liquidity tokens they stake, + ], + ), + vec![ + ( + RX_TOKEN_ID, + AssetMetadataOf { + decimals: 18, + name: BoundedVec::truncate_from(b"Gasp".to_vec()), + symbol: BoundedVec::truncate_from(b"GASP".to_vec()), + additional: Default::default(), + existential_deposit: Default::default(), + }, + Some(L1Asset::Ethereum(gasp_token_address)), + ), + ( + 1, + AssetMetadataOf { + decimals: 18, + name: BoundedVec::truncate_from(b"Gasp Ethereum".to_vec()), + symbol: BoundedVec::truncate_from(b"GETH".to_vec()), + additional: Default::default(), + existential_deposit: Default::default(), + }, + Some(L1Asset::Ethereum( + array_bytes::hex2array("0x0000000000000000000000000000000000000001") + .unwrap(), + )), + ), + ], + eth, + arb, + base, + eth_chain_id, + decode_url.clone(), + ) + }, + // Bootnodes + Vec::new(), + // Telemetry + None, + // Protocol ID + None, + // ForkId + None, + // Properties + Some(properties), + // Extensions + None, + // code + rollup_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"), + ) +} + /// Configure initial storage state for FRAME modules. fn rollup_genesis( chain_genesis_salt: H256, From 0dea7d9aab0ffd98e729d2899211e0948f60aa79 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 12:08:19 +0100 Subject: [PATCH 03/12] ethereum-mainnet chainspec --- rollup/node/src/chain_spec.rs | 216 ++++++++++++++++----------- rollup/node/src/command.rs | 2 + rollup/runtime/src/runtime_config.rs | 6 +- 3 files changed, 130 insertions(+), 94 deletions(-) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index 74ea0c5a8..a877901fd 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -1,9 +1,10 @@ use crate::command::{EvmChain, InitialSequencersSet}; +use frame_benchmarking::benchmarking::current_time; use rand::{thread_rng, Rng}; use rollup_runtime::{ - config::orml_asset_registry::AssetMetadataOf, tokens::RX_TOKEN_ID, AccountId, AuraConfig, - CustomMetadata, GrandpaConfig, L1Asset, RuntimeGenesisConfig, Signature, SudoConfig, - SystemConfig, XcmMetadata, WASM_BINARY, + config::orml_asset_registry::AssetMetadataOf, currency, tokens::RX_TOKEN_ID, AccountId, + AuraConfig, CustomMetadata, GrandpaConfig, L1Asset, RuntimeGenesisConfig, Signature, + SudoConfig, SystemConfig, XcmMetadata, WASM_BINARY, }; use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; @@ -138,7 +139,7 @@ pub fn rollup_local_config( .iter() .flatten() .cloned() - .map(|account_id| (0u32, 300_000_000__000_000_000_000_000_000u128, account_id)) + .map(|account_id| (0u32, 100u128 * currency::DOLLARS, account_id)) .collect::>(); rollup_genesis( @@ -241,47 +242,36 @@ pub fn rollup_local_config( ) } -pub fn alpha_config( - randomize_chain_genesis_salt: bool, - chain_genesis_salt: Option, - eth_sequencers: Vec, - arb_sequencers: Vec, - base_sequencers: Vec, - evm_chain: EvmChain, - decode_url: Option, -) -> ChainSpec { - let (gasp_token_address, eth_chain_id) = match evm_chain { - EvmChain::Holesky => ( - array_bytes::hex2array("0x5620cDb94BaAaD10c20483bd8705DA711b2Bc0a3") - .expect("is correct address"), - 17000u64, - ), - EvmChain::Anvil => ( - array_bytes::hex2array("0xc351628EB244ec633d5f21fBD6621e1a683B1181") - .expect("is correct address"), - 31337u64, - ), - EvmChain::Reth => ( - array_bytes::hex2array("0xc351628EB244ec633d5f21fBD6621e1a683B1181") - .expect("is correct address"), - 1337u64, - ), - }; +pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { + let (gasp_token_address, eth_chain_id) = ([0u8; 20], 1u64); + let mut chain_genesis_salt_arr: [u8; 32] = + hex_literal::hex!("0011001100110011001100110011001100110011001100110011001100110011"); - let mut chain_genesis_salt_arr: [u8; 32] = [0u8; 32]; - if randomize_chain_genesis_salt { - thread_rng().fill(&mut chain_genesis_salt_arr[..]); - } else if let Some(salt) = chain_genesis_salt { - chain_genesis_salt_arr = array_bytes::hex2bytes(salt) - .expect("chain_genesis_salt should be hex") - .iter() - .chain(sp_std::iter::repeat(&0u8)) - .take(32) - .cloned() - .collect::>() - .try_into() - .expect("32 bytes"); - } + let collator01 = hex_literal::hex!("b9fcA08B9cA327a1dE90FDB4d51aa5ae6Ffe512a"); + let collator01_sr25519 = + hex_literal::hex!("b6bcce45d0431d7cf3b23cf270e60fab48290cc2e129a62bcac04f6eab20e61f"); + let collator01_ed25519 = + hex_literal::hex!("efc45e2afccbe0f53cab042438aebb6bcfc78585625c2a1b5517f3b258dd1cf8"); + + let collator02 = hex_literal::hex!("1f4E3f24d1ad7fE108c6eB3BA6F83ebe8cF0eD20"); + let collator02_sr25519 = + hex_literal::hex!("860a476d36782b7e2854ab4e93287e67618a835741b84bd7cad0740a83275f3c"); + let collator02_ed25519 = + hex_literal::hex!("2227445cd1b97943e1ba5c3cf3a94cadabd4494ff4394667be13ff755bae1abe"); + + let collator03 = hex_literal::hex!("7F7c7b782fBdAd01Fe33ca8FC647c867ee29deD2"); + let collator03_sr25519 = + hex_literal::hex!("4899a218a591b9345b92de354b4d251eabd205bc64c787386fdccfe1f2147625"); + let collator03_ed25519 = + hex_literal::hex!("d59387884193c920e0cef94770d74cc2cef0d534b1ebf5a5d1eb5033fb58746a"); + + let collator04 = hex_literal::hex!("4691A9BB90e20a7708182fD881fb723f9845460E"); + let collator04_sr25519 = + hex_literal::hex!("b0c2a16a1acecd3e05a243d9bf8881f5d64a70b40864701dba01cfd1ee53c85a"); + let collator04_ed25519 = + hex_literal::hex!("172165647a152929e2bb0af97f55ea0c0deaa087479be8eab7448c2dc8cd0dfe"); + + let sudo = hex_literal::hex!("E73e1Bb7B07f6bf447ED71252A5ad08C7ebE5bE5"); // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); @@ -295,36 +285,40 @@ pub fn alpha_config( array_bytes::bytes2hex("0x", chain_genesis_salt_arr).into(), ); - let decode_url = decode_url.unwrap_or(String::from( - "https://polkadot.js.org/apps/?rpc=ws%253A%252F%252F127.0.0.1%253A9944#/extrinsics/decode/", - )); + let decode_url = decode_url.expect("polkadot url is provided"); // todo builder ChainSpec::from_genesis( // Name - "Rollup Local", + "Mainnet", // ID - "rollup_local", - ChainType::Local, + "mainnet", + ChainType::Live, move || { - let eth = eth_sequencers.clone(); - let arb = arb_sequencers.clone(); - let base = base_sequencers.clone(); + let eth_sequencers: Vec = vec![ + hex_literal::hex!("dFD7f828689FbF00995BAA40d2DE93Eb400Cf60b").into(), + hex_literal::hex!("88bbb08aF77987D86E9559491fE7cC5910D68f2D").into(), + hex_literal::hex!("8d3CD208aa5592CF510eB24D8a2376bbF840bb63").into(), + ]; + let arb_sequencers: Vec = vec![ + hex_literal::hex!("b67CB37E9d114731B5624B6E919c007f4ddEa582").into(), + hex_literal::hex!("71403bFc37f031b60BD7a5B9597115708E391410").into(), + hex_literal::hex!("25CeF43c3F52db02ae52D951936b390C4B6A998F").into(), + ]; + let base_sequencers: Vec = vec![ + hex_literal::hex!("A395bBE2de17B488a578b972D96EE38933eE3c85").into(), + hex_literal::hex!("6f52f2D60AdFC152ac561287b754A56A7933F1ae").into(), + hex_literal::hex!("a7196AF761942A10126165B2c727eFCD46c254e0").into(), + ]; - let tokens_endowment = [ - eth_sequencers.clone(), - arb_sequencers.clone(), - base_sequencers.clone(), - vec![ - get_account_id_from_seed::("Alith"), - get_account_id_from_seed::("Baltathar"), - get_account_id_from_seed::("Charleth"), - ], - ] - .iter() - .flatten() - .cloned() - .map(|account_id| (0u32, 300_000_000__000_000_000_000_000_000u128, account_id)) - .collect::>(); + let sequencers_endownment = + [eth_sequencers.clone(), arb_sequencers.clone(), base_sequencers.clone()] + .iter() + .flatten() + .cloned() + .map(|account_id| (0u32, 100u128 * currency::DOLLARS, account_id)) + .collect::>(); + + let tokens_endowment = sequencers_endownment; rollup_genesis( // chain genesis salt @@ -332,16 +326,36 @@ pub fn alpha_config( // initial collators. vec![ ( - get_account_id_from_seed::("Alith"), - authority_keys_from_seed("Alith"), + collator01.into(), + ( + AuraId::from_slice(collator01_sr25519.as_slice()).unwrap(), + GrandpaId::from_slice(collator01_ed25519.as_slice()).unwrap(), + ), ), ( - get_account_id_from_seed::("Baltathar"), - authority_keys_from_seed("Baltathar"), + collator02.into(), + ( + AuraId::from_slice(collator02_sr25519.as_slice()).unwrap(), + GrandpaId::from_slice(collator02_ed25519.as_slice()).unwrap(), + ), + ), + ( + collator03.into(), + ( + AuraId::from_slice(collator03_sr25519.as_slice()).unwrap(), + GrandpaId::from_slice(collator03_ed25519.as_slice()).unwrap(), + ), + ), + ( + collator04.into(), + ( + AuraId::from_slice(collator04_sr25519.as_slice()).unwrap(), + GrandpaId::from_slice(collator04_ed25519.as_slice()).unwrap(), + ), ), ], // Sudo account - get_account_id_from_seed::("Alith"), + sudo.into(), // Tokens endowment tokens_endowment, // Config for Staking @@ -350,19 +364,19 @@ pub fn alpha_config( vec![ ( // Who gets to stake initially - get_account_id_from_seed::("Alith"), + collator01.into(), // Id of MGA token, 0u32, // How much mangata they stake - 100_000_000__000_000_000_000_000_000_u128, + 1__000_000u128 * currency::DOLLARS, ), ( // Who gets to stake initially - get_account_id_from_seed::("Baltathar"), + collator02.into(), // Id of MGA token, 0u32, // How much mangata they stake - 80_000_000__000_000_000_000_000_000_u128, + 1__000_000u128 * currency::DOLLARS, ), ], vec![ @@ -385,7 +399,9 @@ pub fn alpha_config( additional: Default::default(), existential_deposit: Default::default(), }, - Some(L1Asset::Ethereum(gasp_token_address)), + Some(L1Asset::Ethereum(hex_literal::hex!( + "0000000000000000000000000000000000000000" + ))), ), ( 1, @@ -402,9 +418,9 @@ pub fn alpha_config( )), ), ], - eth, - arb, - base, + eth_sequencers, + arb_sequencers, + base_sequencers, eth_chain_id, decode_url.clone(), ) @@ -550,8 +566,8 @@ fn rollup_genesis( }, fee_lock: rollup_runtime::FeeLockConfig { period_length: Some(10), - fee_lock_amount: Some(50__000_000_000_000_000_000u128), - swap_value_threshold: Some(1000__000_000_000_000_000_000u128), + fee_lock_amount: Some(50u128 * currency::DOLLARS), + swap_value_threshold: Some(50u128 * currency::DOLLARS), whitelisted_tokens: Default::default(), }, council: Default::default(), @@ -572,20 +588,38 @@ fn rollup_genesis( }, vesting: Default::default(), sequencer_staking: rollup_runtime::SequencerStakingConfig { - minimal_stake_amount: 1_000_000_u128, - slash_fine_amount: 100_000_u128, + minimal_stake_amount: 100u128 * currency::DOLLARS, + slash_fine_amount: 1u128 * currency::DOLLARS, sequencers_stake: [ eth_initial_sequencers .into_iter() - .map(|seq| (seq, pallet_rolldown::messages::Chain::Ethereum, 10_000_000_u128)) + .map(|seq| { + ( + seq, + pallet_rolldown::messages::Chain::Ethereum, + 100u128 * currency::DOLLARS, + ) + }) .collect::>(), arb_initial_sequencers .into_iter() - .map(|seq| (seq, pallet_rolldown::messages::Chain::Arbitrum, 10_000_000_u128)) + .map(|seq| { + ( + seq, + pallet_rolldown::messages::Chain::Ethereum, + 100u128 * currency::DOLLARS, + ) + }) .collect::>(), base_initial_sequencers .into_iter() - .map(|seq| (seq, pallet_rolldown::messages::Chain::Base, 10_000_000_u128)) + .map(|seq| { + ( + seq, + pallet_rolldown::messages::Chain::Ethereum, + 100u128 * currency::DOLLARS, + ) + }) .collect::>(), ] .iter() @@ -597,9 +631,9 @@ fn rollup_genesis( rolldown: rollup_runtime::RolldownConfig { _phantom: Default::default(), dispute_periods: [ - (pallet_rolldown::messages::Chain::Ethereum, 300u128), - (pallet_rolldown::messages::Chain::Arbitrum, 600u128), - (pallet_rolldown::messages::Chain::Base, 600u128), + (pallet_rolldown::messages::Chain::Ethereum, 200u128), + (pallet_rolldown::messages::Chain::Arbitrum, 200u128), + (pallet_rolldown::messages::Chain::Base, 200u128), ] .iter() .cloned() diff --git a/rollup/node/src/command.rs b/rollup/node/src/command.rs index 9e490622d..9bbb8b34c 100644 --- a/rollup/node/src/command.rs +++ b/rollup/node/src/command.rs @@ -106,6 +106,8 @@ impl SubstrateCli for Cli { "holesky" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Holesky, Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-holesky-rpc.gasp.xyz#/extrinsics/decode/")) )), + "ethereum-mainnet" => Box::new(chain_spec::ethereum_mainnet( Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-holesky-rpc.gasp.xyz#/extrinsics/decode/")) + )), path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), }) diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index 913fdbd02..5ba19c458 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -980,7 +980,7 @@ pub mod config { 1 * currency::DOLLARS } else { // ACTUAL - 1_500_000 * currency::DOLLARS + 1_000_000 * currency::DOLLARS }; /// Minimum stake required to be reserved to be a delegator pub const MinDelegatorStk: u128 = 1 * currency::CENTS; @@ -1323,8 +1323,8 @@ pub mod config { #[cfg(not(feature = "fast-runtime"))] parameter_types! { - pub const MerkleRootAutomaticBatchPeriod: u128 = 1200; - pub const MerkleRootAutomaticBatchSize: u128 = 1024; + pub const MerkleRootAutomaticBatchPeriod: u128 = 600; + pub const MerkleRootAutomaticBatchSize: u128 = 500; } pub struct WithdrawFee; From 80135e946c8992b8a66692a234be7b1607a3d0b3 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 12:28:53 +0100 Subject: [PATCH 04/12] working chainspec --- rollup/node/src/chain_spec.rs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index a877901fd..103c451dc 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -243,8 +243,8 @@ pub fn rollup_local_config( } pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { - let (gasp_token_address, eth_chain_id) = ([0u8; 20], 1u64); - let mut chain_genesis_salt_arr: [u8; 32] = + let (_gasp_token_address, eth_chain_id) = ([0u8; 20], 1u64); + let chain_genesis_salt_arr: [u8; 32] = hex_literal::hex!("0011001100110011001100110011001100110011001100110011001100110011"); let collator01 = hex_literal::hex!("b9fcA08B9cA327a1dE90FDB4d51aa5ae6Ffe512a"); @@ -368,7 +368,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 1__000_000u128 * currency::DOLLARS, + 2__000_000u128 * currency::DOLLARS, ), ( // Who gets to stake initially @@ -376,7 +376,23 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 1__000_000u128 * currency::DOLLARS, + 2__000_000u128 * currency::DOLLARS, + ), + ( + // Who gets to stake initially + collator03.into(), + // Id of MGA token, + 0u32, + // How much mangata they stake + 2__000_000u128 * currency::DOLLARS, + ), + ( + // Who gets to stake initially + collator04.into(), + // Id of MGA token, + 0u32, + // How much mangata they stake + 2__000_000u128 * currency::DOLLARS, ), ], vec![ @@ -606,7 +622,7 @@ fn rollup_genesis( .map(|seq| { ( seq, - pallet_rolldown::messages::Chain::Ethereum, + pallet_rolldown::messages::Chain::Arbitrum, 100u128 * currency::DOLLARS, ) }) @@ -614,11 +630,7 @@ fn rollup_genesis( base_initial_sequencers .into_iter() .map(|seq| { - ( - seq, - pallet_rolldown::messages::Chain::Ethereum, - 100u128 * currency::DOLLARS, - ) + (seq, pallet_rolldown::messages::Chain::Base, 100u128 * currency::DOLLARS) }) .collect::>(), ] From 92c823679cf499c94fa48fa7cf7dc5474015492c Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 16:55:37 +0100 Subject: [PATCH 05/12] foundation accounts --- rollup/node/src/chain_spec.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index 103c451dc..c169b9483 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -673,11 +673,9 @@ fn rollup_genesis( foundation_members: rollup_runtime::FoundationMembersConfig { members: BoundedVec::truncate_from( [ - // TODO AccountId20 - // Change the following - hex_literal::hex!["c8d02dfbff5ce2fda651c7dd7719bc5b17b9c104"], - hex_literal::hex!["c4690c56c36cec7ed5f6ed5d5eebace0c317073a"], - hex_literal::hex!["fc741134c82b81b7ab7efbf334b0c90ff8dbf22c"], + hex_literal::hex!["9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8"], + hex_literal::hex!["8960911c51EaD00db4cCA88FAF395672458da676"], + hex_literal::hex!["35dbD8Bd2c5617541bd9D9D8e065adf92275b83E"], ] .iter() .map(|acc| sp_runtime::AccountId20::from(*acc)) From ab052ce1ad4a4bec3570fc81ccfb6691ba58e6a5 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 17:29:57 +0100 Subject: [PATCH 06/12] council accounts --- rollup/node/src/chain_spec.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index c169b9483..a34359204 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -586,7 +586,18 @@ fn rollup_genesis( swap_value_threshold: Some(50u128 * currency::DOLLARS), whitelisted_tokens: Default::default(), }, - council: Default::default(), + council: rollup_runtime::CouncilConfig { + phantom: Default::default(), + members: vec![ + hex_literal::hex!("35dbD8Bd2c5617541bd9D9D8e065adf92275b83E").into(), + hex_literal::hex!("7368bff2fBB4C7B05f854c370eeDD6809186917B").into(), + hex_literal::hex!("9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8").into(), + hex_literal::hex!("8b5368B4BBa80475c9DFb70543F6090A7e986F39").into(), + hex_literal::hex!("aF3cA574A4903c5ddC7378Ac60d786a2664CbD91").into(), + hex_literal::hex!("584728a637303e753906a4F05CD8Ced10D80eB5e").into(), + hex_literal::hex!("8960911c51EaD00db4cCA88FAF395672458da676").into(), + ], + }, transaction_payment: Default::default(), sudo: rollup_runtime::SudoConfig { // Assign network admin rights. From dc0e81c34f5acf592bedee589190ed522eca5251 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 18:12:44 +0100 Subject: [PATCH 07/12] update issuance config --- rollup/runtime/src/runtime_config.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index 5ba19c458..904660d71 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -999,15 +999,15 @@ pub mod config { pub const SequencerIssuanceVaultId: PalletId = PalletId(*b"py/seqiv"); pub SequencerIssuanceVault: AccountId = SequencerIssuanceVaultId::get().into_account_truncating(); - pub const TotalCrowdloanAllocation: Balance = 330_000_000 * DOLLARS; - pub const IssuanceCap: Balance = 4_000_000_000 * DOLLARS; - pub const LinearIssuanceBlocks: u32 = 13_140_000u32; // 5 years - pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(555555556); - pub const StakingSplit: Perbill = Perbill::from_parts(344444444); - pub const SequencerSplit: Perbill = Perbill::from_parts(100000000); + pub const TotalCrowdloanAllocation: Balance = 0 * DOLLARS; + pub const IssuanceCap: Balance = 20_400_000 * DOLLARS; + pub const LinearIssuanceBlocks: u32 = 10_512_000u32; // 5 years + pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(647058823); + pub const StakingSplit: Perbill = Perbill::from_parts(235294118); + pub const SequencerSplit: Perbill = Perbill::from_parts(117647059); pub const ImmediateTGEReleasePercent: Percent = Percent::from_percent(20); - pub const TGEReleasePeriod: u32 = 5_256_000u32; // 2 years - pub const TGEReleaseBegin: u32 = 100_800u32; // Two weeks into chain start + pub const TGEReleasePeriod: u32 = 0u32; // 2 years + pub const TGEReleaseBegin: u32 = 0u32; // Two weeks into chain start } } From b61ddf02b9d59c72a6aee84daad3316f82818021 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Fri, 13 Dec 2024 18:50:42 +0100 Subject: [PATCH 08/12] adjust issuance config --- rollup/runtime/src/runtime_config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index 904660d71..b69652467 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -1002,9 +1002,9 @@ pub mod config { pub const TotalCrowdloanAllocation: Balance = 0 * DOLLARS; pub const IssuanceCap: Balance = 20_400_000 * DOLLARS; pub const LinearIssuanceBlocks: u32 = 10_512_000u32; // 5 years - pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(647058823); - pub const StakingSplit: Perbill = Perbill::from_parts(235294118); - pub const SequencerSplit: Perbill = Perbill::from_parts(117647059); + pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(647050000); // 13'199'820 + pub const StakingSplit: Perbill = Perbill::from_parts(235300000); // 4'800'120 + pub const SequencerSplit: Perbill = Perbill::from_parts(117650000); // 2'400'060 pub const ImmediateTGEReleasePercent: Percent = Percent::from_percent(20); pub const TGEReleasePeriod: u32 = 0u32; // 2 years pub const TGEReleaseBegin: u32 = 0u32; // Two weeks into chain start From aabd12abf44a0ea70d40a2a4e0e8548ca243fd69 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Sat, 14 Dec 2024 04:19:38 +0100 Subject: [PATCH 09/12] adjust values to avoid zero devision --- rollup/runtime/src/runtime_config.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index b69652467..379050a4c 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -1006,8 +1006,10 @@ pub mod config { pub const StakingSplit: Perbill = Perbill::from_parts(235300000); // 4'800'120 pub const SequencerSplit: Perbill = Perbill::from_parts(117650000); // 2'400'060 pub const ImmediateTGEReleasePercent: Percent = Percent::from_percent(20); - pub const TGEReleasePeriod: u32 = 0u32; // 2 years - pub const TGEReleaseBegin: u32 = 0u32; // Two weeks into chain start + // Just some safe values to avoid zero diision etc + // TGE happens on L1 either way + pub const TGEReleasePeriod: u32 = 100u32; // 2 years + pub const TGEReleaseBegin: u32 = 10u32; // Two weeks into chain start } } From d44479e0ca4662694d9ba3ec2a2607b67ba18e14 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Mon, 16 Dec 2024 08:50:59 +0100 Subject: [PATCH 10/12] set immediate release of TGE - not used either way --- rollup/runtime/src/runtime_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index 379050a4c..6dcf92d76 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -1005,7 +1005,7 @@ pub mod config { pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(647050000); // 13'199'820 pub const StakingSplit: Perbill = Perbill::from_parts(235300000); // 4'800'120 pub const SequencerSplit: Perbill = Perbill::from_parts(117650000); // 2'400'060 - pub const ImmediateTGEReleasePercent: Percent = Percent::from_percent(20); + pub const ImmediateTGEReleasePercent: Percent = Percent::from_percent(100); // Just some safe values to avoid zero diision etc // TGE happens on L1 either way pub const TGEReleasePeriod: u32 = 100u32; // 2 years From 8e5fa5afa2c5d0d302754918db694c4da95227a9 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Mon, 16 Dec 2024 10:39:42 +0100 Subject: [PATCH 11/12] adjust issuance so 5M of GASP is minted in genesis block & account for it in issuance config --- rollup/node/src/chain_spec.rs | 44 ++++++++++++++++++---------- rollup/runtime/src/runtime_config.rs | 2 +- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/rollup/node/src/chain_spec.rs b/rollup/node/src/chain_spec.rs index a34359204..835755e9f 100644 --- a/rollup/node/src/chain_spec.rs +++ b/rollup/node/src/chain_spec.rs @@ -223,6 +223,7 @@ pub fn rollup_local_config( base, eth_chain_id, decode_url.clone(), + vec![], ) }, // Bootnodes @@ -310,15 +311,34 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { hex_literal::hex!("a7196AF761942A10126165B2c727eFCD46c254e0").into(), ]; + let council_members = vec![ + hex_literal::hex!("35dbD8Bd2c5617541bd9D9D8e065adf92275b83E").into(), + hex_literal::hex!("7368bff2fBB4C7B05f854c370eeDD6809186917B").into(), + hex_literal::hex!("9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8").into(), + hex_literal::hex!("8b5368B4BBa80475c9DFb70543F6090A7e986F39").into(), + hex_literal::hex!("aF3cA574A4903c5ddC7378Ac60d786a2664CbD91").into(), + hex_literal::hex!("584728a637303e753906a4F05CD8Ced10D80eB5e").into(), + hex_literal::hex!("8960911c51EaD00db4cCA88FAF395672458da676").into(), + ]; + let sequencers_endownment = [eth_sequencers.clone(), arb_sequencers.clone(), base_sequencers.clone()] .iter() .flatten() .cloned() - .map(|account_id| (0u32, 100u128 * currency::DOLLARS, account_id)) + .map(|account_id| (RX_TOKEN_ID, 100u128 * currency::DOLLARS, account_id)) .collect::>(); - let tokens_endowment = sequencers_endownment; + let mut tokens_endowment = sequencers_endownment; + tokens_endowment.push((RX_TOKEN_ID, 988_100_u128 * currency::DOLLARS, sudo.into())); + + tokens_endowment.append( + &mut council_members + .clone() + .into_iter() + .map(|addr| (RX_TOKEN_ID, 1000_u128 * currency::DOLLARS, addr)) + .collect::>(), + ); rollup_genesis( // chain genesis salt @@ -368,7 +388,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 2__000_000u128 * currency::DOLLARS, + 1__001_000u128 * currency::DOLLARS, ), ( // Who gets to stake initially @@ -376,7 +396,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 2__000_000u128 * currency::DOLLARS, + 1__001_000u128 * currency::DOLLARS, ), ( // Who gets to stake initially @@ -384,7 +404,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 2__000_000u128 * currency::DOLLARS, + 1__001_000u128 * currency::DOLLARS, ), ( // Who gets to stake initially @@ -392,7 +412,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { // Id of MGA token, 0u32, // How much mangata they stake - 2__000_000u128 * currency::DOLLARS, + 1__001_000u128 * currency::DOLLARS, ), ], vec![ @@ -439,6 +459,7 @@ pub fn ethereum_mainnet(decode_url: Option) -> ChainSpec { base_sequencers, eth_chain_id, decode_url.clone(), + council_members, ) }, // Bootnodes @@ -474,6 +495,7 @@ fn rollup_genesis( base_initial_sequencers: Vec, chain_id: u64, decode_url: String, + council_members: Vec, ) -> rollup_runtime::RuntimeGenesisConfig { let initial_sequencers_stake = 10_000_000_u128; @@ -588,15 +610,7 @@ fn rollup_genesis( }, council: rollup_runtime::CouncilConfig { phantom: Default::default(), - members: vec![ - hex_literal::hex!("35dbD8Bd2c5617541bd9D9D8e065adf92275b83E").into(), - hex_literal::hex!("7368bff2fBB4C7B05f854c370eeDD6809186917B").into(), - hex_literal::hex!("9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8").into(), - hex_literal::hex!("8b5368B4BBa80475c9DFb70543F6090A7e986F39").into(), - hex_literal::hex!("aF3cA574A4903c5ddC7378Ac60d786a2664CbD91").into(), - hex_literal::hex!("584728a637303e753906a4F05CD8Ced10D80eB5e").into(), - hex_literal::hex!("8960911c51EaD00db4cCA88FAF395672458da676").into(), - ], + members: council_members, }, transaction_payment: Default::default(), sudo: rollup_runtime::SudoConfig { diff --git a/rollup/runtime/src/runtime_config.rs b/rollup/runtime/src/runtime_config.rs index 6dcf92d76..ce0e2d395 100644 --- a/rollup/runtime/src/runtime_config.rs +++ b/rollup/runtime/src/runtime_config.rs @@ -1000,7 +1000,7 @@ pub mod config { pub SequencerIssuanceVault: AccountId = SequencerIssuanceVaultId::get().into_account_truncating(); pub const TotalCrowdloanAllocation: Balance = 0 * DOLLARS; - pub const IssuanceCap: Balance = 20_400_000 * DOLLARS; + pub const IssuanceCap: Balance = 25_400_000 * DOLLARS; pub const LinearIssuanceBlocks: u32 = 10_512_000u32; // 5 years pub const LiquidityMiningSplit: Perbill = Perbill::from_parts(647050000); // 13'199'820 pub const StakingSplit: Perbill = Perbill::from_parts(235300000); // 4'800'120 From 10b7eb8cb591e8a2be86c11bdafd4fb885ad9b92 Mon Sep 17 00:00:00 2001 From: Mateusz Nowakowski Date: Mon, 16 Dec 2024 11:33:41 +0100 Subject: [PATCH 12/12] update node url --- rollup/node/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup/node/src/command.rs b/rollup/node/src/command.rs index 9bbb8b34c..d78f46e41 100644 --- a/rollup/node/src/command.rs +++ b/rollup/node/src/command.rs @@ -106,7 +106,7 @@ impl SubstrateCli for Cli { "holesky" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Holesky, Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-holesky-rpc.gasp.xyz#/extrinsics/decode/")) )), - "ethereum-mainnet" => Box::new(chain_spec::ethereum_mainnet( Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-holesky-rpc.gasp.xyz#/extrinsics/decode/")) + "ethereum-mainnet" => Box::new(chain_spec::ethereum_mainnet( Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-prod-rpc.gasp.xyz#/extrinsics/decode/")) )), path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),