Skip to content

Commit

Permalink
base integration (#839)
Browse files Browse the repository at this point in the history
base integration
  • Loading branch information
iStrike7 authored Nov 22, 2024
1 parent 8536917 commit 6a9683c
Show file tree
Hide file tree
Showing 10 changed files with 300 additions and 274 deletions.
270 changes: 135 additions & 135 deletions Cargo.lock

Large diffs are not rendered by default.

266 changes: 133 additions & 133 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pallets/rolldown/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ mod benchmarks {
{
L1Asset::Ethereum(v) => (crate::messages::Chain::Ethereum, v),
L1Asset::Arbitrum(v) => (crate::messages::Chain::Arbitrum, v),
L1Asset::Base(v) => (crate::messages::Chain::Base, v),
};
Rolldown::<T>::withdraw(
RawOrigin::Signed(who).into(),
Expand Down Expand Up @@ -195,6 +196,7 @@ mod benchmarks {
{
L1Asset::Ethereum(v) => (crate::messages::Chain::Ethereum, v),
L1Asset::Arbitrum(v) => (crate::messages::Chain::Arbitrum, v),
L1Asset::Base(v) => (crate::messages::Chain::Base, v),
};
Ok((l1_aset_chain, l1_asset_address))
}
Expand Down
1 change: 1 addition & 0 deletions pallets/rolldown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,7 @@ impl Convert<(messages::Chain, [u8; 20]), L1Asset> for MultiEvmChainAddressConve
match chain {
messages::Chain::Ethereum => L1Asset::Ethereum(address),
messages::Chain::Arbitrum => L1Asset::Arbitrum(address),
messages::Chain::Base => L1Asset::Base(address),
}
}
}
3 changes: 2 additions & 1 deletion pallets/rolldown/src/messages/eth_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl From<crate::messages::Chain> for Chain {
match c {
crate::messages::Chain::Ethereum => Chain::Ethereum,
crate::messages::Chain::Arbitrum => Chain::Arbitrum,
crate::messages::Chain::Base => Chain::Base,
}
}
}
Expand Down Expand Up @@ -141,7 +142,7 @@ sol! {
}

#[derive(Debug, Eq, PartialEq, Encode, Decode, TypeInfo)]
enum Chain{ Ethereum, Arbitrum }
enum Chain{ Ethereum, Arbitrum, Base }

#[derive(Debug, Eq, PartialEq, Encode, Decode, TypeInfo)]
enum L2RequestType{ Withdrawal, Cancel, FailedDepositResolution }
Expand Down
2 changes: 2 additions & 0 deletions pallets/rolldown/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub enum Chain {
#[default]
Ethereum,
Arbitrum,
Base,
}

#[repr(u8)]
Expand Down Expand Up @@ -421,6 +422,7 @@ impl TryFrom<eth_abi::Chain> for Chain {
match origin {
eth_abi::Chain::Ethereum => Ok(Chain::Ethereum),
eth_abi::Chain::Arbitrum => Ok(Chain::Arbitrum),
eth_abi::Chain::Base => Ok(Chain::Base),
_ => Err(String::from("Invalid origin type")),
}
}
Expand Down
9 changes: 9 additions & 0 deletions rollup/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub fn rollup_local_config(
chain_genesis_salt: Option<String>,
eth_sequencers: Vec<AccountId>,
arb_sequencers: Vec<AccountId>,
base_sequencers: Vec<AccountId>,
evm_chain: EvmChain,
decode_url: Option<String>,
) -> ChainSpec {
Expand Down Expand Up @@ -121,10 +122,12 @@ pub fn rollup_local_config(
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::<ecdsa::Public>("Alith"),
get_account_id_from_seed::<ecdsa::Public>("Baltathar"),
Expand Down Expand Up @@ -213,6 +216,7 @@ pub fn rollup_local_config(
],
eth,
arb,
base,
eth_chain_id,
decode_url.clone(),
)
Expand Down Expand Up @@ -246,6 +250,7 @@ fn rollup_genesis(
register_assets: Vec<(u32, AssetMetadataOf, Option<L1Asset>)>,
eth_initial_sequencers: Vec<AccountId>,
arb_initial_sequencers: Vec<AccountId>,
base_initial_sequencers: Vec<AccountId>,
chain_id: u64,
decode_url: String,
) -> rollup_runtime::RuntimeGenesisConfig {
Expand Down Expand Up @@ -389,6 +394,10 @@ fn rollup_genesis(
.into_iter()
.map(|seq| (seq, pallet_rolldown::messages::Chain::Arbitrum, 10_000_000_u128))
.collect::<Vec<_>>(),
base_initial_sequencers
.into_iter()
.map(|seq| (seq, pallet_rolldown::messages::Chain::Base, 10_000_000_u128))
.collect::<Vec<_>>(),
]
.iter()
.flatten()
Expand Down
3 changes: 3 additions & 0 deletions rollup/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pub struct Cli {
#[arg(long, value_parser, value_delimiter = ',', global = true)]
pub override_arb_sequencers: Vec<String>,

#[arg(long, value_parser, value_delimiter = ',', global = true)]
pub override_base_sequencers: Vec<String>,

#[clap(flatten)]
pub run: RunCmd,
}
Expand Down
17 changes: 12 additions & 5 deletions rollup/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,28 @@ impl SubstrateCli for Cli {
} else {
self.override_arb_sequencers.iter().map(parse_accounts).collect()
};

let base_sequencers = if self.override_base_sequencers.is_empty() {
[crate::chain_spec::get_account_id_from_seed::<sp_core::ecdsa::Public>("Dorothy")]
.to_vec()
} else {
self.override_base_sequencers.iter().map(parse_accounts).collect()
};
Ok(match id {
"" | "rollup-local" =>
Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, EvmChain::Anvil,
Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Anvil,
None
)),
"rollup-local-seq" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, EvmChain::Anvil,
"rollup-local-seq" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Anvil,
None
)),
"anvil" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, EvmChain::Anvil,
"anvil" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Anvil,
None
)),
"reth" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, EvmChain::Reth,
"reth" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, base_sequencers, EvmChain::Reth,
None
)),
"holesky" => Box::new(chain_spec::rollup_local_config(self.randomize_chain_genesis_salt, self.chain_genesis_salt.clone(), eth_sequencers, arb_sequencers, EvmChain::Holesky,
"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/"))
)),
path =>
Expand Down
1 change: 1 addition & 0 deletions rollup/runtime/src/runtime_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ pub mod config {
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,
}
}
}
Expand Down

0 comments on commit 6a9683c

Please sign in to comment.