Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add eigen chainspec #684

Merged
merged 20 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
/usr/local/cargo/registry
key: cargo-coverage-cache-${{ inputs.cache_version }}-${{ hashFiles('Cargo.lock') }}
- name: Install cargo-tarpaulin
run: cargo install --locked [email protected]
run: cargo install [email protected] --locked
- name: Generate coverage report with cargo-tarpaulin
run: cargo tarpaulin --timeout 120 --workspace -e rollup-runtime-integration-test rollup-node rollup-runtime --exclude-files **/mock.rs **/weights.rs **/weights/* --out Xml
- name: Upload to codecov.io
Expand Down
8 changes: 7 additions & 1 deletion pallets/xyk/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ benchmarks! {
let caller: T::AccountId = whitelisted_caller();
let first_asset_amount = MILION.to_balance::<T>();
let second_asset_amount = MILION.to_balance::<T>();
let first_asset_id = <T as Config>::Currency::create(&caller, first_asset_amount).unwrap();
<T as Config>::Currency::create(&caller, first_asset_amount).unwrap();
let first_asset_id = <T as Config>::Currency::create(&caller, second_asset_amount).unwrap();
let second_asset_id = <T as Config>::Currency::create(&caller, second_asset_amount).unwrap();
let liquidity_asset_id = second_asset_id + 1_u32.into();

Expand All @@ -106,11 +107,13 @@ benchmarks! {
let initial_amount: BalanceOf<T> = 1000000000000000.to_balance::<T>();
let expected_amount = BalanceOf::<T>::zero();
let expected_native_asset_id = <T as Config>::NativeCurrencyId::get();
<T as Config>::Currency::create(&caller, initial_amount).unwrap();
let native_asset_id = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let non_native_asset_id1 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let non_native_asset_id2 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();

let pool_amount: BalanceOf<T> = 100_000_000_000_000.to_balance::<T>();

Xyk::<T>::create_pool(RawOrigin::Signed(caller.clone().into()).into(), native_asset_id, pool_amount, non_native_asset_id1, pool_amount).unwrap();
Xyk::<T>::create_pool(RawOrigin::Signed(caller.clone().into()).into(), non_native_asset_id1, pool_amount, non_native_asset_id2, pool_amount).unwrap();

Expand Down Expand Up @@ -190,6 +193,7 @@ benchmarks! {
let initial_amount: BalanceOf<T> = 1000000000000000.to_balance::<T>();
let expected_amount = BalanceOf::<T>::zero();
let expected_native_asset_id = <T as Config>::NativeCurrencyId::get();
<T as Config>::Currency::create(&caller, initial_amount).unwrap();
let native_asset_id = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let non_native_asset_id1 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let non_native_asset_id2 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
Expand Down Expand Up @@ -333,6 +337,7 @@ benchmarks! {
}

<T as Config>::Currency::mint(native_asset_id, &caller, MILION.to_balance::<T>()).expect("Token creation failed");
<T as Config>::Currency::create(&caller, initial_amount).unwrap();
let non_native_asset_id2 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let liquidity_asset_id = non_native_asset_id2 + 1_u32.into();
let pool_creation_asset_1_amount = 40000000000000000000_u128.to_balance::<T>();
Expand Down Expand Up @@ -425,6 +430,7 @@ benchmarks! {
provide_liquidity_with_conversion {
let caller: T::AccountId = whitelisted_caller();
let initial_amount:BalanceOf<T> = 1_000_000_000.to_balance::<T>();
<T as Config>::Currency::create(&caller, initial_amount).unwrap();
let asset_id_1 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let asset_id_2 = <T as Config>::Currency::create(&caller, initial_amount).unwrap();
let liquidity_asset_id = asset_id_2 + 1_u32.into();
Expand Down
42 changes: 27 additions & 15 deletions rollup/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn rollup_session_keys(aura: AuraId, grandpa: GrandpaId) -> rollup_runtime::
pub fn rollup_local_config(initial_collators_as_sequencers: bool) -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "RXL".into());
properties.insert("tokenSymbol".into(), "GASP".into());
properties.insert("tokenDecimals".into(), 18u32.into());
properties.insert("ss58Format".into(), 42u32.into());
properties.insert("isEthereum".into(), true.into());
Expand Down Expand Up @@ -91,12 +91,21 @@ pub fn rollup_local_config(initial_collators_as_sequencers: bool) -> ChainSpec {
get_account_id_from_seed::<ecdsa::Public>("Alith"),
),
// ETH
(1u32, 0u128, get_account_id_from_seed::<ecdsa::Public>("Alith")),
(
1u32,
300_000_000__000_000_000_000_000_000u128,
get_account_id_from_seed::<ecdsa::Public>("Alith"),
),
(
0u32,
100_000_000__000_000_000_000_000_000u128,
get_account_id_from_seed::<ecdsa::Public>("Baltathar"),
),
(
1u32,
300_000_000__000_000_000_000_000_000u128,
get_account_id_from_seed::<ecdsa::Public>("Baltathar"),
),
(
0u32,
100_000_000__000_000_000_000_000_000u128,
Expand All @@ -113,12 +122,12 @@ pub fn rollup_local_config(initial_collators_as_sequencers: bool) -> ChainSpec {
0u32,
// How much mangata they pool
100_000_000__000_000_000_000_000_000_u128,
// Id of the dummy token,
2u32,
// How many dummy tokens they pool,
// Id of the eth token,
1u32,
// How many eth tokens they pool,
200_000_000__000_000_000_000_000_000_u128,
// Id of the liquidity token that is generated
3u32,
2u32,
// How many liquidity tokens they stake,
100_000_000__000_000_000_000_000_000_u128,
),
Expand All @@ -130,11 +139,11 @@ pub fn rollup_local_config(initial_collators_as_sequencers: bool) -> ChainSpec {
// How much mangata they pool
80_000_000__000_000_000_000_000_000_u128,
// Id of the dummy token,
2u32,
// How many dummy tokens they pool,
1u32,
// How many eth tokens they pool,
200_000_000__000_000_000_000_000_000_u128,
// Id of the liquidity token that is generated
3u32,
2u32,
// How many liquidity tokens they stake,
50_000_000__000_000_000_000_000_000_u128,
),
Expand All @@ -144,26 +153,29 @@ pub fn rollup_local_config(initial_collators_as_sequencers: bool) -> ChainSpec {
RX_TOKEN_ID,
AssetMetadataOf {
decimals: 18,
name: BoundedVec::truncate_from(b"Mangata".to_vec()),
symbol: BoundedVec::truncate_from(b"MGXL".to_vec()),
name: BoundedVec::truncate_from(b"Gasp".to_vec()),
symbol: BoundedVec::truncate_from(b"GASP".to_vec()),
additional: Default::default(),
existential_deposit: Default::default(),
location: None,
},
None,
Some(L1Asset::Ethereum(
array_bytes::hex2array("0x1317106Dd45FF0EB911e9F0aF78D63FBF9076f69")
.unwrap(),
)),
),
(
1,
AssetMetadataOf {
decimals: 18,
name: BoundedVec::truncate_from(b"Ether".to_vec()),
symbol: BoundedVec::truncate_from(b"ETH".to_vec()),
name: BoundedVec::truncate_from(b"Gasp Ethereum".to_vec()),
symbol: BoundedVec::truncate_from(b"GETH".to_vec()),
additional: Default::default(),
existential_deposit: Default::default(),
location: None,
},
Some(L1Asset::Ethereum(
array_bytes::hex2array("0x5748395867463837537395739375937493733457")
array_bytes::hex2array("0xce658E386fAc0646CEDAf810070f0525Af14D11d")
.unwrap(),
)),
),
Expand Down
1 change: 1 addition & 0 deletions rollup/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl SubstrateCli for Cli {
Ok(match id {
"" | "rollup-local" => Box::new(chain_spec::rollup_local_config(false)),
"rollup-local-seq" => Box::new(chain_spec::rollup_local_config(true)),
"holesky" => Box::new(chain_spec::rollup_local_config(false)),
path =>
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
Expand Down
Loading