Skip to content

Commit 9031a7c

Browse files
authored
feat: latest kona (#131)
* feat: latest kona * fmt * fix * feat: small fixes, new elfs * nit: rm build * clippy * docs
1 parent 21fddfa commit 9031a7c

26 files changed

+662
-422
lines changed

Cargo.lock

+463-296
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+17-13
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ tower-http = { version = "0.5.2", features = ["limit"] }
3737
kzg-rs = { version = "0.2.2" }
3838

3939
# kona
40-
kona-common = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
41-
kona-common-proc = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
42-
kona-preimage = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3", features = [
40+
# Note: This version of kona is from 9/24. Pin to this release until the new version of kona is released.
41+
kona-common = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
42+
kona-common-proc = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
43+
kona-preimage = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a", features = [
4344
"rkyv",
4445
] }
45-
kona-primitives = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
46-
kona-mpt = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
47-
kona-derive = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3", default-features = false }
48-
kona-executor = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
49-
kona-client = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
50-
kona-host = { git = "https://github.com/anton-rs/kona", tag = "kona-client-v0.1.0-alpha.3" }
46+
kona-primitives = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
47+
kona-mpt = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
48+
kona-derive = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a", default-features = false }
49+
kona-executor = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
50+
kona-client = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
51+
kona-host = { git = "https://github.com/anton-rs/kona", rev = "5d0e211ca1c271377fe184729761bcb217f1f60a" }
5152

5253
# op-succinct
5354
op-succinct-prove = { path = "scripts/prove" }
@@ -59,12 +60,15 @@ op-succinct-proposer = { path = "proposer/succinct" }
5960
# ethereum / op
6061
alloy = { version = "0.3", default-features = false, features = ["full"] }
6162
alloy-primitives = { version = "0.8", default-features = false }
62-
alloy-rlp = { version = "0.3", default-features = false }
63+
alloy-rlp = { version = "0.3.8", default-features = false }
6364
alloy-eips = { version = "0.3", default-features = false }
6465
revm = { version = "14.0", default-features = false, features = ["kzg-rs"] }
65-
alloy-consensus = { version = "0.3", default-features = false }
66+
alloy-consensus = { version = "0.3.6", default-features = false }
6667
alloy-sol-types = { version = "0.8" }
67-
op-alloy-consensus = { version = "0.2", default-features = false }
68+
op-alloy-consensus = { version = "0.2.12", default-features = false }
69+
op-alloy-genesis = { version = "0.2.12", default-features = false }
70+
op-alloy-protocol = { version = "0.2.12", default-features = false }
71+
op-alloy-rpc-types-engine = { version = "0.2.12", default-features = false }
6872

6973
# sp1
7074
sp1-lib = { version = "3.0.0-rc1", features = ["verify"] }
@@ -85,4 +89,4 @@ ecdsa = { git = "https://github.com/sp1-patches/signatures", branch = "patch-ecd
8589
bn = { git = "https://github.com/0xWOLAND/bn.git", package = "substrate-bn" }
8690
sha3 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", branch = "patch-sha3-v0.10.8" }
8791
# This patch uses sha3 instead of tiny-keccak. Reduces cycle count for Keccak by 50%.
88-
alloy-primitives = { git = "https://github.com/sp1-patches/alloy-core", branch = "patch-v0.8.0" }
92+
alloy-primitives = { git = "https://github.com/sp1-patches/alloy-core", branch = "patch-v0.8.3" }

book/getting-started/l2-output-oracle.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ Advanced users can set parameters manually in `opsuccinctl2ooconfig.json`, but t
4242

4343
| Parameter | Description |
4444
|-----------|-------------|
45-
| `proposer` | Ethereum address authorized to submit proofs. Default: `address(0)`, anyone can submit proofs. |
46-
| `challenger` | Ethereum address authorized to dispute proofs. Default: `address(0)`, no disputes. |
45+
| `owner` | Ethereum address of the contract owner. Default: The address of the account associated with `PRIVATE_KEY`. |
46+
| `proposer` | Ethereum address authorized to submit proofs. Default: The address of the account associated with `PRIVATE_KEY`. |
47+
| `challenger` | Ethereum address authorized to dispute proofs. Default: `address(0)`, no one can dispute proofs. |
4748
| `finalizationPeriod` | The time period (in seconds) after which a proposed output becomes finalized and withdrawals can be processed. Default: `0`. |
4849

4950
### 5) Deploy the `OPSuccinctL2OutputOracle` contract:

book/getting-started/proposer.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,31 @@ The modified proposer performs the following tasks:
1111

1212
We've packaged the `op-succinct-proposer` service in a docker-compose file to make it easier to run.
1313

14-
## 1) Build the Proposer Service
14+
## 1) Environment Setup
15+
16+
Before starting the proposer, the following environment variables should be in your `.env` file. You should have already set up your environment when you deployed the L2 Output Oracle. If you have not done so, follow the steps in the [L2 Output Oracle](./l2-output-oracle.md) section.
17+
18+
| Parameter | Description |
19+
|-----------|-------------|
20+
| `L1_RPC` | L1 Archive Node. |
21+
| `L1_BEACON_RPC` | L1 Consensus (Beacon) Node. |
22+
| `L2_RPC` | L2 Execution Node (`op-geth`). |
23+
| `L2_NODE_RPC` | L2 Rollup Node (`op-node`). |
24+
| `PROVER_NETWORK_RPC` | Default: `rpc.succinct.xyz`. |
25+
| `SP1_PRIVATE_KEY` | Key for the Succinct Prover Network. Get access [here](https://docs.succinct.xyz/generating-proofs/prover-network). |
26+
| `SP1_PROVER` | Default: `network`. Set to `network` to use the Succinct Prover Network. |
27+
| `PRIVATE_KEY` | Private key for the account that will be deploying the contract and posting output roots to L1. |
28+
| `L2OO_ADDRESS` | Address of the `OPSuccinctL2OutputOracle` contract. |
29+
30+
## 2) Build the Proposer Service
1531

1632
Build the docker images for the `op-succinct-proposer` service.
1733

1834
```bash
1935
docker compose build
2036
```
2137

22-
## 2) Run the Proposer
38+
## 3) Run the Proposer
2339

2440
This command launches the `op-succinct-proposer` service in the background. It launches two containers: one container that manages proof generation and another container that is a small fork of the original `op-proposer` service.
2541

elf/fault-proof-elf

-143 KB
Binary file not shown.

elf/range-elf

-335 KB
Binary file not shown.

programs/fault-proof/Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ kona-executor.workspace = true
2323
kona-client.workspace = true
2424

2525
# op-succinct
26-
op-succinct-client-utils.workspace = true
26+
op-succinct-client-utils.workspace = true
27+
28+
# op-alloy
29+
op-alloy-genesis.workspace = true
30+
op-alloy-rpc-types-engine.workspace = true

programs/fault-proof/src/main.rs

+11-25
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@ extern crate alloc;
1212

1313
use alloc::sync::Arc;
1414

15-
use alloy_consensus::Header;
1615
use cfg_if::cfg_if;
1716
use kona_client::{
1817
l1::{DerivationDriver, OracleBlobProvider, OracleL1ChainProvider},
1918
l2::OracleL2ChainProvider,
2019
BootInfo,
2120
};
22-
use kona_executor::StatelessL2BlockExecutor;
23-
use kona_primitives::L2AttributesWithParent;
2421
use op_succinct_client_utils::precompiles::zkvm_handle_register;
2522

2623
cfg_if! {
2724
if #[cfg(target_os = "zkvm")] {
2825
sp1_zkvm::entrypoint!(main);
2926
use op_succinct_client_utils::{InMemoryOracle, boot::BootInfoStruct, BootInfoWithBytesConfig};
30-
use kona_primitives::RollupConfig;
27+
use op_alloy_genesis::RollupConfig;
3128
use alloc::vec::Vec;
3229
use serde_json;
3330
} else {
@@ -103,28 +100,17 @@ fn main() {
103100
.unwrap();
104101
println!("cycle-tracker-end: derivation-instantiation");
105102

106-
println!("cycle-tracker-start: payload-derivation");
107-
let L2AttributesWithParent { attributes, .. } =
108-
driver.produce_disputed_payload().await.unwrap();
109-
println!("cycle-tracker-end: payload-derivation");
110-
111-
println!("cycle-tracker-start: execution-instantiation");
112-
let mut executor = StatelessL2BlockExecutor::builder(&boot.rollup_config)
113-
.with_parent_header(driver.take_l2_safe_head_header())
114-
.with_fetcher(l2_provider.clone())
115-
.with_hinter(l2_provider)
116-
.with_handle_register(zkvm_handle_register)
117-
.build()
103+
println!("cycle-tracker-start: produce-output");
104+
let (number, output_root) = driver
105+
.produce_output(
106+
&boot.rollup_config,
107+
&l2_provider.clone(),
108+
&l2_provider.clone(),
109+
zkvm_handle_register,
110+
)
111+
.await
118112
.unwrap();
119-
println!("cycle-tracker-end: execution-instantiation");
120-
121-
println!("cycle-tracker-start: execution");
122-
let Header { number, .. } = *executor.execute_payload(attributes).unwrap();
123-
println!("cycle-tracker-end: execution");
124-
125-
println!("cycle-tracker-start: output-root");
126-
let output_root = executor.compute_output_root().unwrap();
127-
println!("cycle-tracker-end: output-root");
113+
println!("cycle-tracker-end: produce-output");
128114

129115
////////////////////////////////////////////////////////////////
130116
// EPILOGUE //

programs/range/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ log.workspace = true
1414

1515
# workspace (ethereum)
1616
op-alloy-consensus.workspace = true
17+
op-alloy-genesis.workspace = true
1718
alloy-consensus.workspace = true
1819
alloy-eips.workspace = true
1920

@@ -24,6 +25,7 @@ sp1-zkvm.workspace = true
2425
kona-primitives.workspace = true
2526
kona-executor.workspace = true
2627
kona-client.workspace = true
28+
kona-derive.workspace = true
2729

2830
# op-succinct
2931
op-succinct-client-utils.workspace = true

programs/range/src/main.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use kona_client::{
1919
l1::{OracleBlobProvider, OracleL1ChainProvider},
2020
BootInfo,
2121
};
22+
use kona_derive::block::OpBlock;
2223
use kona_executor::StatelessL2BlockExecutor;
23-
use kona_primitives::{L2ExecutionPayloadEnvelope, OpBlock};
2424
use log::info;
2525
use op_alloy_consensus::OpTxEnvelope;
2626
use op_succinct_client_utils::{
@@ -32,7 +32,7 @@ cfg_if! {
3232
if #[cfg(target_os = "zkvm")] {
3333
sp1_zkvm::entrypoint!(main);
3434

35-
use kona_primitives::RollupConfig;
35+
use op_alloy_genesis::RollupConfig;
3636
use op_succinct_client_utils::{
3737
BootInfoWithBytesConfig, boot::BootInfoStruct,
3838
InMemoryOracle
@@ -118,13 +118,14 @@ fn main() {
118118
println!("cycle-tracker-report-end: payload-derivation");
119119

120120
println!("cycle-tracker-start: execution-instantiation");
121-
let mut executor = StatelessL2BlockExecutor::builder(&boot.rollup_config)
122-
.with_parent_header(driver.clone_l2_safe_head_header())
123-
.with_fetcher(l2_provider.clone())
124-
.with_hinter(l2_provider.clone())
125-
.with_handle_register(zkvm_handle_register)
126-
.build()
127-
.unwrap();
121+
let mut executor = StatelessL2BlockExecutor::builder(
122+
&boot.rollup_config,
123+
l2_provider.clone(),
124+
l2_provider.clone(),
125+
)
126+
.with_parent_header(driver.clone_l2_safe_head_header())
127+
.with_handle_register(zkvm_handle_register)
128+
.build();
128129
println!("cycle-tracker-end: execution-instantiation");
129130

130131
let mut l2_block_info;
@@ -144,11 +145,12 @@ fn main() {
144145
}
145146

146147
// Generate the Payload Envelope, which can be used to derive cached data.
147-
let l2_payload_envelope: L2ExecutionPayloadEnvelope = OpBlock {
148+
let optimism_block = OpBlock {
148149
header: new_block_header.clone(),
149150
body: payload
150151
.attributes
151152
.transactions
153+
.unwrap()
152154
.iter()
153155
.map(|raw_tx| OpTxEnvelope::decode_2718(&mut raw_tx.as_ref()).unwrap())
154156
.collect::<Vec<OpTxEnvelope>>(),
@@ -157,12 +159,10 @@ fn main() {
157159
.is_canyon_active(new_block_header.timestamp)
158160
.then(Vec::new),
159161
..Default::default()
160-
}
161-
.into();
162-
162+
};
163163
// Add all data from this block's execution to the cache.
164164
l2_block_info = l2_provider
165-
.update_cache(new_block_header, l2_payload_envelope, &boot.rollup_config)
165+
.update_cache(new_block_header, optimism_block, &boot.rollup_config)
166166
.unwrap();
167167

168168
// Update data for the next iteration.

rollup-configs/10.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"genesis": {
33
"l1": {
4-
"hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108",
5-
"number": "0x109d8fe"
4+
"number": 17422590,
5+
"hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"
66
},
77
"l2": {
8-
"hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3",
9-
"number": "0x645c277"
8+
"number": 105235063,
9+
"hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"
1010
},
1111
"l2_time": 1686068903,
1212
"system_config": {

rollup-configs/288882.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"genesis": {
3+
"l1": {
4+
"number": 6576100,
5+
"hash": "0xb6404ecff691edd6895c474f4dfca5b3e27b92a19deabd80cbe05c75c1b4c924"
6+
},
7+
"l2": {
8+
"number": 0,
9+
"hash": "0xe919706177d2c568ed21a4b443d421c8098b4e453a29bd432258fab3f7fe1d07"
10+
},
11+
"l2_time": 1724692140,
12+
"system_config": {
13+
"batcherAddr": "0xe40d3fb61a6a9e16ffd17ae4ed225de00a4b16fd",
14+
"overhead": "0x834",
15+
"scalar": "0xf4240",
16+
"gasLimit": 30000000,
17+
"baseFeeScalar": null,
18+
"blobBaseFeeScalar": null
19+
}
20+
},
21+
"block_time": 2,
22+
"max_sequencer_drift": 600,
23+
"seq_window_size": 3600,
24+
"channel_timeout": 300,
25+
"granite_channel_timeout": 50,
26+
"l1_chain_id": 11155111,
27+
"l2_chain_id": 288882,
28+
"base_fee_params": {
29+
"max_change_denominator": "0x32",
30+
"elasticity_multiplier": "0x6"
31+
},
32+
"canyon_base_fee_params": {
33+
"max_change_denominator": "0xfa",
34+
"elasticity_multiplier": "0x6"
35+
},
36+
"regolith_time": 0,
37+
"canyon_time": 1724692140,
38+
"delta_time": 1724692140,
39+
"ecotone_time": 1724692141,
40+
"fjord_time": 1724692150,
41+
"granite_time": 1724914800,
42+
"batch_inbox_address": "0xfff0000000000000000000000000000000288882",
43+
"deposit_contract_address": "0xd00d5cc5620697a31014e5594aabba590793836d",
44+
"l1_system_config_address": "0xcc3c025036612b849340d6866ec0bd4d2d794a36",
45+
"protocol_versions_address": "0x0000000000000000000000000000000000000000",
46+
"da_challenge_address": "0x0000000000000000000000000000000000000000"
47+
}

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.79"
2+
channel = "1.81"
33
components = ["llvm-tools", "rustc-dev"]

scripts/prove/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ csv.workspace = true
3434
op-succinct-host-utils.workspace = true
3535
op-succinct-client-utils.workspace = true
3636

37+
# op-alloy
38+
op-alloy-genesis.workspace = true
39+
3740
# sp1
3841
sp1-sdk = { workspace = true }
3942

scripts/utils/bin/fetch_rollup_config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ async fn update_l2oo_config() -> Result<()> {
100100
let signer: PrivateKeySigner = private_key.parse().expect("Failed to parse private key");
101101
let address = signer.address();
102102

103-
// Set the owner.
103+
// Set the owner and proposer to the account associated with the private key.
104104
l2oo_config.owner = address.to_string();
105+
l2oo_config.proposer = address.to_string();
105106

106107
// Set the vkey.
107108
let prover = ProverClient::new();

utils/client/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ alloy-primitives.workspace = true
1919
alloy-sol-types.workspace = true
2020
revm.workspace = true
2121

22+
# workspace (op-alloy)
23+
op-alloy-genesis.workspace = true
24+
op-alloy-protocol.workspace = true
25+
op-alloy-rpc-types-engine.workspace = true
26+
2227
# workspace (kona)
2328
kona-common.workspace = true
2429
kona-primitives.workspace = true

utils/client/src/boot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
use alloy_primitives::B256;
55
use alloy_sol_types::sol;
6-
use kona_primitives::RollupConfig;
6+
use op_alloy_genesis::RollupConfig;
77
use serde::{Deserialize, Serialize};
88
use sha2::{Digest, Sha256};
99

utils/client/src/driver.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ use kona_derive::{
2121
},
2222
traits::{ChainProvider, L2ChainProvider},
2323
};
24-
use kona_mpt::TrieDBFetcher;
24+
use kona_mpt::TrieProvider;
2525
use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType};
26-
use kona_primitives::{BlockInfo, L2AttributesWithParent, L2BlockInfo};
26+
use op_alloy_protocol::{BlockInfo, L2BlockInfo};
27+
use op_alloy_rpc_types_engine::OptimismAttributesWithParent;
28+
2729
use log::{debug, error};
2830

2931
/// An oracle-backed derivation pipeline.
@@ -135,9 +137,9 @@ impl<O: CommsClient + Send + Sync + Debug> MultiBlockDerivationDriver<O> {
135137
self.l2_safe_head_header = new_safe_head_header;
136138
}
137139

138-
/// Produces the disputed [Vec<L2AttributesWithParent>] payloads, starting with the one after
140+
/// Produces the disputed [Vec<OptimismAttributesWithParent>] payloads, starting with the one after
139141
/// the L2 output root, for all the payloads derived in a given span batch.
140-
pub async fn produce_payloads(&mut self) -> Result<L2AttributesWithParent> {
142+
pub async fn produce_payloads(&mut self) -> Result<OptimismAttributesWithParent> {
141143
// As we start the safe head at the disputed block's parent, we step the pipeline until the
142144
// first attributes are produced. All batches at and before the safe head will be
143145
// dropped, so the first payload will always be the disputed one.

0 commit comments

Comments
 (0)