Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1f9f1b3
initial commit
dipkakwani Feb 6, 2026
1dec250
Remove unused L1SLOAD inspector code
jmadibekov Feb 24, 2026
f7f3007
Point alethia-reth deps to NMC L1SLOAD branch
jmadibekov Feb 25, 2026
101e262
Add jmadibekov debug logs to L1SLOAD code paths
jmadibekov Feb 26, 2026
db5165e
fix: use actual anchor block info for L1SLOAD proof verification in S…
jmadibekov Feb 28, 2026
e4a8cb0
fix: address L1SLOAD PR review issues and add concurrency safety
jmadibekov Feb 28, 2026
e8d3b87
chore: update Cargo.lock for alethia-reth changes
jmadibekov Feb 28, 2026
06d9c94
fix: detect branch nodes in get_leaf_value to handle non-existence pr…
jmadibekov Feb 28, 2026
6ca4d74
l1sload: add indirect-call proof flow and cleanups
jmadibekov Mar 2, 2026
69bac48
fix: initialize L1SLOAD anchor context for indirect-only blocks
jmadibekov Mar 2, 2026
9340f3f
l1sload: add bidirectional anchor-origin verification flow
jmadibekov Mar 3, 2026
ac2101e
feat: add verbose [jmadibekov] L1SLOAD debug logs for devnet testing
jmadibekov Mar 3, 2026
2c8a647
fix: use local variable names instead of `input` for logging
jmadibekov Mar 3, 2026
243320f
Simplify L1SLOAD preflight: replace 6-step pipeline with 3-step RPC f…
jmadibekov Mar 4, 2026
612f9af
Reduce L1SLOAD code duplication and remove dead code
jmadibekov Mar 4, 2026
50aba5a
L1SLOAD: walk backward from L1 origin instead of bidirectional from a…
jmadibekov Mar 5, 2026
55fd2d0
Fix L1SLOAD backward walk: start from parent_hash, not origin hash
jmadibekov Mar 5, 2026
a862f11
Revert gaiko submodule to e8dc91d (undo @jmadibekov tag removal)
jmadibekov Mar 5, 2026
eec7472
Merge remote-tracking branch 'origin/master' into feat/l1sload-raiko-v2
jmadibekov Mar 10, 2026
428c940
chore: update alethia-reth dependency to latest l1sload-precompile-nmc
jmadibekov Mar 10, 2026
70e531a
Remove required cuda dependency
jmadibekov Mar 11, 2026
c76ea7c
Add tests
jmadibekov Mar 12, 2026
1a4d3c5
Address PR review comments: reuse HTTP client, add bounds checks, rem…
jmadibekov Mar 13, 2026
2c34626
Verify L1SLOAD proofs in ZK guest and add bounds check on storage root
jmadibekov Mar 16, 2026
de318d6
Add L1SLOAD execution lock in ZK guest, validate header block numbers…
jmadibekov Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.11.0",
reth-provider = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.11.0", default-features = false }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.11.0", default-features = false }

alethia-reth-block = { git = "https://github.com/NethermindEth/alethia-reth.git", branch = "main", default-features = false }
alethia-reth-chainspec = { git = "https://github.com/NethermindEth/alethia-reth.git", branch = "main", default-features = false }
alethia-reth-consensus = { git = "https://github.com/NethermindEth/alethia-reth.git", branch = "main", default-features = false }
alethia-reth-evm = { git = "https://github.com/NethermindEth/alethia-reth.git", branch = "main", default-features = false, features = [
alethia-reth-block = { git = "https://github.com/NethermindEth/alethia-reth.git", rev = "98b32a4693e9fb55b0364e4ae922f3e8149c5c21", default-features = false }
alethia-reth-chainspec = { git = "https://github.com/NethermindEth/alethia-reth.git", rev = "98b32a4693e9fb55b0364e4ae922f3e8149c5c21", default-features = false }
alethia-reth-consensus = { git = "https://github.com/NethermindEth/alethia-reth.git", rev = "98b32a4693e9fb55b0364e4ae922f3e8149c5c21", default-features = false }
alethia-reth-evm = { git = "https://github.com/NethermindEth/alethia-reth.git", rev = "98b32a4693e9fb55b0364e4ae922f3e8149c5c21", default-features = false, features = [
"serde",
] }
alethia-reth-primitives = { git = "https://github.com/NethermindEth/alethia-reth.git", branch = "main", default-features = false, features = [
alethia-reth-primitives = { git = "https://github.com/NethermindEth/alethia-reth.git", rev = "98b32a4693e9fb55b0364e4ae922f3e8149c5c21", default-features = false, features = [
"serde-bincode-compat",
] }

Expand All @@ -99,7 +99,7 @@ risc0-binfmt = { version = "=3.0.4" }
risc0-zkos-v1compat = { version = "=2.2.2" }

# SP1
sp1-sdk = { version = "6.0.0", features = ["cuda"] }
sp1-sdk = { version = "6.0.0" }
sp1-prover = { version = "6.0.0" }
sp1-zkvm = { version = "6.0.0" }
sp1-helper = { version = "6.0.0" }
Expand Down Expand Up @@ -141,6 +141,7 @@ alloy-transport-http = { version = "1.0.18", default-features = false, features
] }
alloy-signer = { version = "1.0.18", default-features = false }
alloy-signer-local = { version = "1.0.18", default-features = false }
alloy-trie = { version = "0.9.1", default-features = false }

# ethers (TODO: remove)
ethers-contract = { git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10" }
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.zk
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ RUN TARGET=sp1 make guest
# Verify sp1 guest ELFs were produced
RUN ls provers/sp1/guest/elf/*

# ── Stage 3: Host build with CUDA (depends on all source code) ──────
# ── Stage 3: Host build (depends on all source code) ────────────────
# CUDA is opt-in via --build-arg CARGO_FEATURES="sp1,risc0,cuda"
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -177,7 +178,8 @@ RUN mkdir -p ~/.cargo/bin
# ARG CARGO_BUILD_JOBS=2
# ENV CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS}
# ENV NUM_JOBS=${CARGO_BUILD_JOBS}
RUN cargo build --release ${BUILD_FLAGS} --features "sp1,risc0,cuda"
ARG CARGO_FEATURES="sp1,risc0"
RUN cargo build --release ${BUILD_FLAGS} --features "${CARGO_FEATURES}"

FROM ubuntu:22.04 AS raiko-zk

Expand Down
58 changes: 56 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, hint::black_box};
use std::{collections::HashMap, hint::black_box, sync::MutexGuard};

use alethia_reth_primitives::{TaikoBlock, TaikoTxEnvelope};
use alloy_primitives::Address;
Expand All @@ -8,6 +8,9 @@ use raiko_lib::{
builder::{create_mem_db, RethBlockBuilder},
consts::ChainSpec,
input::{GuestBatchInput, GuestBatchOutput, GuestInput, GuestOutput, TaikoProverData},
l1_precompiles::{
acquire_l1sload_lock, clear_l1sload_cache, verify_and_populate_l1sload_proofs,
},
protocol_instance::ProtocolInstance,
prover::{IdStore, IdWrite, Proof, ProofKey},
utils::txs::{generate_transactions, generate_transactions_for_batch_blocks},
Expand All @@ -20,7 +23,9 @@ use crate::{
interfaces::{
run_shasta_proposal_prover, ProofRequest, RaikoError, RaikoResult, ShastaProposalCheckpoint,
},
preflight::{batch_preflight, preflight, BatchPreflightData, PreflightData},
preflight::{
batch_preflight, get_anchor_tx_info_by_fork, preflight, BatchPreflightData, PreflightData,
},
provider::BlockDataProvider,
};

Expand All @@ -33,6 +38,50 @@ pub mod provider;

pub type MerkleProof = HashMap<Address, EIP1186AccountProofResponse>;

/// Prepare L1SLOAD state for block execution: clear cache, and if the block has
/// L1 storage proofs, acquire the execution lock and verify/populate them.
///
/// Returns the execution guard that must be held until block execution completes.
fn prepare_l1sload_for_execution(input: &GuestInput) -> RaikoResult<MutexGuard<'static, ()>> {
let guard = acquire_l1sload_lock();
clear_l1sload_cache();

if input.l1_storage_proofs.is_empty() {
return Ok(guard);
}
Comment thread
jmadibekov marked this conversation as resolved.
let anchor_tx = input.taiko.anchor_tx.as_ref().ok_or_else(|| {
RaikoError::Guest(raiko_lib::prover::ProverError::GuestError(
"No anchor tx for L1SLOAD verification".to_string(),
))
})?;
let fork = input
.chain_spec
.active_fork(input.block.header.number, input.block.timestamp)
.map_err(|e| {
RaikoError::Guest(raiko_lib::prover::ProverError::GuestError(format!(
"Failed to determine active fork: {e}"
)))
})?;
let (anchor_block_number, _) = get_anchor_tx_info_by_fork(fork, anchor_tx).map_err(|e| {
RaikoError::Guest(raiko_lib::prover::ProverError::GuestError(format!(
"Failed to decode anchor tx info: {e}"
)))
})?;
verify_and_populate_l1sload_proofs(
&input.l1_storage_proofs,
anchor_block_number,
&input.taiko.l1_header,
&input.l1_headers,
)
.map_err(|e| {
RaikoError::Guest(raiko_lib::prover::ProverError::GuestError(format!(
"Failed to verify L1SLOAD proofs: {e}"
)))
})?;

Ok(guard)
}

pub struct Raiko {
pub l1_chain_spec: ChainSpec,
pub taiko_chain_spec: ChainSpec,
Expand Down Expand Up @@ -138,6 +187,9 @@ impl Raiko {
&input.taiko.tx_data,
&input.taiko.anchor_tx,
);

let _l1sload_guard = prepare_l1sload_for_execution(input)?;

builder
.execute_transactions(pool_tx, false)
.expect("execute");
Expand Down Expand Up @@ -216,6 +268,8 @@ impl Raiko {
let db = create_mem_db(&mut input_owned).unwrap();
let mut builder = RethBlockBuilder::new(input_owned, db);

let _l1sload_guard = prepare_l1sload_for_execution(input)?;

let mut pool_txs = vec![input.taiko.anchor_tx.clone().unwrap()];
pool_txs.extend_from_slice(&origin_pool_txs.as_slice());

Expand Down
Loading
Loading