diff --git a/Cargo.lock b/Cargo.lock index de7e8d84..2425e1dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -756,12 +756,13 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9703ce68b97f8faae6f7739d1e003fc97621b856953cbcdbb2b515743f23288" +checksum = "cdd7f8b3a7c65ca09b3c7bdd7c7d72d7423d026f5247eda96af53d24e58315c1" dependencies = [ "alloy-primitives 0.8.8", "alloy-rlp", + "arrayvec", "derive_more 1.0.0", "nybbles", "smallvec", @@ -2490,11 +2491,8 @@ dependencies = [ name = "fault-proof" version = "0.1.0" dependencies = [ - "alloy-consensus", "cfg-if", "kona-client", - "kona-executor", - "kona-primitives", "op-alloy-genesis", "op-alloy-rpc-types-engine", "op-succinct-client-utils", @@ -3417,7 +3415,7 @@ dependencies = [ [[package]] name = "kona-client" version = "0.1.0" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-eips", @@ -3450,7 +3448,7 @@ dependencies = [ [[package]] name = "kona-common" version = "0.0.3" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "cfg-if", "linked_list_allocator", @@ -3460,7 +3458,7 @@ dependencies = [ [[package]] name = "kona-common-proc" version = "0.0.3" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "anyhow", "cfg-if", @@ -3473,7 +3471,7 @@ dependencies = [ [[package]] name = "kona-derive" version = "0.0.3" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloc-no-stdlib", "alloy-consensus", @@ -3499,7 +3497,7 @@ dependencies = [ [[package]] name = "kona-executor" version = "0.0.2" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-eips", @@ -3516,7 +3514,7 @@ dependencies = [ [[package]] name = "kona-host" version = "0.1.0" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-eips", @@ -3553,7 +3551,7 @@ dependencies = [ [[package]] name = "kona-mpt" version = "0.0.3" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-primitives 0.8.8", @@ -3568,7 +3566,7 @@ dependencies = [ [[package]] name = "kona-preimage" version = "0.0.3" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-primitives 0.8.8", "async-trait", @@ -3581,7 +3579,7 @@ dependencies = [ [[package]] name = "kona-primitives" version = "0.0.2" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-eips", "alloy-primitives 0.8.8", @@ -3597,7 +3595,7 @@ dependencies = [ [[package]] name = "kona-providers" version = "0.0.1" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-primitives 0.8.8", @@ -3610,7 +3608,7 @@ dependencies = [ [[package]] name = "kona-providers-alloy" version = "0.0.1" -source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#4be3cb46d530b1637465167c6a6a661ff0b9466c" +source = "git+https://github.com/moongate-forks/kona?branch=ratan/native-client-command-bugged#3bc68a45997d1743e37df7d455dbdf416c6874a5" dependencies = [ "alloy-consensus", "alloy-eips", @@ -3683,7 +3681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -4073,7 +4071,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 2.0.79", @@ -4212,9 +4210,9 @@ dependencies = [ "kona-client", "kona-common", "kona-derive", + "kona-executor", "kona-mpt", "kona-preimage", - "kona-primitives", "kzg-rs", "log", "op-alloy-consensus", @@ -4241,8 +4239,6 @@ dependencies = [ "dotenv", "futures", "kona-host", - "kona-primitives", - "log", "num-format", "op-alloy-genesis", "op-alloy-rpc-types", @@ -4286,8 +4282,6 @@ dependencies = [ "clap", "csv", "dotenv", - "num-format", - "op-alloy-genesis", "op-succinct-client-utils", "op-succinct-host-utils", "sp1-build", @@ -5234,9 +5228,7 @@ dependencies = [ "alloy-eips", "cfg-if", "kona-client", - "kona-derive", "kona-executor", - "kona-primitives", "log", "op-alloy-consensus", "op-alloy-genesis", @@ -7752,7 +7744,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/configs/808813/rollup.json b/configs/808813/rollup.json new file mode 100644 index 00000000..ca50cebe --- /dev/null +++ b/configs/808813/rollup.json @@ -0,0 +1,48 @@ +{ + "genesis": { + "l1": { + "number": 6404314, + "hash": "0x3908ceae1d5aa3135f57fa1017231bb62c2e661e966a68fe80fd7dff0a2e7564" + }, + "l2": { + "number": 0, + "hash": "0xa286e5b6f82269ac1477f4136c09fb5c2ac9f005837ed2852610fc3e559b7256" + }, + "l2_time": 1722352488, + "system_config": { + "batcherAddr": "0x0c2ac914b2378e5afaecbab08a171c769d34947c", + "overhead": "0xbc", + "scalar": "0xa6fe0", + "gasLimit": 30000000, + "baseFeeScalar": null, + "blobBaseFeeScalar": null, + "eip1559Denominator": null, + "eip1559Elasticity": null + } + }, + "block_time": 2, + "max_sequencer_drift": 600, + "seq_window_size": 3600, + "channel_timeout": 300, + "granite_channel_timeout": 50, + "l1_chain_id": 11155111, + "l2_chain_id": 808813, + "base_fee_params": { + "max_change_denominator": "0x32", + "elasticity_multiplier": "0x6" + }, + "canyon_base_fee_params": { + "max_change_denominator": "0xfa", + "elasticity_multiplier": "0x6" + }, + "regolith_time": 0, + "canyon_time": 0, + "delta_time": 0, + "ecotone_time": 0, + "fjord_time": 0, + "granite_time": 1725984001, + "batch_inbox_address": "0x734dde12fd466c14a85de838788efe6f1993c84c", + "deposit_contract_address": "0xbaaf3bafdbd660380938b27d21c31bb7d072a799", + "l1_system_config_address": "0x3974436fa4bb4deb5a04ace51a704b10ff5a1f25", + "protocol_versions_address": "0x0000000000000000000000000000000000000000" +} \ No newline at end of file diff --git a/elf/aggregation-elf b/elf/aggregation-elf index c820f6d1..26279c57 100755 Binary files a/elf/aggregation-elf and b/elf/aggregation-elf differ diff --git a/elf/fault-proof-elf b/elf/fault-proof-elf index 8d59b1bb..ad8b6cc3 100755 Binary files a/elf/fault-proof-elf and b/elf/fault-proof-elf differ diff --git a/elf/range-elf b/elf/range-elf index e176ee0a..40405ab7 100755 Binary files a/elf/range-elf and b/elf/range-elf differ diff --git a/programs/fault-proof/Cargo.toml b/programs/fault-proof/Cargo.toml index 2aeee892..54546508 100644 --- a/programs/fault-proof/Cargo.toml +++ b/programs/fault-proof/Cargo.toml @@ -11,15 +11,10 @@ homepage.workspace = true cfg-if.workspace = true serde_json.workspace = true -# workspace (ethereum) -alloy-consensus.workspace = true - # sp1 sp1-zkvm = { workspace = true } # kona -kona-primitives.workspace = true -kona-executor.workspace = true kona-client.workspace = true # op-succinct diff --git a/programs/range/Cargo.toml b/programs/range/Cargo.toml index 84b80f1c..93a9b1fe 100644 --- a/programs/range/Cargo.toml +++ b/programs/range/Cargo.toml @@ -22,10 +22,8 @@ alloy-eips.workspace = true sp1-zkvm.workspace = true # kona -kona-primitives.workspace = true kona-executor.workspace = true kona-client.workspace = true -kona-derive.workspace = true # op-succinct op-succinct-client-utils.workspace = true diff --git a/programs/range/src/main.rs b/programs/range/src/main.rs index c589ae57..aed6754a 100644 --- a/programs/range/src/main.rs +++ b/programs/range/src/main.rs @@ -19,7 +19,6 @@ use kona_client::{ l1::{OracleBlobProvider, OracleL1ChainProvider}, BootInfo, }; -use kona_executor::StatelessL2BlockExecutor; use log::info; use op_alloy_consensus::{OpBlock, OpTxEnvelope}; use op_succinct_client_utils::{ @@ -117,14 +116,13 @@ fn main() { println!("cycle-tracker-report-end: payload-derivation"); println!("cycle-tracker-start: execution-instantiation"); - let mut executor = StatelessL2BlockExecutor::builder( + let mut executor = driver.new_executor( &boot.rollup_config, - l2_provider.clone(), - l2_provider.clone(), - ) - .with_parent_header(driver.clone_l2_safe_head_header()) - .with_handle_register(zkvm_handle_register) - .build(); + &l2_provider, + &l2_provider, + zkvm_handle_register, + ); + println!("cycle-tracker-end: execution-instantiation"); let mut l2_block_info; diff --git a/scripts/prove/Cargo.toml b/scripts/prove/Cargo.toml index 33b857df..bbb9215c 100644 --- a/scripts/prove/Cargo.toml +++ b/scripts/prove/Cargo.toml @@ -27,16 +27,12 @@ clap = { workspace = true } cargo_metadata = { workspace = true } anyhow.workspace = true dotenv.workspace = true -num-format.workspace = true csv.workspace = true # local op-succinct-host-utils.workspace = true op-succinct-client-utils.workspace = true -# op-alloy -op-alloy-genesis.workspace = true - # sp1 sp1-sdk = { workspace = true } diff --git a/scripts/prove/build.rs b/scripts/prove/build.rs index e5dceac0..70986d3d 100644 --- a/scripts/prove/build.rs +++ b/scripts/prove/build.rs @@ -59,7 +59,8 @@ fn build_zkvm_program(program: &str) { &format!("../../programs/{}", program), BuildArgs { elf_name: format!("{}-elf", program), - // docker: true, + docker: true, + tag: "v3.0.0-rc4".to_string(), ..Default::default() }, ); diff --git a/utils/client/Cargo.toml b/utils/client/Cargo.toml index 6b9feea8..d737bbeb 100644 --- a/utils/client/Cargo.toml +++ b/utils/client/Cargo.toml @@ -26,12 +26,11 @@ op-alloy-rpc-types-engine.workspace = true # workspace (kona) kona-common.workspace = true -kona-primitives.workspace = true kona-client.workspace = true kona-preimage.workspace = true kona-mpt.workspace = true kona-derive.workspace = true - +kona-executor.workspace = true # general serde.workspace = true rkyv.workspace = true diff --git a/utils/client/src/driver.rs b/utils/client/src/driver.rs index 0c368095..9fbc2d1f 100644 --- a/utils/client/src/driver.rs +++ b/utils/client/src/driver.rs @@ -14,18 +14,20 @@ use kona_client::{ }; use kona_derive::{ attributes::StatefulAttributesBuilder, - errors::PipelineErrorKind, + errors::{PipelineErrorKind, ResetError}, pipeline::{DerivationPipeline, Pipeline, PipelineBuilder, StepResult}, prelude::{ChainProvider, L2ChainProvider}, sources::EthereumDataSource, stages::{ - AttributesQueue, BatchQueue, BatchStream, ChannelBank, ChannelReader, FrameQueue, + AttributesQueue, BatchQueue, BatchStream, ChannelProvider, ChannelReader, FrameQueue, L1Retrieval, L1Traversal, }, - traits::{OriginProvider, Signal}, + traits::{ActivationSignal, OriginProvider, ResetSignal, SignalReceiver}, }; -use kona_mpt::TrieProvider; +use kona_executor::{KonaHandleRegister, StatelessL2BlockExecutor}; +use kona_mpt::{TrieHinter, TrieProvider}; use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType}; +use op_alloy_genesis::RollupConfig; use op_alloy_protocol::{BlockInfo, L2BlockInfo}; use op_alloy_rpc_types_engine::OpAttributesWithParent; @@ -51,7 +53,9 @@ pub type MultiblockOracleAttributesQueue = AttributesQueue< BatchQueue< BatchStream< ChannelReader< - ChannelBank>>>>, + ChannelProvider< + FrameQueue>>>, + >, >, MultiblockOracleL2ChainProvider, >, @@ -67,6 +71,11 @@ pub type MultiblockOracleAttributesQueue = AttributesQueue< /// oracle-based data sources. /// /// [L2PayloadAttributes]: kona_derive::types::L2PayloadAttributes +/// +/// Note: Closely mirrors the implementation of: +/// https://github.com/anton-rs/kona/blob/main/bin/client/src/l1/driver.rs. The only difference is +/// the addition of the `l2_claim_block` field, which is used to determine the final L2 block that +/// the driver should produce payloads for. #[derive(Debug)] pub struct MultiBlockDerivationDriver { /// The current L2 safe head. @@ -80,9 +89,19 @@ pub struct MultiBlockDerivationDriver { } impl MultiBlockDerivationDriver { + /// Returns the current L2 safe head [L2BlockInfo]. + pub fn l2_safe_head(&self) -> &L2BlockInfo { + &self.l2_safe_head + } + + /// Returns the [Header] of the current L2 safe head. + pub fn l2_safe_head_header(&self) -> &Sealed
{ + &self.l2_safe_head_header + } + /// Consumes self and returns the owned [Header] of the current L2 safe head. - pub fn clone_l2_safe_head_header(&self) -> Sealed
{ - self.l2_safe_head_header.clone() + pub fn take_l2_safe_head_header(self) -> Sealed
{ + self.l2_safe_head_header } /// Creates a new [MultiBlockDerivationDriver] with the given configuration, blob provider, and @@ -121,6 +140,20 @@ impl MultiBlockDerivationDriver { chain_provider.clone(), ); let dap = EthereumDataSource::new(chain_provider.clone(), blob_provider, &cfg); + + // Walk back the starting L1 block by `channel_timeout` to ensure that the full channel is + // captured. + let channel_timeout = boot_info + .rollup_config + .channel_timeout(l2_safe_head.block_info.timestamp); + let mut l1_origin_number = l1_origin.number.saturating_sub(channel_timeout); + if l1_origin_number < boot_info.rollup_config.genesis.l1.number { + l1_origin_number = boot_info.rollup_config.genesis.l1.number; + } + let l1_origin = chain_provider + .block_info_by_number(l1_origin_number) + .await?; + let pipeline = PipelineBuilder::new() .rollup_config(cfg) .dap_source(dap) @@ -169,18 +202,38 @@ impl MultiBlockDerivationDriver { // stages can make progress. match e { PipelineErrorKind::Temporary(_) => { /* continue */ } - PipelineErrorKind::Reset(_) => { - // Reset the pipeline to the initial L2 safe head and L1 origin, - // and try again. - self.pipeline - .signal(Signal::Reset { - l2_safe_head: self.l2_safe_head, - l1_origin: self - .pipeline - .origin() - .ok_or_else(|| anyhow!("Missing L1 origin"))?, - }) - .await?; + PipelineErrorKind::Reset(e) => { + if matches!(e, ResetError::HoloceneActivation) { + self.pipeline + .signal( + ActivationSignal { + l2_safe_head: self.l2_safe_head, + l1_origin: self + .pipeline + .origin() + .ok_or_else(|| anyhow!("Missing L1 origin"))?, + system_config: None, + } + .signal(), + ) + .await?; + } else { + // Reset the pipeline to the initial L2 safe head and L1 origin, + // and try again. + self.pipeline + .signal( + ResetSignal { + l2_safe_head: self.l2_safe_head, + l1_origin: self + .pipeline + .origin() + .ok_or_else(|| anyhow!("Missing L1 origin"))?, + system_config: None, + } + .signal(), + ) + .await?; + } } PipelineErrorKind::Critical(_) => return Err(e.into()), } @@ -219,15 +272,12 @@ impl MultiBlockDerivationDriver { let mut output_preimage = [0u8; 128]; caching_oracle .get_exact( - PreimageKey::new( - boot_info.agreed_l2_output_root.0, - PreimageKeyType::Keccak256, - ), + PreimageKey::new(*boot_info.agreed_l2_output_root, PreimageKeyType::Keccak256), &mut output_preimage, ) .await?; - let safe_hash: alloy_primitives::FixedBytes<32> = output_preimage[96..128] + let safe_hash = output_preimage[96..128] .try_into() .map_err(|_| anyhow!("Invalid L2 output root"))?; let safe_header = l2_chain_provider.header_by_hash(safe_hash)?; @@ -245,4 +295,28 @@ impl MultiBlockDerivationDriver { Sealed::new_unchecked(safe_header, safe_hash), )) } + + /// Returns a new [StatelessL2BlockExecutor] instance. + /// + /// ## Takes + /// - `cfg`: The rollup configuration. + /// - `provider`: The trie provider. + /// - `hinter`: The trie hinter. + /// - `handle_register`: The handle register for the EVM. + pub fn new_executor<'a, P, H>( + &mut self, + cfg: &'a RollupConfig, + provider: &P, + hinter: &H, + handle_register: KonaHandleRegister, + ) -> StatelessL2BlockExecutor<'a, P, H> + where + P: TrieProvider + Send + Sync + Clone, + H: TrieHinter + Send + Sync + Clone, + { + StatelessL2BlockExecutor::builder(cfg, provider.clone(), hinter.clone()) + .with_parent_header(self.l2_safe_head_header().clone()) + .with_handle_register(handle_register) + .build() + } } diff --git a/utils/host/Cargo.toml b/utils/host/Cargo.toml index 8632e113..289c0ee1 100644 --- a/utils/host/Cargo.toml +++ b/utils/host/Cargo.toml @@ -22,7 +22,6 @@ futures.workspace = true num-format.workspace = true serde.workspace = true reqwest.workspace = true -log.workspace = true # sp1 sp1-sdk.workspace = true @@ -36,4 +35,3 @@ op-alloy-rpc-types.workspace = true # kona kona-host.workspace = true -kona-primitives.workspace = true