Skip to content

Commit 91413fc

Browse files
authored
Support Fusaka (#26)
1 parent ee0c308 commit 91413fc

File tree

16 files changed

+647
-320
lines changed

16 files changed

+647
-320
lines changed

Cargo.lock

Lines changed: 471 additions & 245 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,34 @@ ethereum-consensus = { git = "https://github.com/datachainlab/ethereum-light-cli
2222
ethereum-light-client-verifier = { git = "https://github.com/datachainlab/ethereum-light-client-rs", rev = "v0.2.0", default-features = false }
2323

2424
# Kona
25-
kona-mpt = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
26-
kona-client = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
27-
kona-host = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
28-
kona-proof = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
29-
kona-preimage = {git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
30-
kona-executor = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
31-
kona-driver = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
32-
kona-providers-alloy= { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
33-
kona-genesis = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
34-
kona-protocol = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
35-
kona-derive = { git="https://github.com/anton-rs/kona", rev= "kona-client/v1.0.2", default-features = false }
25+
kona-mpt = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
26+
kona-client = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
27+
kona-host = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
28+
kona-proof = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
29+
kona-preimage = {git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
30+
kona-executor = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
31+
kona-driver = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
32+
kona-providers-alloy= { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
33+
kona-genesis = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
34+
kona-protocol = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
35+
kona-derive = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
36+
kona-registry = { git="https://github.com/op-rs/kona", rev= "kona-node/v1.1.3", default-features = false }
3637

3738
# Alloy
38-
alloy-consensus = { version = "1.0.9", default-features = false }
39-
alloy-primitives = { version = "1.1.2", default-features = false }
40-
alloy-eips = { version = "1.0.9", default-features = false }
41-
alloy-trie = { version = "0.8.1", default-features = false }
39+
alloy-consensus = { version = "1.0.38", default-features = false }
40+
alloy-primitives = { version = "1.3.1", default-features = false }
41+
alloy-eips = { version = "1.0.38", default-features = false }
42+
alloy-trie = { version = "0.9.1", default-features = false }
4243

4344
# OP Alloy
44-
op-alloy-rpc-types-engine = { version = "0.17.2", default-features = false }
45-
op-alloy-consensus= { version = "0.17.2", default-features = false }
45+
op-alloy-rpc-types-engine = { version = "0.20.0", default-features = false }
46+
op-alloy-consensus= { version = "0.20.0", default-features = false }
4647

4748
# Ethereum
48-
revm = { version = "24.0.1", default-features = false }
49-
op-revm = { version = "5.0.1", default-features = false }
50-
alloy-evm = { version = "0.10.0", default-features = false, features = ["op"] }
51-
alloy-op-evm = { version = "0.10.0", default-features = false }
49+
revm = { version = "29.0.1", default-features = false }
50+
op-revm = { version = "10.1.0", default-features = false }
51+
alloy-evm = { version = "0.21.0", default-features = false, features = ["op"] }
52+
alloy-op-evm = { version = "0.21.0", default-features = false }
5253

5354
# Cryptography
5455
sha2 = { version = "0.10.8", default-features = false }

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PHONY: sync-lock
2+
sync-lock:
3+
cargo update -p kona-client
4+
cd tools/deps && python sync_lock.py
5+
# Check build
6+
cargo build

derivation/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ kona-derive = { workspace = true }
1616
kona-proof = { workspace = true }
1717
kona-genesis = { workspace = true, features = ["serde"] }
1818
kona-client = { workspace = true }
19+
kona-registry = { workspace = true }
1920

2021
# Alloy
2122
alloy-primitives = { workspace = true }

derivation/src/derivation.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ use core::clone::Clone;
88
use core::fmt::Debug;
99
use kona_client::fpvm_evm::FpvmOpEvmFactory;
1010
use kona_client::single::fetch_safe_head_hash;
11-
use kona_derive::sources::EthereumDataSource;
11+
use kona_derive::EthereumDataSource;
1212
use kona_driver::Driver;
1313
use kona_executor::TrieDBProvider;
14-
use kona_genesis::RollupConfig;
14+
use kona_genesis::{L1ChainConfig, RollupConfig};
1515
use kona_preimage::{PreimageKey, PreimageOracleClient};
16-
use kona_proof::boot::L2_ROLLUP_CONFIG_KEY;
16+
use kona_proof::boot::{L1_CONFIG_KEY, L2_ROLLUP_CONFIG_KEY};
1717
use kona_proof::sync::new_oracle_pipeline_cursor;
1818
use kona_proof::{
1919
executor::KonaExecutor,
2020
l1::{OracleBlobProvider, OracleL1ChainProvider, OraclePipeline},
2121
l2::OracleL2ChainProvider,
2222
BootInfo,
2323
};
24+
use kona_registry::L1_CONFIGS;
2425
use serde::{Deserialize, Serialize};
2526

2627
#[derive(Clone, Debug, Deserialize, Serialize)]
@@ -64,13 +65,15 @@ impl Derivation {
6465
oracle: MemoryOracleClient,
6566
) -> Result<(Header, u64), Error> {
6667
verify_config(rollup_config, &oracle).await?;
68+
let l1_config = load_l1_config(rollup_config, &oracle).await?;
6769
let boot = &BootInfo {
6870
l1_head: self.l1_head_hash,
6971
agreed_l2_output_root: self.agreed_l2_output_root,
7072
claimed_l2_output_root: self.l2_output_root,
7173
claimed_l2_block_number: self.l2_block_number,
7274
chain_id,
7375
rollup_config: rollup_config.clone(),
76+
l1_config: l1_config.clone(),
7477
};
7578
let rollup_config = Arc::new(boot.rollup_config.clone());
7679
let safe_head_hash = fetch_safe_head_hash(&oracle, boot.agreed_l2_output_root).await?;
@@ -98,6 +101,7 @@ impl Derivation {
98101
EthereumDataSource::new_from_parts(l1_provider.clone(), beacon, &rollup_config);
99102
let pipeline = OraclePipeline::new(
100103
rollup_config.clone(),
104+
l1_config.into(),
101105
cursor.clone(),
102106
oracle.clone(),
103107
da_provider,
@@ -159,6 +163,27 @@ async fn verify_config(
159163
Ok(())
160164
}
161165

166+
async fn load_l1_config(
167+
rollup_config: &RollupConfig,
168+
oracle: &MemoryOracleClient,
169+
) -> Result<L1ChainConfig, Error> {
170+
let l1_config = if let Some(config) = L1_CONFIGS.get(&rollup_config.l1_chain_id) {
171+
config.clone()
172+
} else {
173+
// for devnet only
174+
let config_key = PreimageKey::new_local(L1_CONFIG_KEY.to());
175+
let ser_cfg = oracle
176+
.get(config_key)
177+
.await
178+
.map_err(|e| Error::UnexpectedPreimageKey {
179+
source: e,
180+
key: config_key.key_value().to_be_bytes(),
181+
})?;
182+
serde_json::from_slice(&ser_cfg).map_err(Error::SerdeError)?
183+
};
184+
Ok(l1_config)
185+
}
186+
162187
#[cfg(test)]
163188
mod test {
164189
use crate::derivation::verify_config;
@@ -185,7 +210,7 @@ mod test {
185210
fn test_verify_config_invalid_error() {
186211
let rollup_config = RollupConfig::default();
187212
let rollup_config2 = RollupConfig {
188-
l2_chain_id: rollup_config.l2_chain_id + 1,
213+
l2_chain_id: (rollup_config.l2_chain_id.id() + 1).into(),
189214
..rollup_config.clone()
190215
};
191216

derivation/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum Error {
5555
#[error("DriverError: err={0:?}")]
5656
DriverError(#[from] kona_driver::DriverError<kona_executor::ExecutorError>),
5757
#[error("PipelineError: err={0:?}")]
58-
PipelineError(#[from] kona_derive::errors::PipelineErrorKind),
58+
PipelineError(#[from] kona_derive::PipelineErrorKind),
5959
#[error("SerdeError: err={0:?}")]
6060
SerdeError(#[from] serde_json::Error),
6161
#[error("UnexpectedLocalPreimageKey: key={0:?}")]

derivation/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![no_std]
2+
#![allow(clippy::result_large_err)]
23
extern crate alloc;
34

45
pub mod derivation;

derivation/src/oracle.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use ark_ff::BigInteger;
1313
use hashbrown::{HashMap, HashSet};
1414
use kona_preimage::errors::{PreimageOracleError, PreimageOracleResult};
1515
use kona_preimage::{HintWriterClient, PreimageKey, PreimageKeyType, PreimageOracleClient};
16-
use kona_proof::boot::L2_ROLLUP_CONFIG_KEY;
16+
use kona_proof::boot::{L1_CONFIG_KEY, L2_ROLLUP_CONFIG_KEY};
1717
use kona_proof::l1::ROOTS_OF_UNITY;
1818
use kona_proof::FlushableCache;
1919
use sha2::{Digest, Sha256};
@@ -46,8 +46,7 @@ impl PreimageOracleClient for MemoryOracleClient {
4646
Ok(value.clone())
4747
} else {
4848
Err(PreimageOracleError::Other(format!(
49-
"key not found: {:?}",
50-
key
49+
"key not found: {key:?}"
5150
)))
5251
}
5352
}
@@ -58,8 +57,7 @@ impl PreimageOracleClient for MemoryOracleClient {
5857
Ok(())
5958
} else {
6059
Err(PreimageOracleError::Other(format!(
61-
"key not found: {:?}",
62-
key
60+
"key not found: {key:?}"
6361
)))
6462
}
6563
}
@@ -124,7 +122,8 @@ impl TryFrom<Vec<Preimage>> for MemoryOracleClient {
124122
}
125123
PreimageKeyType::Sha256 => verify_sha256_preimage(&preimage_key, &preimage.data)?,
126124
PreimageKeyType::Local => {
127-
if preimage_key.key_value() != L2_ROLLUP_CONFIG_KEY {
125+
let key = preimage_key.key_value();
126+
if key != L2_ROLLUP_CONFIG_KEY && key != L1_CONFIG_KEY {
128127
return Err(Error::UnexpectedLocalPreimageKey(preimage_key));
129128
}
130129
}

light-client/src/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mod test {
9191
"48b7747ba1094684d9197bbaa5dcb134587d23e493fb53a29e400c50e50f5147"
9292
)),
9393
);
94-
assert!(res.is_ok(), "{:?}", res);
94+
assert!(res.is_ok(), "{res:?}");
9595
}
9696

9797
#[test]
@@ -149,7 +149,7 @@ mod test {
149149
"568a51c3253bbd2d46e3923b35df0489712df11453fd04dd71341120356952c0"
150150
)),
151151
);
152-
assert!(res.is_ok(), "{:?}", res);
152+
assert!(res.is_ok(), "{res:?}");
153153
}
154154

155155
#[test]

0 commit comments

Comments
 (0)