diff --git a/Cargo.lock b/Cargo.lock index abfcc082..e1ec88d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1962,7 +1962,7 @@ dependencies = [ [[package]] name = "bindings" version = "2.0.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alloy", "serde", @@ -2622,7 +2622,7 @@ dependencies = [ [[package]] name = "common" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alloy", "alloy-json-rpc", @@ -3441,7 +3441,7 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "driver" version = "2.0.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alethia-reth-consensus", "alethia-reth-evm", @@ -6728,7 +6728,7 @@ dependencies = [ [[package]] name = "node" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alloy", "alloy-json-rpc", @@ -7345,7 +7345,7 @@ dependencies = [ [[package]] name = "p2p-boot-node" -version = "1.33.15" +version = "1.34.0" dependencies = [ "anyhow", "discv5 0.10.2", @@ -7357,7 +7357,7 @@ dependencies = [ [[package]] name = "pacaya" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alloy", "alloy-json-rpc", @@ -7501,7 +7501,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "permissionless" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alethia-reth-consensus", "alloy", @@ -7723,7 +7723,7 @@ dependencies = [ [[package]] name = "preconfirmation-driver" version = "2.0.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alethia-reth-consensus", "alethia-reth-primitives", @@ -7759,7 +7759,7 @@ dependencies = [ [[package]] name = "preconfirmation-net" version = "0.1.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alloy-primitives", "anyhow", @@ -7796,7 +7796,7 @@ dependencies = [ [[package]] name = "preconfirmation-types" version = "0.1.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alloy-primitives", "anyhow", @@ -8005,7 +8005,7 @@ dependencies = [ [[package]] name = "protocol" version = "2.0.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alethia-reth-consensus", "alethia-reth-evm", @@ -11884,7 +11884,7 @@ checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" [[package]] name = "rpc" version = "2.0.0" -source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=1dcf91c3402a0a6bbfacab157ba7edda9a436ea1#1dcf91c3402a0a6bbfacab157ba7edda9a436ea1" +source = "git+https://github.com/taikoxyz/taiko-mono.git?rev=09954cbde59b3e756870a2b509a35c503c67239c#09954cbde59b3e756870a2b509a35c503c67239c" dependencies = [ "alethia-reth-evm", "alethia-reth-primitives", @@ -12585,7 +12585,7 @@ dependencies = [ [[package]] name = "shasta" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alethia-reth-consensus", "alloy", @@ -14066,7 +14066,7 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "urc" -version = "1.33.15" +version = "1.34.0" dependencies = [ "alloy", "alloy-json-rpc", diff --git a/Cargo.toml b/Cargo.toml index ab0ac5ca..25060d7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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 } diff --git a/permissionless/src/lib.rs b/permissionless/src/lib.rs index c2ea14f7..c6b07c5a 100644 --- a/permissionless/src/lib.rs +++ b/permissionless/src/lib.rs @@ -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, diff --git a/shasta/src/l1/execution_layer.rs b/shasta/src/l1/execution_layer.rs index 27d12fd9..9b1bece9 100644 --- a/shasta/src/l1/execution_layer.rs +++ b/shasta/src/l1/execution_layer.rs @@ -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, @@ -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, @@ -223,20 +223,12 @@ impl ExecutionLayer { .context("is_transaction_in_progress") } - pub async fn fetch_protocol_config(&self) -> Result { - let shasta_config = self - .inbox_instance + pub async fn fetch_inbox_config(&self) -> Result { + 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 { diff --git a/shasta/src/l1/protocol_config.rs b/shasta/src/l1/protocol_config.rs index 3fe99b55..d55c5091 100644 --- a/shasta/src/l1/protocol_config.rs +++ b/shasta/src/l1/protocol_config.rs @@ -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 { @@ -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), } } diff --git a/shasta/src/l2/execution_layer.rs b/shasta/src/l2/execution_layer.rs index 7de3b795..f940d04b 100644 --- a/shasta/src/l2/execution_layer.rs +++ b/shasta/src/l2/execution_layer.rs @@ -24,7 +24,6 @@ pub struct L2ExecutionLayer { common: ExecutionLayerCommon, provider: DynProvider, shasta_anchor: Anchor::AnchorInstance, - chain_id: u64, pub config: TaikoConfig, } @@ -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, }) } @@ -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() @@ -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 = @@ -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, diff --git a/shasta/src/l2/taiko.rs b/shasta/src/l2/taiko.rs index f678e1ab..657bbfef 100644 --- a/shasta/src/l2/taiko.rs +++ b/shasta/src/l2/taiko.rs @@ -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 { @@ -34,7 +36,7 @@ pub struct Taiko { impl Taiko { pub async fn new( slot_clock: Arc, - protocol_config: ProtocolConfig, + inbox_config: Config, metrics: Arc, taiko_config: TaikoConfig, l2_engine: L2Engine, @@ -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, @@ -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) diff --git a/shasta/src/lib.rs b/shasta/src/lib.rs index eb7ff91e..9dc3a6f1 100644 --- a/shasta/src/lib.rs +++ b/shasta/src/lib.rs @@ -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}, @@ -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,