Skip to content

Commit cd252cc

Browse files
authored
Alpha launch chainspec (#870)
2 parents 32ebeea + 10b7eb8 commit cd252cc

File tree

4 files changed

+295
-37
lines changed

4 files changed

+295
-37
lines changed

rollup/node/src/chain_spec.rs

Lines changed: 274 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use crate::command::{EvmChain, InitialSequencersSet};
2+
use frame_benchmarking::benchmarking::current_time;
23
use rand::{thread_rng, Rng};
34
use rollup_runtime::{
4-
config::orml_asset_registry::AssetMetadataOf, tokens::RX_TOKEN_ID, AccountId, AuraConfig,
5-
CustomMetadata, GrandpaConfig, L1Asset, RuntimeGenesisConfig, Signature, SudoConfig,
6-
SystemConfig, XcmMetadata, WASM_BINARY,
5+
config::orml_asset_registry::AssetMetadataOf, currency, tokens::RX_TOKEN_ID, AccountId,
6+
AuraConfig, CustomMetadata, GrandpaConfig, L1Asset, RuntimeGenesisConfig, Signature,
7+
SudoConfig, SystemConfig, XcmMetadata, WASM_BINARY,
78
};
89
use sc_service::ChainType;
910
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
@@ -138,7 +139,7 @@ pub fn rollup_local_config(
138139
.iter()
139140
.flatten()
140141
.cloned()
141-
.map(|account_id| (0u32, 300_000_000__000_000_000_000_000_000u128, account_id))
142+
.map(|account_id| (0u32, 100u128 * currency::DOLLARS, account_id))
142143
.collect::<Vec<_>>();
143144

144145
rollup_genesis(
@@ -222,6 +223,243 @@ pub fn rollup_local_config(
222223
base,
223224
eth_chain_id,
224225
decode_url.clone(),
226+
vec![],
227+
)
228+
},
229+
// Bootnodes
230+
Vec::new(),
231+
// Telemetry
232+
None,
233+
// Protocol ID
234+
None,
235+
// ForkId
236+
None,
237+
// Properties
238+
Some(properties),
239+
// Extensions
240+
None,
241+
// code
242+
rollup_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"),
243+
)
244+
}
245+
246+
pub fn ethereum_mainnet(decode_url: Option<String>) -> ChainSpec {
247+
let (_gasp_token_address, eth_chain_id) = ([0u8; 20], 1u64);
248+
let chain_genesis_salt_arr: [u8; 32] =
249+
hex_literal::hex!("0011001100110011001100110011001100110011001100110011001100110011");
250+
251+
let collator01 = hex_literal::hex!("b9fcA08B9cA327a1dE90FDB4d51aa5ae6Ffe512a");
252+
let collator01_sr25519 =
253+
hex_literal::hex!("b6bcce45d0431d7cf3b23cf270e60fab48290cc2e129a62bcac04f6eab20e61f");
254+
let collator01_ed25519 =
255+
hex_literal::hex!("efc45e2afccbe0f53cab042438aebb6bcfc78585625c2a1b5517f3b258dd1cf8");
256+
257+
let collator02 = hex_literal::hex!("1f4E3f24d1ad7fE108c6eB3BA6F83ebe8cF0eD20");
258+
let collator02_sr25519 =
259+
hex_literal::hex!("860a476d36782b7e2854ab4e93287e67618a835741b84bd7cad0740a83275f3c");
260+
let collator02_ed25519 =
261+
hex_literal::hex!("2227445cd1b97943e1ba5c3cf3a94cadabd4494ff4394667be13ff755bae1abe");
262+
263+
let collator03 = hex_literal::hex!("7F7c7b782fBdAd01Fe33ca8FC647c867ee29deD2");
264+
let collator03_sr25519 =
265+
hex_literal::hex!("4899a218a591b9345b92de354b4d251eabd205bc64c787386fdccfe1f2147625");
266+
let collator03_ed25519 =
267+
hex_literal::hex!("d59387884193c920e0cef94770d74cc2cef0d534b1ebf5a5d1eb5033fb58746a");
268+
269+
let collator04 = hex_literal::hex!("4691A9BB90e20a7708182fD881fb723f9845460E");
270+
let collator04_sr25519 =
271+
hex_literal::hex!("b0c2a16a1acecd3e05a243d9bf8881f5d64a70b40864701dba01cfd1ee53c85a");
272+
let collator04_ed25519 =
273+
hex_literal::hex!("172165647a152929e2bb0af97f55ea0c0deaa087479be8eab7448c2dc8cd0dfe");
274+
275+
let sudo = hex_literal::hex!("E73e1Bb7B07f6bf447ED71252A5ad08C7ebE5bE5");
276+
277+
// Give your base currency a unit name and decimal places
278+
let mut properties = sc_chain_spec::Properties::new();
279+
properties.insert("tokenSymbol".into(), "GASP".into());
280+
properties.insert("tokenDecimals".into(), 18u32.into());
281+
properties.insert("ss58Format".into(), 42u32.into());
282+
properties.insert("isEthereum".into(), true.into());
283+
// This is quite useless here :/
284+
properties.insert(
285+
"chainGenesisSalt".into(),
286+
array_bytes::bytes2hex("0x", chain_genesis_salt_arr).into(),
287+
);
288+
289+
let decode_url = decode_url.expect("polkadot url is provided");
290+
// todo builder
291+
ChainSpec::from_genesis(
292+
// Name
293+
"Mainnet",
294+
// ID
295+
"mainnet",
296+
ChainType::Live,
297+
move || {
298+
let eth_sequencers: Vec<AccountId> = vec![
299+
hex_literal::hex!("dFD7f828689FbF00995BAA40d2DE93Eb400Cf60b").into(),
300+
hex_literal::hex!("88bbb08aF77987D86E9559491fE7cC5910D68f2D").into(),
301+
hex_literal::hex!("8d3CD208aa5592CF510eB24D8a2376bbF840bb63").into(),
302+
];
303+
let arb_sequencers: Vec<AccountId> = vec![
304+
hex_literal::hex!("b67CB37E9d114731B5624B6E919c007f4ddEa582").into(),
305+
hex_literal::hex!("71403bFc37f031b60BD7a5B9597115708E391410").into(),
306+
hex_literal::hex!("25CeF43c3F52db02ae52D951936b390C4B6A998F").into(),
307+
];
308+
let base_sequencers: Vec<AccountId> = vec![
309+
hex_literal::hex!("A395bBE2de17B488a578b972D96EE38933eE3c85").into(),
310+
hex_literal::hex!("6f52f2D60AdFC152ac561287b754A56A7933F1ae").into(),
311+
hex_literal::hex!("a7196AF761942A10126165B2c727eFCD46c254e0").into(),
312+
];
313+
314+
let council_members = vec![
315+
hex_literal::hex!("35dbD8Bd2c5617541bd9D9D8e065adf92275b83E").into(),
316+
hex_literal::hex!("7368bff2fBB4C7B05f854c370eeDD6809186917B").into(),
317+
hex_literal::hex!("9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8").into(),
318+
hex_literal::hex!("8b5368B4BBa80475c9DFb70543F6090A7e986F39").into(),
319+
hex_literal::hex!("aF3cA574A4903c5ddC7378Ac60d786a2664CbD91").into(),
320+
hex_literal::hex!("584728a637303e753906a4F05CD8Ced10D80eB5e").into(),
321+
hex_literal::hex!("8960911c51EaD00db4cCA88FAF395672458da676").into(),
322+
];
323+
324+
let sequencers_endownment =
325+
[eth_sequencers.clone(), arb_sequencers.clone(), base_sequencers.clone()]
326+
.iter()
327+
.flatten()
328+
.cloned()
329+
.map(|account_id| (RX_TOKEN_ID, 100u128 * currency::DOLLARS, account_id))
330+
.collect::<Vec<_>>();
331+
332+
let mut tokens_endowment = sequencers_endownment;
333+
tokens_endowment.push((RX_TOKEN_ID, 988_100_u128 * currency::DOLLARS, sudo.into()));
334+
335+
tokens_endowment.append(
336+
&mut council_members
337+
.clone()
338+
.into_iter()
339+
.map(|addr| (RX_TOKEN_ID, 1000_u128 * currency::DOLLARS, addr))
340+
.collect::<Vec<_>>(),
341+
);
342+
343+
rollup_genesis(
344+
// chain genesis salt
345+
H256::from(chain_genesis_salt_arr),
346+
// initial collators.
347+
vec![
348+
(
349+
collator01.into(),
350+
(
351+
AuraId::from_slice(collator01_sr25519.as_slice()).unwrap(),
352+
GrandpaId::from_slice(collator01_ed25519.as_slice()).unwrap(),
353+
),
354+
),
355+
(
356+
collator02.into(),
357+
(
358+
AuraId::from_slice(collator02_sr25519.as_slice()).unwrap(),
359+
GrandpaId::from_slice(collator02_ed25519.as_slice()).unwrap(),
360+
),
361+
),
362+
(
363+
collator03.into(),
364+
(
365+
AuraId::from_slice(collator03_sr25519.as_slice()).unwrap(),
366+
GrandpaId::from_slice(collator03_ed25519.as_slice()).unwrap(),
367+
),
368+
),
369+
(
370+
collator04.into(),
371+
(
372+
AuraId::from_slice(collator04_sr25519.as_slice()).unwrap(),
373+
GrandpaId::from_slice(collator04_ed25519.as_slice()).unwrap(),
374+
),
375+
),
376+
],
377+
// Sudo account
378+
sudo.into(),
379+
// Tokens endowment
380+
tokens_endowment,
381+
// Config for Staking
382+
// Make sure it works with initial-authorities as staking uses both
383+
(
384+
vec![
385+
(
386+
// Who gets to stake initially
387+
collator01.into(),
388+
// Id of MGA token,
389+
0u32,
390+
// How much mangata they stake
391+
1__001_000u128 * currency::DOLLARS,
392+
),
393+
(
394+
// Who gets to stake initially
395+
collator02.into(),
396+
// Id of MGA token,
397+
0u32,
398+
// How much mangata they stake
399+
1__001_000u128 * currency::DOLLARS,
400+
),
401+
(
402+
// Who gets to stake initially
403+
collator03.into(),
404+
// Id of MGA token,
405+
0u32,
406+
// How much mangata they stake
407+
1__001_000u128 * currency::DOLLARS,
408+
),
409+
(
410+
// Who gets to stake initially
411+
collator04.into(),
412+
// Id of MGA token,
413+
0u32,
414+
// How much mangata they stake
415+
1__001_000u128 * currency::DOLLARS,
416+
),
417+
],
418+
vec![
419+
// Who gets to stake initially
420+
// Id of MGA token,
421+
// How much mangata they pool
422+
// Id of the dummy token,
423+
// How many dummy tokens they pool,
424+
// Id of the liquidity token that is generated
425+
// How many liquidity tokens they stake,
426+
],
427+
),
428+
vec![
429+
(
430+
RX_TOKEN_ID,
431+
AssetMetadataOf {
432+
decimals: 18,
433+
name: BoundedVec::truncate_from(b"Gasp".to_vec()),
434+
symbol: BoundedVec::truncate_from(b"GASP".to_vec()),
435+
additional: Default::default(),
436+
existential_deposit: Default::default(),
437+
},
438+
Some(L1Asset::Ethereum(hex_literal::hex!(
439+
"0000000000000000000000000000000000000000"
440+
))),
441+
),
442+
(
443+
1,
444+
AssetMetadataOf {
445+
decimals: 18,
446+
name: BoundedVec::truncate_from(b"Gasp Ethereum".to_vec()),
447+
symbol: BoundedVec::truncate_from(b"GETH".to_vec()),
448+
additional: Default::default(),
449+
existential_deposit: Default::default(),
450+
},
451+
Some(L1Asset::Ethereum(
452+
array_bytes::hex2array("0x0000000000000000000000000000000000000001")
453+
.unwrap(),
454+
)),
455+
),
456+
],
457+
eth_sequencers,
458+
arb_sequencers,
459+
base_sequencers,
460+
eth_chain_id,
461+
decode_url.clone(),
462+
council_members,
225463
)
226464
},
227465
// Bootnodes
@@ -257,6 +495,7 @@ fn rollup_genesis(
257495
base_initial_sequencers: Vec<AccountId>,
258496
chain_id: u64,
259497
decode_url: String,
498+
council_members: Vec<AccountId>,
260499
) -> rollup_runtime::RuntimeGenesisConfig {
261500
let initial_sequencers_stake = 10_000_000_u128;
262501

@@ -365,11 +604,14 @@ fn rollup_genesis(
365604
},
366605
fee_lock: rollup_runtime::FeeLockConfig {
367606
period_length: Some(10),
368-
fee_lock_amount: Some(50__000_000_000_000_000_000u128),
369-
swap_value_threshold: Some(1000__000_000_000_000_000_000u128),
607+
fee_lock_amount: Some(50u128 * currency::DOLLARS),
608+
swap_value_threshold: Some(50u128 * currency::DOLLARS),
370609
whitelisted_tokens: Default::default(),
371610
},
372-
council: Default::default(),
611+
council: rollup_runtime::CouncilConfig {
612+
phantom: Default::default(),
613+
members: council_members,
614+
},
373615
transaction_payment: Default::default(),
374616
sudo: rollup_runtime::SudoConfig {
375617
// Assign network admin rights.
@@ -387,20 +629,34 @@ fn rollup_genesis(
387629
},
388630
vesting: Default::default(),
389631
sequencer_staking: rollup_runtime::SequencerStakingConfig {
390-
minimal_stake_amount: 1_000_000_u128,
391-
slash_fine_amount: 100_000_u128,
632+
minimal_stake_amount: 100u128 * currency::DOLLARS,
633+
slash_fine_amount: 1u128 * currency::DOLLARS,
392634
sequencers_stake: [
393635
eth_initial_sequencers
394636
.into_iter()
395-
.map(|seq| (seq, pallet_rolldown::messages::Chain::Ethereum, 10_000_000_u128))
637+
.map(|seq| {
638+
(
639+
seq,
640+
pallet_rolldown::messages::Chain::Ethereum,
641+
100u128 * currency::DOLLARS,
642+
)
643+
})
396644
.collect::<Vec<_>>(),
397645
arb_initial_sequencers
398646
.into_iter()
399-
.map(|seq| (seq, pallet_rolldown::messages::Chain::Arbitrum, 10_000_000_u128))
647+
.map(|seq| {
648+
(
649+
seq,
650+
pallet_rolldown::messages::Chain::Arbitrum,
651+
100u128 * currency::DOLLARS,
652+
)
653+
})
400654
.collect::<Vec<_>>(),
401655
base_initial_sequencers
402656
.into_iter()
403-
.map(|seq| (seq, pallet_rolldown::messages::Chain::Base, 10_000_000_u128))
657+
.map(|seq| {
658+
(seq, pallet_rolldown::messages::Chain::Base, 100u128 * currency::DOLLARS)
659+
})
404660
.collect::<Vec<_>>(),
405661
]
406662
.iter()
@@ -412,9 +668,9 @@ fn rollup_genesis(
412668
rolldown: rollup_runtime::RolldownConfig {
413669
_phantom: Default::default(),
414670
dispute_periods: [
415-
(pallet_rolldown::messages::Chain::Ethereum, 300u128),
416-
(pallet_rolldown::messages::Chain::Arbitrum, 600u128),
417-
(pallet_rolldown::messages::Chain::Base, 600u128),
671+
(pallet_rolldown::messages::Chain::Ethereum, 200u128),
672+
(pallet_rolldown::messages::Chain::Arbitrum, 200u128),
673+
(pallet_rolldown::messages::Chain::Base, 200u128),
418674
]
419675
.iter()
420676
.cloned()
@@ -442,11 +698,9 @@ fn rollup_genesis(
442698
foundation_members: rollup_runtime::FoundationMembersConfig {
443699
members: BoundedVec::truncate_from(
444700
[
445-
// TODO AccountId20
446-
// Change the following
447-
hex_literal::hex!["c8d02dfbff5ce2fda651c7dd7719bc5b17b9c104"],
448-
hex_literal::hex!["c4690c56c36cec7ed5f6ed5d5eebace0c317073a"],
449-
hex_literal::hex!["fc741134c82b81b7ab7efbf334b0c90ff8dbf22c"],
701+
hex_literal::hex!["9cA8aFB1326c99EC23B8D4e16C0162Bb206D83b8"],
702+
hex_literal::hex!["8960911c51EaD00db4cCA88FAF395672458da676"],
703+
hex_literal::hex!["35dbD8Bd2c5617541bd9D9D8e065adf92275b83E"],
450704
]
451705
.iter()
452706
.map(|acc| sp_runtime::AccountId20::from(*acc))

rollup/node/src/command.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ impl SubstrateCli for Cli {
106106
"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,
107107
Some(String::from("https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frollup-holesky-rpc.gasp.xyz#/extrinsics/decode/"))
108108
)),
109+
"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/"))
110+
)),
109111
path =>
110112
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
111113
})

rollup/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ impl pallet_sequencer_staking::Config for Runtime {
813813
type MinimumSequencers = frame_support::traits::ConstU32<2>;
814814
type RolldownProvider = Rolldown;
815815
type NoOfPastSessionsForEligibility = frame_support::traits::ConstU32<10>;
816-
type MaxSequencers = frame_support::traits::ConstU32<10>;
816+
type MaxSequencers = frame_support::traits::ConstU32<3>;
817817
type BlocksForSequencerUpdate = frame_support::traits::ConstU32<10>;
818818
type CancellerRewardPercentage = cfg::pallet_sequencer_staking::CancellerRewardPercentage;
819819
type ChainId = pallet_rolldown::messages::Chain;

0 commit comments

Comments
 (0)