Skip to content
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
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resolver = "2"
default-members = ["node"]

[workspace.package]
version = "1.33.15"
version = "1.34.0"
edition = "2024"
repository = "https://github.com/NethermindEth/Catalyst"
license = "MIT"
Expand Down Expand Up @@ -87,11 +87,11 @@ ssz_rs = { version = "0.9.0" }
strum = { version = "0.27", features = ["derive"] }

taiko_alethia_reth = { git = "https://github.com/taikoxyz/alethia-reth.git", rev = "a575e625374de3403df8517069626d007102cfc8", package = "alethia-reth-consensus" }
taiko_bindings = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "1dcf91c3402a0a6bbfacab157ba7edda9a436ea1", package = "bindings" }
taiko_preconfirmation_driver = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "1dcf91c3402a0a6bbfacab157ba7edda9a436ea1", package = "preconfirmation-driver" }
taiko_preconfirmation_types = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "1dcf91c3402a0a6bbfacab157ba7edda9a436ea1", package = "preconfirmation-types" }
taiko_protocol = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "1dcf91c3402a0a6bbfacab157ba7edda9a436ea1", package = "protocol" }
taiko_rpc = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "1dcf91c3402a0a6bbfacab157ba7edda9a436ea1", package = "rpc" }
taiko_bindings = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "09954cbde59b3e756870a2b509a35c503c67239c", package = "bindings" }
taiko_preconfirmation_driver = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "09954cbde59b3e756870a2b509a35c503c67239c", package = "preconfirmation-driver" }
taiko_preconfirmation_types = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "09954cbde59b3e756870a2b509a35c503c67239c", package = "preconfirmation-types" }
taiko_protocol = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "09954cbde59b3e756870a2b509a35c503c67239c", package = "protocol" }
taiko_rpc = { git = "https://github.com/taikoxyz/taiko-mono.git", rev = "09954cbde59b3e756870a2b509a35c503c67239c", package = "rpc" }
tokio = { version = "1.49", default-features = false, features = ["full"] }
tokio-util = { version = "0.7", default-features = false }
tracing = { version = "0.1", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions permissionless/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ pub async fn create_permissionless_node(
taiko_config.signer.get_address(),
)?)
.map_err(|e| anyhow::anyhow!("Failed to create L2Engine: {}", e))?;
let protocol_config = ethereum_l1.execution_layer.fetch_protocol_config().await?;
let inbox_config = ethereum_l1.execution_layer.fetch_inbox_config().await?;

let taiko = Taiko::new(
ethereum_l1.slot_clock.clone(),
protocol_config.clone(),
inbox_config,
metrics.clone(),
taiko_config,
l2_engine,
Expand Down
16 changes: 4 additions & 12 deletions shasta/src/l1/execution_layer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::config::EthereumL1Config;
use super::proposal_tx_builder::ProposalTxBuilder;
use super::protocol_config::ProtocolConfig;
use crate::l1::config::ContractAddresses;
use alloy::{
eips::BlockNumberOrTag,
Expand Down Expand Up @@ -28,6 +27,7 @@ use pacaya::l1::{
};
use serde_json::json;
use std::sync::{Arc, OnceLock};
use taiko_bindings::inbox::IInbox::Config;
use taiko_bindings::inbox::{
IForcedInclusionStore::ForcedInclusion,
IInbox::CoreState,
Expand Down Expand Up @@ -223,20 +223,12 @@ impl ExecutionLayer {
.context("is_transaction_in_progress")
}

pub async fn fetch_protocol_config(&self) -> Result<ProtocolConfig, Error> {
let shasta_config = self
.inbox_instance
pub async fn fetch_inbox_config(&self) -> Result<Config, Error> {
self.inbox_instance
.getConfig()
.call()
.await
.map_err(|e| anyhow::anyhow!("Failed to call getConfig for Inbox: {e}"))?;

info!(
"Shasta config: basefeeSharingPctg: {}",
shasta_config.basefeeSharingPctg,
);

Ok(ProtocolConfig::from(&shasta_config))
.map_err(|e| anyhow::anyhow!("Failed to call getConfig for Inbox: {e}"))
}

pub async fn get_activation_timestamp(&self) -> Result<u64, Error> {
Expand Down
11 changes: 7 additions & 4 deletions shasta/src/l1/protocol_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use taiko_bindings::inbox::IInbox::Config;
use taiko_protocol::shasta::constants::{
max_anchor_offset_for_chain, timestamp_max_offset_for_chain,
};

#[derive(Clone, Default)]
pub struct ProtocolConfig {
Expand All @@ -8,11 +11,11 @@ pub struct ProtocolConfig {
}

impl ProtocolConfig {
pub fn from(shasta_config: &Config) -> Self {
pub fn from(chain_id: u64, inbox_config: &Config) -> Self {
Self {
basefee_sharing_pctg: shasta_config.basefeeSharingPctg,
max_anchor_offset: taiko_protocol::shasta::constants::MAX_ANCHOR_OFFSET,
timestamp_max_offset: taiko_protocol::shasta::constants::TIMESTAMP_MAX_OFFSET,
basefee_sharing_pctg: inbox_config.basefeeSharingPctg,
max_anchor_offset: max_anchor_offset_for_chain(chain_id),
timestamp_max_offset: timestamp_max_offset_for_chain(chain_id),
}
}

Expand Down
17 changes: 6 additions & 11 deletions shasta/src/l2/execution_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub struct L2ExecutionLayer {
common: ExecutionLayerCommon,
provider: DynProvider,
shasta_anchor: Anchor::AnchorInstance<DynProvider>,
chain_id: u64,
pub config: TaikoConfig,
}

Expand All @@ -33,22 +32,17 @@ impl L2ExecutionLayer {
let provider =
alloy_tools::create_alloy_provider_without_wallet(&taiko_config.taiko_geth_url).await?;

let chain_id = provider
.get_chain_id()
.await
.map_err(|e| anyhow::anyhow!("Failed to get chain ID: {}", e))?;
info!("L2 Chain ID: {}", chain_id);

let shasta_anchor = Anchor::new(taiko_config.taiko_anchor_address, provider.clone());

let common =
ExecutionLayerCommon::new(provider.clone(), taiko_config.signer.get_address()).await?;

info!("L2 chain ID {}", common.chain_id());

Ok(Self {
common,
provider,
shasta_anchor,
chain_id,
config: taiko_config,
})
}
Expand Down Expand Up @@ -79,7 +73,7 @@ impl L2ExecutionLayer {
.max_fee_per_gas(u128::from(l2_slot_info.base_fee())) // value expected by Taiko
.max_priority_fee_per_gas(0) // value expected by Taiko
.nonce(nonce)
.chain_id(self.chain_id);
.chain_id(self.common.chain_id());

let typed_tx = call_builder
.into_transaction_request()
Expand Down Expand Up @@ -124,7 +118,8 @@ impl L2ExecutionLayer {
) -> Result<(), Error> {
info!(
"Transfer ETH from L2 to L1: srcChainId: {}, dstChainId: {}",
self.chain_id, dest_chain_id
self.common.chain_id(),
dest_chain_id
);

let provider =
Expand All @@ -135,7 +130,7 @@ impl L2ExecutionLayer {
self.config.taiko_bridge_address,
provider,
amount,
self.chain_id,
self.common.chain_id(),
dest_chain_id,
preconfer_address,
bridge_relayer_fee,
Expand Down
20 changes: 13 additions & 7 deletions shasta/src/l2/taiko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use pacaya::l2::config::TaikoConfig;
use std::{sync::Arc, time::Duration};
use taiko_alethia_reth::validation::ANCHOR_V3_V4_GAS_LIMIT;
use taiko_bindings::anchor::Anchor;
use taiko_bindings::inbox::IInbox::Config;
use taiko_protocol::shasta::constants::min_base_fee_for_chain;
use tracing::{debug, trace};

pub struct Taiko {
Expand All @@ -34,7 +36,7 @@ pub struct Taiko {
impl Taiko {
pub async fn new(
slot_clock: Arc<SlotClock>,
protocol_config: ProtocolConfig,
inbox_config: Config,
metrics: Arc<Metrics>,
taiko_config: TaikoConfig,
l2_engine: L2Engine,
Expand All @@ -46,13 +48,17 @@ impl Taiko {
jwt_secret_bytes: taiko_config.jwt_secret_bytes,
call_timeout: Duration::from_millis(taiko_config.preconf_heartbeat_ms / 2),
};

let l2_execution_layer = Arc::new(
L2ExecutionLayer::new(taiko_config.clone())
.await
.map_err(|e| anyhow::anyhow!("Failed to create L2ExecutionLayer: {}", e))?,
);
let protocol_config =
ProtocolConfig::from(l2_execution_layer.common().chain_id(), &inbox_config);
Ok(Self {
protocol_config,
l2_execution_layer: Arc::new(
L2ExecutionLayer::new(taiko_config.clone())
.await
.map_err(|e| anyhow::anyhow!("Failed to create L2ExecutionLayer: {}", e))?,
),
l2_execution_layer,
driver: Arc::new(TaikoDriver::new(&driver_config, metrics).await?),
slot_clock,
l2_engine,
Expand Down Expand Up @@ -268,7 +274,7 @@ impl Taiko {
&parent_block.header.inner,
timestamp_diff,
parent_base_fee_per_gas,
taiko_alethia_reth::eip4396::MIN_BASE_FEE,
min_base_fee_for_chain(self.l2_execution_layer.common().chain_id()),
);

Ok(base_fee)
Expand Down
7 changes: 3 additions & 4 deletions shasta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub use node::proposal_manager::ProposalManager;
use anyhow::Error;
use common::{
batch_builder::BatchBuilderConfig,
config::Config,
config::ConfigTrait,
config::{Config, ConfigTrait},
fork_info::ForkInfo,
funds_controller::FundsController,
l1::{self as common_l1, traits::PreconferProvider},
Expand Down Expand Up @@ -61,11 +60,11 @@ pub async fn create_shasta_node(
taiko_config.signer.get_address(),
)?)
.map_err(|e| anyhow::anyhow!("Failed to create L2Engine: {}", e))?;
let protocol_config = ethereum_l1.execution_layer.fetch_protocol_config().await?;
let inbox_config = ethereum_l1.execution_layer.fetch_inbox_config().await?;

let taiko = crate::l2::taiko::Taiko::new(
ethereum_l1.slot_clock.clone(),
protocol_config.clone(),
inbox_config,
metrics.clone(),
taiko_config,
l2_engine,
Expand Down