diff --git a/Cargo.lock b/Cargo.lock index e0cf96f04..ecf39bd36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-celo-evm" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-evm", @@ -2305,7 +2305,7 @@ dependencies = [ [[package]] name = "celo-alloy-consensus" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-eips 0.15.11", @@ -2321,7 +2321,7 @@ dependencies = [ [[package]] name = "celo-alloy-network" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-network 0.15.11", @@ -2335,7 +2335,7 @@ dependencies = [ [[package]] name = "celo-alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-eips 0.15.11", @@ -2354,7 +2354,7 @@ dependencies = [ [[package]] name = "celo-alloy-rpc-types-engine" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-eips 0.15.11", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "celo-client" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-celo-evm", "alloy-consensus 0.15.11", @@ -2383,6 +2383,7 @@ dependencies = [ "async-trait", "celo-alloy-consensus", "celo-driver", + "celo-genesis", "celo-proof", "cfg-if", "kona-client", @@ -2414,7 +2415,7 @@ dependencies = [ [[package]] name = "celo-driver" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-evm", @@ -2424,6 +2425,7 @@ dependencies = [ "celo-alloy-consensus", "celo-alloy-rpc-types-engine", "celo-executor", + "celo-genesis", "celo-protocol", "kona-derive", "kona-driver", @@ -2440,7 +2442,7 @@ dependencies = [ [[package]] name = "celo-executor" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-celo-evm", "alloy-consensus 0.15.11", @@ -2453,6 +2455,7 @@ dependencies = [ "alloy-trie", "celo-alloy-consensus", "celo-alloy-rpc-types-engine", + "celo-genesis", "celo-registry", "kona-executor", "kona-genesis", @@ -2466,10 +2469,30 @@ dependencies = [ "tracing", ] +[[package]] +name = "celo-genesis" +version = "0.1.0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" +dependencies = [ + "alloy-consensus 0.15.11", + "alloy-eips 0.15.11", + "alloy-hardforks", + "alloy-op-hardforks", + "alloy-primitives", + "alloy-sol-types", + "derive_more 2.0.1", + "kona-genesis", + "kona-serde", + "op-revm", + "serde", + "serde_repr", + "thiserror 2.0.12", +] + [[package]] name = "celo-host" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-celo-evm", "alloy-consensus 0.15.11", @@ -2490,6 +2513,7 @@ dependencies = [ "celo-alloy-network", "celo-alloy-rpc-types-engine", "celo-client", + "celo-genesis", "clap", "kona-cli", "kona-client", @@ -2522,7 +2546,7 @@ dependencies = [ [[package]] name = "celo-proof" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-consensus 0.15.11", "alloy-eips 0.15.11", @@ -2536,6 +2560,7 @@ dependencies = [ "celo-alloy-rpc-types-engine", "celo-driver", "celo-executor", + "celo-genesis", "kona-derive", "kona-driver", "kona-executor", @@ -2559,7 +2584,7 @@ dependencies = [ [[package]] name = "celo-protocol" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloc-no-stdlib", "alloy-consensus 0.15.11", @@ -2587,10 +2612,11 @@ dependencies = [ [[package]] name = "celo-registry" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-chains", "alloy-primitives", + "celo-genesis", "kona-genesis", "kona-registry", "lazy_static", @@ -2602,7 +2628,7 @@ dependencies = [ [[package]] name = "celo-revm" version = "0.1.0" -source = "git+https://github.com/celo-org/celo-kona?rev=0200f39991ecbf83157e1186b7c214c9b77af4c0#0200f39991ecbf83157e1186b7c214c9b77af4c0" +source = "git+https://github.com/celo-org/celo-kona?rev=86da8c48ee196cec4892c6f4ff360813b143e7c9#86da8c48ee196cec4892c6f4ff360813b143e7c9" dependencies = [ "alloy-eips 0.15.11", "alloy-evm", @@ -7400,6 +7426,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "celo-genesis", "hana-celestia", "hana-oracle", "kona-derive", @@ -7453,6 +7480,7 @@ dependencies = [ "celo-alloy-consensus", "celo-alloy-rpc-types-engine", "celo-driver", + "celo-genesis", "celo-proof", "celo-protocol", "cfg-if", @@ -7485,6 +7513,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "celo-genesis", "kona-derive", "kona-driver", "kona-executor", @@ -7568,6 +7597,7 @@ dependencies = [ "c-kzg", "celo-alloy-consensus", "celo-alloy-network", + "celo-genesis", "celo-host", "celo-protocol", "cfg-if", @@ -7629,6 +7659,7 @@ dependencies = [ "op-succinct-proof-utils", "op-succinct-scripts", "reqwest", + "rustls", "serde_json", "sp1-sdk", "tokio", @@ -7640,6 +7671,7 @@ name = "op-succinct-range-utils" version = "0.1.0" dependencies = [ "anyhow", + "celo-genesis", "kona-proof", "op-succinct-client-utils", "rkyv", diff --git a/Cargo.toml b/Cargo.toml index 72412a13a..644d8d1f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,10 +81,11 @@ kona-genesis = { git = "https://github.com/op-rs/kona", tag = "kona-client/v1.0. # TODO: replace commit hash with tag when available # celo-kona -celo-driver = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0" } -celo-proof = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0" } -celo-host = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0" } -celo-protocol = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } +celo-driver = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9" } +celo-proof = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9" } +celo-host = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9" } +celo-protocol = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } +celo-genesis = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } # hana hana-blobstream = { git = "https://github.com/celestiaorg/hana", rev = "904f086fd7335986e87a0f0432b1f07fe997f690" } @@ -144,10 +145,10 @@ op-alloy-rpc-types-engine = { version = "=0.15.4", default-features = false } op-alloy-network = { version = "=0.15.4", default-features = false } # Celo Alloy -celo-alloy-consensus = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } -celo-alloy-rpc-types = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } -celo-alloy-rpc-types-engine = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } -celo-alloy-network = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } +celo-alloy-consensus = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } +celo-alloy-rpc-types = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } +celo-alloy-rpc-types-engine = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } +celo-alloy-network = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } # Execution alloy-evm = { version = "0.6.0", default-features = false, features = ["op"] } @@ -157,7 +158,7 @@ revm = { version = "22.0.0", default-features = false, features = ["kzg-rs", "bn op-revm = { version = "3.0.1", default-features = false } # Celo Execution -alloy-celo-evm = { git = "https://github.com/celo-org/celo-kona", rev = "0200f39991ecbf83157e1186b7c214c9b77af4c0", default-features = false } +alloy-celo-evm = { git = "https://github.com/celo-org/celo-kona", rev = "86da8c48ee196cec4892c6f4ff360813b143e7c9", default-features = false } # SP1 sp1-sdk = { version = "5.0.0" } diff --git a/elf/aggregation-elf b/elf/aggregation-elf index fce648ed5..63119648b 100755 Binary files a/elf/aggregation-elf and b/elf/aggregation-elf differ diff --git a/elf/range-elf-embedded b/elf/range-elf-embedded index 100c9c6ad..1d2d46d8c 100755 Binary files a/elf/range-elf-embedded and b/elf/range-elf-embedded differ diff --git a/fault-proof/src/proposer.rs b/fault-proof/src/proposer.rs index bd3f95bed..53b9d12d7 100644 --- a/fault-proof/src/proposer.rs +++ b/fault-proof/src/proposer.rs @@ -158,7 +158,7 @@ where .compressed() .strategy(FulfillmentStrategy::Hosted) .skip_simulation(true) - .cycle_limit(1_000_000_000_000) + .cycle_limit(1_000_000_000) .run_async() .await? }; @@ -220,7 +220,12 @@ where .await? }; - let receipt = game.prove(agg_proof.bytes().into()).send().await?.get_receipt().await?; + let transaction_request = game.prove(agg_proof.bytes().into()).into_transaction_request(); + + let receipt = self + .signer + .send_transaction_request(self.config.l1_rpc.clone(), transaction_request) + .await?; Ok(receipt.transaction_hash) } diff --git a/op-network.yaml b/op-network.yaml index fbf6e31c0..dc202a181 100644 --- a/op-network.yaml +++ b/op-network.yaml @@ -36,5 +36,4 @@ ethereum_package: "storage": {}, "nonce": "1" } - } - ' \ No newline at end of file + }' \ No newline at end of file diff --git a/programs/range/utils/Cargo.toml b/programs/range/utils/Cargo.toml index 3e5dd7ebc..790adfa1b 100644 --- a/programs/range/utils/Cargo.toml +++ b/programs/range/utils/Cargo.toml @@ -15,6 +15,9 @@ rkyv.workspace = true # kona kona-proof.workspace = true +# celo-kona +celo-genesis.workspace = true + # sp1 sp1-zkvm.workspace = true diff --git a/programs/range/utils/src/lib.rs b/programs/range/utils/src/lib.rs index e2239cfff..301c8a62b 100644 --- a/programs/range/utils/src/lib.rs +++ b/programs/range/utils/src/lib.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use celo_genesis::{CeloHardForkConfig, CeloRollupConfig}; use kona_proof::{l1::OracleL1ChainProvider, l2::OracleL2ChainProvider}; use op_succinct_client_utils::{ boot::BootInfoStruct, @@ -42,9 +43,17 @@ where Some((cursor, l1_provider, l2_provider)) => { let rollup_config = Arc::new(boot_info.rollup_config.clone()); + // Wrap RollupConfig with CeloRollupConfig + let celo_rollup_config = CeloRollupConfig { + op_rollup_config: boot_info.rollup_config.clone(), + hardforks: CeloHardForkConfig { + op_hardfork_config: rollup_config.hardforks, + cel2_time: Some(0), + }, + }; let pipeline = executor .create_pipeline( - rollup_config, + Arc::new(celo_rollup_config), cursor.clone(), oracle, beacon, diff --git a/scripts/prove/Cargo.toml b/scripts/prove/Cargo.toml index 23d63a74d..ff58a139b 100644 --- a/scripts/prove/Cargo.toml +++ b/scripts/prove/Cargo.toml @@ -39,6 +39,8 @@ alloy-primitives.workspace = true # sp1 sp1-sdk.workspace = true +rustls = { version = "0.23.23", features = ["ring"] } + [dev-dependencies] reqwest = { version = "0.12.4", features = ["json"] } serde_json.workspace = true diff --git a/scripts/prove/bin/multi.rs b/scripts/prove/bin/multi.rs index a10e2cc6b..35ace7868 100644 --- a/scripts/prove/bin/multi.rs +++ b/scripts/prove/bin/multi.rs @@ -14,6 +14,8 @@ use tracing::debug; /// Execute the OP Succinct program for multiple blocks. #[tokio::main] async fn main() -> Result<()> { + rustls::crypto::ring::default_provider().install_default().unwrap(); + let args = HostExecutorArgs::parse(); dotenv::from_path(&args.env_file) diff --git a/scripts/utils/bin/fetch_rollup_config.rs b/scripts/utils/bin/fetch_rollup_config.rs index 46018f45e..4a8e84d79 100644 --- a/scripts/utils/bin/fetch_rollup_config.rs +++ b/scripts/utils/bin/fetch_rollup_config.rs @@ -103,7 +103,7 @@ async fn update_l2oo_config() -> Result<()> { let rollup_config = data_fetcher.rollup_config.as_ref().unwrap(); let rollup_config_hash = format!("0x{:x}", hash_rollup_config(rollup_config)); - let l2_block_time = rollup_config.block_time; + let l2_block_time = rollup_config.op_rollup_config.block_time; let submission_interval = env::var("SUBMISSION_INTERVAL").map(|p| p.parse().unwrap()).unwrap_or(10); diff --git a/utils/celestia/client/Cargo.toml b/utils/celestia/client/Cargo.toml index 20abc4729..a3b9e4c95 100644 --- a/utils/celestia/client/Cargo.toml +++ b/utils/celestia/client/Cargo.toml @@ -16,6 +16,9 @@ kona-genesis.workspace = true kona-preimage.workspace = true kona-proof.workspace = true +# celo-kona +celo-genesis.workspace = true + # hana hana-celestia.workspace = true hana-oracle.workspace = true diff --git a/utils/celestia/client/src/executor.rs b/utils/celestia/client/src/executor.rs index e894ecc4c..922984f06 100644 --- a/utils/celestia/client/src/executor.rs +++ b/utils/celestia/client/src/executor.rs @@ -2,11 +2,11 @@ use std::{fmt::Debug, sync::Arc}; use anyhow::Result; use async_trait::async_trait; +use celo_genesis::CeloRollupConfig; use hana_celestia::{CelestiaDADataSource, CelestiaDASource}; use hana_oracle::provider::OracleCelestiaProvider; use kona_derive::{sources::EthereumDataSource, traits::BlobProvider}; use kona_driver::PipelineCursor; -use kona_genesis::RollupConfig; use kona_preimage::CommsClient; use kona_proof::{ l1::{OracleL1ChainProvider, OraclePipeline}, @@ -49,21 +49,24 @@ where async fn create_pipeline( &self, - rollup_config: Arc, + rollup_config: Arc, cursor: Arc>, oracle: Arc, beacon: Self::B, l1_provider: Self::L1, l2_provider: Self::L2, ) -> Result> { - let ethereum_data_source = - EthereumDataSource::new_from_parts(l1_provider.clone(), beacon, &rollup_config); + let ethereum_data_source = EthereumDataSource::new_from_parts( + l1_provider.clone(), + beacon, + &rollup_config.op_rollup_config, + ); let celestia_data_source = CelestiaDASource::new(OracleCelestiaProvider::new(oracle.clone())); let da_provider = CelestiaDADataSource::new(ethereum_data_source, celestia_data_source); Ok(OraclePipeline::new( - rollup_config, + Arc::new(rollup_config.op_rollup_config.clone()), cursor, oracle, da_provider, diff --git a/utils/celestia/host/src/blobstream_utils.rs b/utils/celestia/host/src/blobstream_utils.rs index 8ba0ea402..eafe56563 100644 --- a/utils/celestia/host/src/blobstream_utils.rs +++ b/utils/celestia/host/src/blobstream_utils.rs @@ -81,7 +81,7 @@ pub fn extract_celestia_height(tx: &EthTransaction) -> Result> { /// Get the latest Celestia block height that has been committed to Ethereum via Blobstream. pub async fn get_latest_blobstream_celestia_block(fetcher: &OPSuccinctDataFetcher) -> Result { let blobstream_contract = SP1Blobstream::new( - blobstream_address(fetcher.rollup_config.as_ref().unwrap().l1_chain_id) + blobstream_address(fetcher.rollup_config.as_ref().unwrap().op_rollup_config.l1_chain_id) .expect("Failed to fetch blobstream contract address"), fetcher.l1_provider.clone(), ); @@ -122,8 +122,9 @@ pub async fn get_celestia_safe_head_info( let rollup_config = fetcher.rollup_config.as_ref().ok_or_else(|| anyhow!("Rollup config not found"))?; - let batch_inbox_address = rollup_config.batch_inbox_address; + let batch_inbox_address = rollup_config.op_rollup_config.batch_inbox_address; let batcher_address = rollup_config + .op_rollup_config .genesis .system_config .as_ref() diff --git a/utils/client/Cargo.toml b/utils/client/Cargo.toml index b598c0800..a5b8afbdc 100644 --- a/utils/client/Cargo.toml +++ b/utils/client/Cargo.toml @@ -39,6 +39,7 @@ kona-genesis.workspace = true celo-proof.workspace = true celo-driver.workspace = true celo-protocol.workspace = true +celo-genesis.workspace = true # general anyhow.workspace = true diff --git a/utils/client/src/boot.rs b/utils/client/src/boot.rs index e007f441a..fda22851c 100644 --- a/utils/client/src/boot.rs +++ b/utils/client/src/boot.rs @@ -3,7 +3,7 @@ use alloy_primitives::B256; use alloy_sol_types::sol; -use kona_genesis::RollupConfig; +use celo_genesis::{CeloHardForkConfig, CeloRollupConfig}; use kona_proof::BootInfo; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; @@ -14,7 +14,7 @@ pub const AGGREGATION_OUTPUTS_SIZE: usize = 6 * 32; /// Hash the serialized rollup config using SHA256. Note: The rollup config is never unrolled /// on-chain, so switching to a different hash function is not a concern, as long as the config hash /// is consistent with the one on the contract. -pub fn hash_rollup_config(config: &RollupConfig) -> B256 { +pub fn hash_rollup_config(config: &CeloRollupConfig) -> B256 { let serialized_config = serde_json::to_string_pretty(config).unwrap(); // Create a SHA256 hasher @@ -41,12 +41,20 @@ sol! { impl From for BootInfoStruct { fn from(boot_info: BootInfo) -> Self { + // Wrap RollupConfig with CeloRollupConfig + let celo_rollup_config = CeloRollupConfig { + op_rollup_config: boot_info.rollup_config.clone(), + hardforks: CeloHardForkConfig { + op_hardfork_config: boot_info.rollup_config.hardforks, + cel2_time: Some(0), + }, + }; BootInfoStruct { l1Head: boot_info.l1_head, l2PreRoot: boot_info.agreed_l2_output_root, l2PostRoot: boot_info.claimed_l2_output_root, l2BlockNumber: boot_info.claimed_l2_block_number, - rollupConfigHash: hash_rollup_config(&boot_info.rollup_config), + rollupConfigHash: hash_rollup_config(&celo_rollup_config), } } } diff --git a/utils/client/src/client.rs b/utils/client/src/client.rs index f30090769..a51f11f00 100644 --- a/utils/client/src/client.rs +++ b/utils/client/src/client.rs @@ -5,6 +5,7 @@ use anyhow::Result; use celo_alloy_consensus::{CeloBlock, CeloTxEnvelope, CeloTxType}; use celo_alloy_rpc_types_engine::CeloPayloadAttributes; use celo_driver::{CeloDriver, CeloExecutorTr}; +use celo_genesis::CeloRollupConfig; use celo_protocol::CeloL2BlockInfo; use kona_derive::{ errors::{PipelineError, PipelineErrorKind}, @@ -12,7 +13,6 @@ use kona_derive::{ types::Signal, }; use kona_driver::{DriverError, DriverPipeline, DriverResult, TipCursor}; -use kona_genesis::RollupConfig; use kona_preimage::{CommsClient, PreimageKey}; use kona_proof::{errors::OracleProviderError, HintType}; use kona_protocol::{L2BlockInfo, OpAttributesWithParent}; @@ -57,7 +57,7 @@ where /// - `Err(e)` - An error if the block could not be produced. pub async fn advance_to_target( driver: &mut CeloDriver, - cfg: &RollupConfig, + cfg: &CeloRollupConfig, mut target: Option, ) -> DriverResult<(L2BlockInfo, B256), E::Error> where diff --git a/utils/client/src/witness/executor.rs b/utils/client/src/witness/executor.rs index ca50c8e7e..c0c8291fa 100644 --- a/utils/client/src/witness/executor.rs +++ b/utils/client/src/witness/executor.rs @@ -3,6 +3,7 @@ use alloy_primitives::Sealed; use anyhow::{anyhow, Result}; use async_trait::async_trait; use celo_driver::CeloDriver; +use celo_genesis::{CeloHardForkConfig, CeloRollupConfig}; use celo_proof::executor::CeloExecutor; use kona_derive::traits::{ BlobProvider, ChainProvider, DataAvailabilityProvider, L2ChainProvider, Pipeline, @@ -10,7 +11,6 @@ use kona_derive::traits::{ }; use kona_driver::{DriverPipeline, PipelineCursor}; use kona_executor::TrieDBProvider; -use kona_genesis::RollupConfig; use kona_preimage::CommsClient; use kona_proof::{ l1::{OracleL1ChainProvider, OraclePipeline}, @@ -107,7 +107,7 @@ pub trait WitnessExecutor { // Constructs the derivation pipeline. async fn create_pipeline( &self, - rollup_config: Arc, + rollup_config: Arc, cursor: Arc>, oracle: Arc, beacon: Self::B, @@ -131,10 +131,18 @@ pub trait WitnessExecutor { { let boot_clone = boot.clone(); - let rollup_config = Arc::new(boot.rollup_config); - + // Wrap RollupConfig with CeloRollupConfig + let celo_hardforks = CeloHardForkConfig { + op_hardfork_config: boot.rollup_config.hardforks, + cel2_time: Some(0), + }; + let celo_rollup_config = CeloRollupConfig { + op_rollup_config: boot.rollup_config.clone(), + hardforks: celo_hardforks, + }; + let celo_rollup_config = Arc::new(celo_rollup_config); let executor = CeloExecutor::new( - rollup_config.as_ref(), + celo_rollup_config.as_ref(), l2_provider.clone(), l2_provider, CeloEvmFactory::default(), @@ -149,7 +157,7 @@ pub trait WitnessExecutor { println!("cycle-tracker-report-start: block-execution-and-derivation"); let (safe_head, output_root) = advance_to_target( &mut driver, - rollup_config.as_ref(), + celo_rollup_config.as_ref(), Some(boot.claimed_l2_block_number), ) .await?; @@ -179,7 +187,7 @@ pub trait WitnessExecutor { #[cfg(target_os = "zkvm")] { std::mem::forget(driver); - std::mem::forget(rollup_config); + std::mem::forget(celo_rollup_config); } Ok(boot_clone) diff --git a/utils/ethereum/client/Cargo.toml b/utils/ethereum/client/Cargo.toml index fa4d6efee..61fd6f424 100644 --- a/utils/ethereum/client/Cargo.toml +++ b/utils/ethereum/client/Cargo.toml @@ -16,6 +16,9 @@ kona-genesis.workspace = true kona-preimage.workspace = true kona-proof.workspace = true +# celo-kona +celo-genesis.workspace = true + # general anyhow.workspace = true async-trait.workspace = true diff --git a/utils/ethereum/client/src/executor.rs b/utils/ethereum/client/src/executor.rs index 0c73aad2f..bd32a2aea 100644 --- a/utils/ethereum/client/src/executor.rs +++ b/utils/ethereum/client/src/executor.rs @@ -2,9 +2,9 @@ use std::{fmt::Debug, sync::Arc}; use anyhow::Result; use async_trait::async_trait; +use celo_genesis::CeloRollupConfig; use kona_derive::{sources::EthereumDataSource, traits::BlobProvider}; use kona_driver::PipelineCursor; -use kona_genesis::RollupConfig; use kona_preimage::CommsClient; use kona_proof::{ l1::{OracleL1ChainProvider, OraclePipeline}, @@ -47,17 +47,20 @@ where async fn create_pipeline( &self, - rollup_config: Arc, + rollup_config: Arc, cursor: Arc>, oracle: Arc, beacon: Self::B, l1_provider: Self::L1, l2_provider: Self::L2, ) -> Result> { - let da_provider = - EthereumDataSource::new_from_parts(l1_provider.clone(), beacon, &rollup_config); + let da_provider = EthereumDataSource::new_from_parts( + l1_provider.clone(), + beacon, + &rollup_config.op_rollup_config, + ); Ok(OraclePipeline::new( - rollup_config, + Arc::new(rollup_config.op_rollup_config.clone()), cursor, oracle, da_provider, diff --git a/utils/host/Cargo.toml b/utils/host/Cargo.toml index e759ffecf..502999ac4 100644 --- a/utils/host/Cargo.toml +++ b/utils/host/Cargo.toml @@ -33,6 +33,7 @@ kona-rpc.workspace = true # celo-kona celo-host.workspace = true celo-protocol.workspace = true +celo-genesis.workspace = true # hana hana-host.workspace = true diff --git a/utils/host/src/fetcher.rs b/utils/host/src/fetcher.rs index ebde9d92e..f53425c2f 100644 --- a/utils/host/src/fetcher.rs +++ b/utils/host/src/fetcher.rs @@ -16,10 +16,10 @@ use alloy_sol_types::SolValue; use anyhow::{bail, Result}; use celo_alloy_consensus::CeloBlock; use celo_alloy_network::Celo; +use celo_genesis::CeloRollupConfig; use celo_host::single::CeloSingleChainHost; use celo_protocol::CeloL2BlockInfo; use futures::{stream, StreamExt}; -use kona_genesis::RollupConfig; use kona_host::single::SingleChainHost; use kona_rpc::{OutputResponse, SafeHeadResponse}; use op_alloy_network::{primitives::HeaderResponse, BlockResponse, Network}; @@ -38,7 +38,7 @@ pub struct OPSuccinctDataFetcher { pub rpc_config: RPCConfig, pub l1_provider: Arc, pub l2_provider: Arc>, - pub rollup_config: Option, + pub rollup_config: Option, pub rollup_config_path: Option, } @@ -326,8 +326,8 @@ impl OPSuccinctDataFetcher { /// Fetch and save the rollup config to a temporary file. async fn fetch_and_save_rollup_config( rpc_config: &RPCConfig, - ) -> Result<(RollupConfig, PathBuf)> { - let rollup_config: RollupConfig = + ) -> Result<(CeloRollupConfig, PathBuf)> { + let rollup_config: CeloRollupConfig = Self::fetch_rpc_data(&rpc_config.l2_node_rpc, "optimism_rollupConfig", vec![]).await?; // Create configs directory if it doesn't exist @@ -336,10 +336,75 @@ impl OPSuccinctDataFetcher { // Save rollup config to a file named by chain ID let rollup_config_path = - rollup_config_dir.join(format!("{}.json", rollup_config.l2_chain_id)); + rollup_config_dir.join(format!("{}.json", rollup_config.op_rollup_config.l2_chain_id)); + // TODO: find cleaner way // Write the rollup config to the file - let rollup_config_str = serde_json::to_string_pretty(&rollup_config)?; + let rollup_config_str = { + // Manually construct the JSON to match the RPC response format + let full_config = serde_json::json!({ + "genesis": { + "l1": { + "hash": format!("0x{:x}", rollup_config.op_rollup_config.genesis.l1.hash), + "number": rollup_config.op_rollup_config.genesis.l1.number, + }, + "l2": { + "hash": format!("0x{:x}", rollup_config.op_rollup_config.genesis.l2.hash), + "number": rollup_config.op_rollup_config.genesis.l2.number, + }, + "l2_time": rollup_config.op_rollup_config.genesis.l2_time, + "system_config": rollup_config.op_rollup_config.genesis.system_config.as_ref().map(|sc| { + serde_json::json!({ + "batcherAddr": format!("0x{:x}", sc.batcher_address), + "overhead": format!("0x{:064x}", sc.overhead), + "scalar": format!("0x{:064x}", sc.scalar), + "gasLimit": sc.gas_limit, + "eip1559Params": format!("0x{:016x}", + (sc.eip1559_denominator.unwrap_or(0) as u64) | + ((sc.eip1559_elasticity.unwrap_or(0) as u64) << 8) + ), + "operatorFeeParams": format!("0x{:064x}", + (sc.operator_fee_scalar.unwrap_or(0) as u128) | + ((sc.operator_fee_constant.unwrap_or(0) as u128) << 64) + ), + }) + }), + }, + "block_time": rollup_config.op_rollup_config.block_time, + "max_sequencer_drift": rollup_config.op_rollup_config.max_sequencer_drift, + "seq_window_size": rollup_config.op_rollup_config.seq_window_size, + "channel_timeout": rollup_config.op_rollup_config.channel_timeout, + "l1_chain_id": rollup_config.op_rollup_config.l1_chain_id, + "l2_chain_id": rollup_config.op_rollup_config.l2_chain_id, + "regolith_time": rollup_config.op_rollup_config.hardforks.regolith_time.unwrap_or(0), + // "cel2_time": rollup_config.hardforks.cel2_time.unwrap_or(0), + "canyon_time": rollup_config.op_rollup_config.hardforks.canyon_time.unwrap_or(0), + "delta_time": rollup_config.op_rollup_config.hardforks.delta_time.unwrap_or(0), + "ecotone_time": rollup_config.op_rollup_config.hardforks.ecotone_time.unwrap_or(0), + "fjord_time": rollup_config.op_rollup_config.hardforks.fjord_time.unwrap_or(0), + "granite_time": rollup_config.op_rollup_config.hardforks.granite_time.unwrap_or(0), + "holocene_time": rollup_config.op_rollup_config.hardforks.holocene_time.unwrap_or(0), + "isthmus_time": rollup_config.op_rollup_config.hardforks.isthmus_time.unwrap_or(0), + "batch_inbox_address": format!("0x{:x}", rollup_config.op_rollup_config.batch_inbox_address), + "deposit_contract_address": format!("0x{:x}", rollup_config.op_rollup_config.deposit_contract_address), + "l1_system_config_address": format!("0x{:x}", rollup_config.op_rollup_config.l1_system_config_address), + "protocol_versions_address": format!("0x{:x}", rollup_config.op_rollup_config.protocol_versions_address), + "chain_op_config": { + "eip1559Elasticity": rollup_config.op_rollup_config.chain_op_config.eip1559_elasticity, + "eip1559Denominator": rollup_config.op_rollup_config.chain_op_config.eip1559_denominator, + "eip1559DenominatorCanyon": rollup_config.op_rollup_config.chain_op_config.eip1559_denominator_canyon, + }, + "alt_da": rollup_config.op_rollup_config.alt_da_config.as_ref().map(|alt_da| { + serde_json::json!({ + "da_challenge_contract_address": alt_da.da_challenge_address.map(|addr| format!("0x{addr:x}")), + "da_commitment_type": alt_da.da_commitment_type.as_deref(), + "da_challenge_window": alt_da.da_challenge_window, + "da_resolve_window": alt_da.da_resolve_window, + }) + }), + }); + serde_json::to_string_pretty(&full_config)? + }; fs::write(&rollup_config_path, rollup_config_str)?; // Return both the rollup config and the path to the temporary file @@ -585,7 +650,7 @@ impl OPSuccinctDataFetcher { if self.rollup_config.is_none() { return Err(anyhow::anyhow!("Rollup config not loaded.")); } - let genesis = self.rollup_config.as_ref().unwrap().genesis; + let genesis = self.rollup_config.as_ref().unwrap().op_rollup_config.genesis; let block = self.get_l2_block_by_number(block_number).await?; Ok(CeloL2BlockInfo::from_block_and_genesis(&block, &genesis)?) } diff --git a/utils/host/src/witness_generation/traits.rs b/utils/host/src/witness_generation/traits.rs index 40e370d44..b21992de9 100644 --- a/utils/host/src/witness_generation/traits.rs +++ b/utils/host/src/witness_generation/traits.rs @@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex}; use anyhow::Result; use async_trait::async_trait; +use celo_genesis::{CeloHardForkConfig, CeloRollupConfig}; use kona_preimage::{HintWriter, NativeChannel, OracleReader}; use kona_proof::{ l1::{OracleBlobProvider, OracleL1ChainProvider}, @@ -56,10 +57,18 @@ pub trait WitnessGenerator { let (boot_info, input) = get_inputs_for_pipeline(oracle.clone()).await.unwrap(); if let Some((cursor, l1_provider, l2_provider)) = input { let rollup_config = Arc::new(boot_info.rollup_config.clone()); + // Wrap RollupConfig with CeloRollupConfig + let celo_rollup_config = CeloRollupConfig { + op_rollup_config: boot_info.rollup_config.clone(), + hardforks: CeloHardForkConfig { + op_hardfork_config: rollup_config.hardforks, + cel2_time: Some(0), + }, + }; let pipeline = self .get_executor() .create_pipeline( - rollup_config, + Arc::new(celo_rollup_config), cursor.clone(), oracle.clone(), beacon,