From 457597c644a16b0c410c41aa286a81895ba9a052 Mon Sep 17 00:00:00 2001 From: Brechtpd Date: Tue, 2 Jul 2024 07:09:48 +0200 Subject: [PATCH 1/4] use more reth --- Cargo.lock | 82 ++++----- core/src/lib.rs | 1 - core/src/preflight.rs | 70 +------- host/src/server/api/v1/proof.rs | 2 +- lib/src/builder.rs | 294 +++++--------------------------- lib/src/input.rs | 48 +----- lib/src/protocol_instance.rs | 12 +- lib/src/utils.rs | 74 +++----- 8 files changed, 126 insertions(+), 457 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07e996b24..2e39fe927 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6220,7 +6220,7 @@ dependencies = [ [[package]] name = "reth-blockchain-tree-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -6232,7 +6232,7 @@ dependencies = [ [[package]] name = "reth-chainspec" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-eips", @@ -6251,7 +6251,7 @@ dependencies = [ [[package]] name = "reth-codecs" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6266,7 +6266,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -6277,7 +6277,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-primitives", @@ -6287,7 +6287,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -6297,7 +6297,7 @@ dependencies = [ [[package]] name = "reth-db" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -6323,7 +6323,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -6342,7 +6342,7 @@ dependencies = [ [[package]] name = "reth-discv4" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -6366,7 +6366,7 @@ dependencies = [ [[package]] name = "reth-ecies" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "aes 0.8.4", "alloy-primitives", @@ -6397,7 +6397,7 @@ dependencies = [ [[package]] name = "reth-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-blockchain-tree-api", "reth-consensus", @@ -6410,7 +6410,7 @@ dependencies = [ [[package]] name = "reth-eth-wire" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rlp", "bytes", @@ -6437,7 +6437,7 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rlp", "bytes", @@ -6452,7 +6452,7 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -6464,7 +6464,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-primitives", @@ -6477,7 +6477,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "futures-util", @@ -6494,7 +6494,7 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-sol-types", @@ -6514,7 +6514,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-primitives", @@ -6528,7 +6528,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-execution-errors", "reth-primitives", @@ -6539,7 +6539,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "serde_json", "thiserror", @@ -6548,7 +6548,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "metrics", "reth-metrics-derive", @@ -6557,7 +6557,7 @@ dependencies = [ [[package]] name = "reth-metrics-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "once_cell", "proc-macro2", @@ -6569,7 +6569,7 @@ dependencies = [ [[package]] name = "reth-net-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "tokio", @@ -6578,7 +6578,7 @@ dependencies = [ [[package]] name = "reth-net-nat" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "futures-util", "reqwest 0.12.5", @@ -6590,7 +6590,7 @@ dependencies = [ [[package]] name = "reth-network-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "enr 0.12.1", @@ -6605,7 +6605,7 @@ dependencies = [ [[package]] name = "reth-network-p2p" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "futures", @@ -6623,7 +6623,7 @@ dependencies = [ [[package]] name = "reth-network-peers" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -6638,7 +6638,7 @@ dependencies = [ [[package]] name = "reth-nippy-jar" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "anyhow", "bincode", @@ -6658,7 +6658,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6692,7 +6692,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -6711,7 +6711,7 @@ dependencies = [ [[package]] name = "reth-provider" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rpc-types-engine", "auto_impl", @@ -6749,7 +6749,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -6763,7 +6763,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-rlp", @@ -6781,7 +6781,7 @@ dependencies = [ [[package]] name = "reth-rpc-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -6800,7 +6800,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -6813,7 +6813,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "derive_more", @@ -6824,7 +6824,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-chainspec", @@ -6841,7 +6841,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-fs-util", "reth-primitives", @@ -6851,7 +6851,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "clap 4.5.7", "eyre", @@ -6866,7 +6866,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rlp", "auto_impl", @@ -6887,7 +6887,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-genesis", diff --git a/core/src/lib.rs b/core/src/lib.rs index e71983b8a..1e640e73b 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -63,7 +63,6 @@ impl Raiko { pub fn get_output(&self, input: &GuestInput) -> RaikoResult { let db = create_mem_db(&mut input.clone()).unwrap(); let mut builder = RethBlockBuilder::new(input, db); - builder.prepare_header().expect("prepare"); builder.execute_transactions(false).expect("execute"); let result = builder.finalize(); diff --git a/core/src/preflight.rs b/core/src/preflight.rs index e1e633724..7aa07aa00 100644 --- a/core/src/preflight.rs +++ b/core/src/preflight.rs @@ -18,16 +18,17 @@ use raiko_lib::{ consts::ChainSpec, inplace_print, input::{ - decode_anchor, proposeBlockCall, BlobProofType, BlockProposed, GuestInput, TaikoGuestInput, + proposeBlockCall, BlobProofType, BlockProposed, GuestInput, TaikoGuestInput, TaikoProverData, }, primitives::{ eip4844::{self, commitment_to_version_hash, KZG_SETTINGS}, mpt::proofs_to_tries, }, - utils::{generate_transactions, zlib_compress_data}, + utils::zlib_compress_data, Measurement, }; +use reth_evm_ethereum::taiko::decode_anchor; use reth_primitives::Block as RethBlock; use serde::{Deserialize, Serialize}; use std::collections::HashSet; @@ -85,60 +86,17 @@ pub async fn preflight( }; measurement.stop(); - let reth_block = RethBlock::try_from(block.clone()).expect("block convert failed"); - + let reth_block = RethBlock::try_from(block.clone()).map_err(|e| { + RaikoError::Conversion(format!("Failed converting to reth block: {}", e).to_owned()) + })?; let input = GuestInput { block: reth_block.clone(), chain_spec: taiko_chain_spec.clone(), - block_number, - beneficiary: block.header.miner, - gas_limit: block.header.gas_limit.try_into().map_err(|_| { - RaikoError::Conversion("Failed converting gas limit to u64".to_string()) - })?, - timestamp: block.header.timestamp, - extra_data: block.header.extra_data.clone(), - mix_hash: if let Some(mix_hash) = block.header.mix_hash { - mix_hash - } else { - return Err(RaikoError::Preflight( - "No mix hash for the requested block".to_owned(), - )); - }, - withdrawals: block.withdrawals.clone().unwrap_or_default(), parent_state_trie: Default::default(), parent_storage: Default::default(), contracts: Default::default(), parent_header: parent_block.header.clone().try_into().unwrap(), ancestor_headers: Default::default(), - base_fee_per_gas: block.header.base_fee_per_gas.map_or_else( - || { - Err(RaikoError::Preflight( - "No base fee per gas for the requested block".to_owned(), - )) - }, - |base_fee_per_gas| { - base_fee_per_gas.try_into().map_err(|_| { - RaikoError::Conversion("Failed converting base fee per gas to u64".to_owned()) - }) - }, - )?, - blob_gas_used: block.header.blob_gas_used.map_or_else( - || Ok(None), - |b: u128| -> RaikoResult> { - b.try_into().map(Some).map_err(|_| { - RaikoError::Conversion("Failed converting blob gas used to u64".to_owned()) - }) - }, - )?, - excess_blob_gas: block.header.excess_blob_gas.map_or_else( - || Ok(None), - |b: u128| -> RaikoResult> { - b.try_into().map(Some).map_err(|_| { - RaikoError::Conversion("Failed converting excess blob gas to u64".to_owned()) - }) - }, - )?, - parent_beacon_block_root: block.header.parent_beacon_block_root, taiko: taiko_guest_input, }; @@ -157,7 +115,6 @@ pub async fn preflight( .await?; let mut builder = RethBlockBuilder::new(&input, provider_db); - builder.prepare_header()?; // Optimize data gathering by executing the transactions multiple times so data can be requested in batches let is_local = false; @@ -307,24 +264,11 @@ async fn prepare_taiko_chain_input( (proposal_call.txList.as_ref().to_owned(), None) }; - // Create the transactions from the proposed tx list - let transactions = generate_transactions( - taiko_chain_spec, - proposal_event.meta.blobUsed, - &tx_data, - Some(anchor_tx.clone()), - ); - // Do a sanity check using the transactions returned by the node - assert!( - transactions.len() >= block.transactions.len(), - "unexpected number of transactions" - ); - // Create the input struct without the block data set Ok(TaikoGuestInput { l1_header: l1_state_block.header.clone().try_into().unwrap(), tx_data, - anchor_tx: serde_json::to_string(&anchor_tx).map_err(RaikoError::Serde)?, + anchor_tx: Some(anchor_tx.try_into().unwrap()), blob_commitment, block_proposed: proposal_event, prover_data, diff --git a/host/src/server/api/v1/proof.rs b/host/src/server/api/v1/proof.rs index 3bc1dee0f..4a306231a 100644 --- a/host/src/server/api/v1/proof.rs +++ b/host/src/server/api/v1/proof.rs @@ -64,7 +64,7 @@ async fn validate_cache_input( if let Some(cache_input) = cached_input { debug!("Using cached input"); let blocks = provider - .get_blocks(&[(cache_input.block_number, false)]) + .get_blocks(&[(cache_input.block.number, false)]) .await?; let block = blocks .first() diff --git a/lib/src/builder.rs b/lib/src/builder.rs index 334d0203d..37b4edbe1 100644 --- a/lib/src/builder.rs +++ b/lib/src/builder.rs @@ -11,19 +11,18 @@ use crate::{ mem_db::{AccountState, DbAccount, MemDb}, CycleTracker, }; -use alloy_consensus::{Signed, Transaction, TxEnvelope}; -use alloy_rpc_types::{ConversionError, Parity, Transaction as AlloyTransaction}; -use anyhow::{bail, Context, Error, Result}; +use anyhow::{bail, ensure, Result}; use reth_chainspec::{ChainSpecBuilder, HOLESKY, MAINNET, TAIKO_A7, TAIKO_MAINNET}; use reth_evm::execute::{BlockExecutionOutput, BlockValidationError, Executor, ProviderError}; -use reth_evm_ethereum::execute::{validate_block_post_execution, EthExecutorProvider}; +use reth_evm_ethereum::execute::{ + validate_block_post_execution, Consensus, EthBeaconConsensus, EthExecutorProvider, +}; use reth_evm_ethereum::taiko::TaikoData; use reth_primitives::revm_primitives::db::{Database, DatabaseCommit}; use reth_primitives::revm_primitives::{ - Account, AccountInfo, AccountStatus, Bytecode, Bytes, HashMap, SpecId, + Account, AccountInfo, AccountStatus, Bytecode, Bytes, HashMap, }; -use reth_primitives::transaction::Signature as RethSignature; -use reth_primitives::{Address, BlockBody, Header, TransactionSigned, B256, KECCAK_EMPTY, U256}; +use reth_primitives::{Address, BlockWithSenders, Header, B256, KECCAK_EMPTY, U256}; use tracing::debug; pub fn calculate_block_header(input: &GuestInput) -> Header { @@ -33,10 +32,6 @@ pub fn calculate_block_header(input: &GuestInput) -> Header { let mut builder = RethBlockBuilder::new(input, db); - let cycle_tracker = CycleTracker::start("prepare_header"); - builder.prepare_header().expect("prepare"); - cycle_tracker.end(); - let cycle_tracker = CycleTracker::start("execute_transactions"); builder.execute_transactions(false).expect("execute"); cycle_tracker.end(); @@ -63,12 +58,8 @@ pub struct RethBlockBuilder { pub chain_spec: ChainSpec, pub input: GuestInput, pub db: Option, - pub header: Option
, } -/// Minimum supported protocol version: SHANGHAI -const MIN_SPEC_ID: SpecId = SpecId::SHANGHAI; - impl + DatabaseCommit + OptimisticDatabase> RethBlockBuilder { @@ -77,59 +68,14 @@ impl + DatabaseCommit + OptimisticDatabase> RethBlockBuilder { chain_spec: input.chain_spec.clone(), db: Some(db), - header: None, input: input.clone(), } } - /// Initializes the header. This must be called before executing transactions. - pub fn prepare_header(&mut self) -> Result<()> { - /// Maximum size of extra data. - pub const MAX_EXTRA_DATA_BYTES: usize = 32; - - // Validate timestamp - let timestamp: u64 = self.input.timestamp; - if timestamp < self.input.parent_header.timestamp { - bail!( - "Invalid timestamp: expected >= {}, got {}", - self.input.parent_header.timestamp, - self.input.timestamp, - ); - } - // Validate extra data - let extra_data_bytes = self.input.extra_data.len(); - if extra_data_bytes > MAX_EXTRA_DATA_BYTES { - bail!("Invalid extra data: expected <= {MAX_EXTRA_DATA_BYTES}, got {extra_data_bytes}") - } - // Derive header - let number: u64 = self.input.parent_header.number; - self.header = Some(Header { - // Initialize fields that we can compute from the parent - parent_hash: self.input.parent_header.hash_slow(), - number: number - .checked_add(1) - .with_context(|| "Invalid block number: too large")?, - base_fee_per_gas: Some(self.input.base_fee_per_gas), - // Initialize metadata from input - beneficiary: self.input.beneficiary, - gas_limit: self.input.gas_limit, - timestamp: self.input.timestamp, - mix_hash: self.input.mix_hash, - extra_data: self.input.extra_data.clone(), - blob_gas_used: self.input.blob_gas_used, - excess_blob_gas: self.input.excess_blob_gas, - parent_beacon_block_root: self.input.parent_beacon_block_root, - // do not fill the remaining fields - ..Default::default() - }); - Ok(()) - } - /// Executes all input transactions. pub fn execute_transactions(&mut self, optimistic: bool) -> Result<()> { + // Get the chain spec let chain_spec = &self.input.chain_spec; - let is_taiko = chain_spec.is_taiko(); - let total_difficulty = U256::ZERO; let reth_chain_spec = match chain_spec.name.as_str() { "taiko_a7" => TAIKO_A7.clone(), @@ -149,64 +95,20 @@ impl + DatabaseCommit + OptimisticDatabase> _ => unimplemented!(), }; - let header = self.header.as_mut().expect("Header is not initialized"); - let spec_id = self - .input - .chain_spec - .active_fork(header.number, header.timestamp) - .unwrap(); - if !SpecId::enabled(spec_id, MIN_SPEC_ID) { - bail!("Invalid protocol version: expected >= {MIN_SPEC_ID:?}, got {spec_id:?}") - } - - // generate the transactions from the tx list - // For taiko blocks, insert the anchor tx as the first transaction - let anchor_tx = if is_taiko { - Some(serde_json::from_str(&self.input.taiko.anchor_tx.clone()).unwrap()) - } else { - None - }; - let transactions = generate_transactions( + // Generate the transactions from the tx list + let mut block = self.input.block.clone(); + block.body = generate_transactions( &self.input.chain_spec, self.input.taiko.block_proposed.meta.blobUsed, &self.input.taiko.tx_data, - anchor_tx, + &self.input.taiko.anchor_tx, ); - let mut alloy_transactions = Vec::new(); - for tx in transactions { - let alloy_tx: AlloyTransaction = - to_alloy_transaction(&tx).expect("can't convert to alloy"); - alloy_transactions.push(alloy_tx); - } - - let mut block = self.input.block.clone(); - // Convert alloy transactions to reth transactions and set them on the block - block.body = alloy_transactions - .into_iter() - .map(|tx| { - let signature = tx - .signature - .ok_or(ConversionError::MissingSignature) - .expect("missing signature"); - TransactionSigned::from_transaction_and_signature( - tx.try_into().expect("tx conversion failed"), - RethSignature { - r: signature.r, - s: signature.s, - odd_y_parity: signature - .y_parity - .unwrap_or_else(|| alloy_rpc_types::Parity(!signature.v.bit(0))) - .0, - }, - ) - }) - .collect(); - - let block_with_senders = block - .clone() + // Recover senders + let mut block = block .with_recovered_senders() .ok_or(BlockValidationError::SenderRecoveryError)?; + // Execute transactions let executor = EthExecutorProvider::ethereum(reth_chain_spec.clone()) .eth_executor(self.db.take().unwrap()) .taiko_data(TaikoData { @@ -219,22 +121,45 @@ impl + DatabaseCommit + OptimisticDatabase> state, receipts, requests, - gas_used, + gas_used: _, db: full_state, - } = executor.execute((&block_with_senders, total_difficulty).into())?; + valid_transaction_indices, + } = executor.execute((&block, total_difficulty).into())?; + // Filter out the valid transactions so that the header checks only take these into account + block.body = valid_transaction_indices + .iter() + .map(|&i| block.body[i].clone()) + .collect(); + // Header validation + let block = block.seal_slow(); if !optimistic { + let consensus = EthBeaconConsensus::new(reth_chain_spec.clone()); + // Validates extra data + consensus.validate_header_with_total_difficulty(&block.header, total_difficulty)?; + // Validates if some values are set that should not be set for the current HF + consensus.validate_header(&block.header)?; + // Validates parent block hash, block number and timestamp + consensus.validate_header_against_parent( + &block.header, + &self.input.parent_header.clone().seal_slow(), + )?; + // Validates ommers hash, transaction root, withdrawals root + consensus.validate_block_pre_execution(&block)?; // Validates the gas used, the receipts root and the logs bloom validate_block_post_execution( - &block_with_senders, + &BlockWithSenders { + block: block.block.unseal(), + senders: block.senders, + }, &reth_chain_spec.clone(), &receipts, &requests, )?; } + // Apply DB changes self.db = Some(full_state.database); - let changes: HashMap = state .state .into_iter() @@ -256,31 +181,19 @@ impl + DatabaseCommit + OptimisticDatabase> .collect(); self.db.as_mut().unwrap().commit(changes); - // Set the values verified in validate_block_post_execution - let header = self.header.as_mut().unwrap(); - header.gas_used = gas_used; - header.receipts_root = self.input.block.header.receipts_root; - header.logs_bloom = self.input.block.header.logs_bloom; - Ok(()) } } impl RethBlockBuilder { - /// Finalizes the block building and returns the header and the state trie. + /// Finalizes the block building and returns the header pub fn finalize(&mut self) -> Result
{ - let mut header = self.header.take().expect("Header not initialized"); - let block_body = BlockBody::from(self.input.block.clone()); - - header.state_root = self.calculate_state_root()?; - header.transactions_root = block_body.calculate_tx_root(); - header.withdrawals_root = block_body.calculate_withdrawals_root(); - header.ommers_hash = block_body.calculate_ommers_root(); - - Ok(header) + let state_root = self.calculate_state_root()?; + ensure!(self.input.block.state_root == state_root); + Ok(self.input.block.header.clone()) } - /// Finalizes the block building and returns the header and the state trie. + /// Calculates the state root of the block pub fn calculate_state_root(&mut self) -> Result { let mut account_touched = 0; let mut storage_touched = 0; @@ -463,118 +376,3 @@ pub fn create_mem_db(input: &mut GuestInput) -> Result { block_hashes, }) } - -pub fn to_alloy_transaction(tx: &TxEnvelope) -> Result { - match tx { - TxEnvelope::Legacy(tx) => { - let alloy_tx = AlloyTransaction { - hash: *tx.hash(), - nonce: tx.tx().nonce(), - block_hash: None, - block_number: None, - transaction_index: None, - to: tx.tx().to().to().copied(), - value: tx.tx().value(), - gas_price: tx.tx().gas_price(), - gas: tx.tx().gas_limit(), - max_fee_per_gas: None, - max_priority_fee_per_gas: None, - max_fee_per_blob_gas: None, - input: tx.tx().input().to_owned().into(), - signature: Some(to_alloy_signature(get_sig(tx))), - chain_id: tx.tx().chain_id(), - blob_versioned_hashes: None, - access_list: None, - transaction_type: Some(0), - ..Default::default() - }; - Ok(alloy_tx) - } - TxEnvelope::Eip2930(tx) => { - let alloy_tx = AlloyTransaction { - hash: *tx.hash(), - nonce: tx.tx().nonce(), - block_hash: None, - block_number: None, - transaction_index: None, - to: tx.tx().to().to().copied(), - value: tx.tx().value(), - gas_price: tx.tx().gas_price(), - gas: tx.tx().gas_limit(), - max_fee_per_gas: None, - max_priority_fee_per_gas: None, - max_fee_per_blob_gas: None, - input: tx.tx().input().to_owned().into(), - signature: Some(to_alloy_signature(get_sig(tx))), - chain_id: tx.tx().chain_id(), - blob_versioned_hashes: None, - access_list: Some(tx.tx().access_list.clone()), - transaction_type: Some(1), - ..Default::default() - }; - Ok(alloy_tx) - } - TxEnvelope::Eip1559(tx) => { - let alloy_tx = AlloyTransaction { - hash: *tx.hash(), - nonce: tx.tx().nonce(), - block_hash: None, - block_number: None, - transaction_index: None, - to: tx.tx().to().to().copied(), - value: tx.tx().value(), - gas_price: tx.tx().gas_price(), - gas: tx.tx().gas_limit(), - max_fee_per_gas: Some(tx.tx().max_fee_per_gas), - max_priority_fee_per_gas: Some(tx.tx().max_priority_fee_per_gas), - max_fee_per_blob_gas: None, - input: tx.tx().input().to_owned().into(), - signature: Some(to_alloy_signature(get_sig(tx))), - chain_id: tx.tx().chain_id(), - blob_versioned_hashes: None, - access_list: Some(tx.tx().access_list.clone()), - transaction_type: Some(2), - ..Default::default() - }; - Ok(alloy_tx) - } - TxEnvelope::Eip4844(tx) => { - let alloy_tx = AlloyTransaction { - hash: *tx.hash(), - nonce: tx.tx().nonce(), - block_hash: None, - block_number: None, - transaction_index: None, - to: tx.tx().to().to().copied(), - value: tx.tx().value(), - gas_price: tx.tx().gas_price(), - gas: tx.tx().gas_limit(), - max_fee_per_gas: Some(tx.tx().tx().max_fee_per_gas), - max_priority_fee_per_gas: Some(tx.tx().tx().max_priority_fee_per_gas), - max_fee_per_blob_gas: Some(tx.tx().tx().max_fee_per_blob_gas), - input: tx.tx().input().to_owned().into(), - signature: Some(to_alloy_signature(get_sig(tx))), - chain_id: tx.tx().chain_id(), - blob_versioned_hashes: Some(tx.tx().tx().blob_versioned_hashes.clone()), - access_list: Some(tx.tx().tx().access_list.clone()), - transaction_type: Some(tx.tx().tx_type() as u8), - ..Default::default() - }; - Ok(alloy_tx) - } - _ => todo!(), - } -} - -pub fn get_sig(tx: &Signed) -> Sig { - tx.signature().clone() -} - -pub fn to_alloy_signature(sig: alloy_primitives::Signature) -> alloy_rpc_types::Signature { - alloy_rpc_types::Signature { - r: sig.r(), - s: sig.s(), - v: sig.v().to_u64().try_into().unwrap(), - y_parity: Some(Parity(sig.v().to_parity_bool().y_parity())), - } -} diff --git a/lib/src/input.rs b/lib/src/input.rs index bb8cf9dd6..e3f6cfa1f 100644 --- a/lib/src/input.rs +++ b/lib/src/input.rs @@ -2,10 +2,12 @@ use core::{fmt::Debug, str::FromStr}; #[cfg(feature = "std")] use std::path::PathBuf; -use alloy_rpc_types::Withdrawal as AlloyWithdrawal; -use alloy_sol_types::{sol, SolCall}; +use alloy_sol_types::sol; use anyhow::{anyhow, Error, Result}; -use reth_primitives::revm_primitives::{Address, Bytes, HashMap, B256, U256}; +use reth_primitives::{ + revm_primitives::{Address, Bytes, HashMap, B256, U256}, + TransactionSigned, +}; use serde::{Deserialize, Serialize}; use serde_with::serde_as; @@ -28,22 +30,8 @@ pub struct GuestInput { pub block: RethBlock, /// The network to generate the proof for pub chain_spec: ChainSpec, - /// Block number - pub block_number: u64, /// Previous block header pub parent_header: Header, - /// Address to which all priority fees in this block are transferred. - pub beneficiary: Address, - /// Scalar equal to the current limit of gas expenditure per block. - pub gas_limit: u64, - /// Scalar corresponding to the seconds since Epoch at this block's inception. - pub timestamp: u64, - /// Arbitrary byte array containing data relevant for this block. - pub extra_data: Bytes, - /// Hash previously used for the PoW now containing the RANDAO value. - pub mix_hash: B256, - /// List of stake withdrawals for execution - pub withdrawals: Vec, /// State trie of the parent block. pub parent_state_trie: MptNode, /// Maps each address with its storage trie and the used storage slots. @@ -52,13 +40,6 @@ pub struct GuestInput { pub contracts: Vec, /// List of at most 256 previous block headers pub ancestor_headers: Vec
, - /// Base fee per gas - pub base_fee_per_gas: u64, - - pub blob_gas_used: Option, - pub excess_blob_gas: Option, - pub parent_beacon_block_root: Option, - /// Taiko specific data pub taiko: TaikoGuestInput, } @@ -69,7 +50,7 @@ pub struct TaikoGuestInput { /// header pub l1_header: Header, pub tx_data: Vec, - pub anchor_tx: String, + pub anchor_tx: Option, pub block_proposed: BlockProposed, pub prover_data: TaikoProverData, pub blob_commitment: Option>, @@ -117,23 +98,6 @@ pub struct GuestOutput { pub hash: B256, } -sol! { - function anchor( - bytes32 l1Hash, - bytes32 l1StateRoot, - uint64 l1BlockId, - uint32 parentGasUsed - ) - external - {} -} - -#[inline] -pub fn decode_anchor(bytes: &[u8]) -> Result { - anchorCall::abi_decode(bytes, true).map_err(|e| anyhow!(e)) - // .context("Invalid anchor call") -} - sol! { #[derive(Debug, Default, Deserialize, Serialize)] struct EthDeposit { diff --git a/lib/src/protocol_instance.rs b/lib/src/protocol_instance.rs index cd642be97..f6e7ba0e1 100644 --- a/lib/src/protocol_instance.rs +++ b/lib/src/protocol_instance.rs @@ -96,16 +96,6 @@ impl ProtocolInstance { ); } - let deposits = input - .withdrawals - .iter() - .map(|w| EthDeposit { - recipient: w.address, - amount: w.amount as u128, - id: w.index, - }) - .collect::>(); - let verifier_address = (*input .chain_spec .verifier_address @@ -125,7 +115,7 @@ impl ProtocolInstance { difficulty: input.taiko.block_proposed.meta.difficulty, blobHash: tx_list_hash, extraData: bytes_to_bytes32(&header.extra_data).into(), - depositsHash: keccak(deposits.abi_encode()).into(), + depositsHash: keccak(Vec::::new().abi_encode()).into(), coinbase: header.beneficiary, id: header.number, gasLimit: (header.gas_limit diff --git a/lib/src/utils.rs b/lib/src/utils.rs index a1c9b8544..fe9860a9d 100644 --- a/lib/src/utils.rs +++ b/lib/src/utils.rs @@ -1,20 +1,18 @@ use std::io::Read; use std::io::Write; -use alloy_consensus::{Signed, TxEip1559, TxEnvelope}; -use alloy_primitives::{Signature, TxKind}; use alloy_rlp::Decodable; -use alloy_rpc_types::Transaction as AlloyTransaction; use anyhow::Result; use libflate::zlib::Decoder as zlibDecoder; use libflate::zlib::Encoder as zlibEncoder; +use reth_primitives::TransactionSigned; use crate::consts::{ChainSpec, Network}; #[cfg(not(feature = "std"))] use crate::no_std::*; -pub fn decode_transactions(tx_list: &[u8]) -> Vec { - Vec::::decode(&mut &tx_list.to_owned()[..]).unwrap_or_else(|e| { +pub fn decode_transactions(tx_list: &[u8]) -> Vec { + Vec::::decode(&mut tx_list.as_ref()).unwrap_or_else(|e| { // If decoding fails we need to make an empty block println!("decode_transactions not successful: {e:?}, use empty tx_list"); vec![] @@ -31,25 +29,24 @@ fn get_tx_list(chain_spec: &ChainSpec, is_blob_data: bool, tx_list: &[u8]) -> Ve // taiko has some limitations to be aligned with taiko-client if is_blob_data { let compressed_tx_list = decode_blob_data(tx_list); - return zlib_decompress_data(&compressed_tx_list).unwrap_or_default(); - } - - if Network::TaikoA7.to_string() == chain_spec.network() { - let de_tx_list: Vec = zlib_decompress_data(tx_list).unwrap_or_default(); - - if validate_calldata_tx_list(&de_tx_list) { - return de_tx_list; - } - - println!("validate_calldata_tx_list failed, use empty tx_list"); - return vec![]; - } - - if validate_calldata_tx_list(tx_list) { - zlib_decompress_data(tx_list).unwrap_or_default() + zlib_decompress_data(&compressed_tx_list).unwrap_or_default() } else { - println!("validate_calldata_tx_list failed, use empty tx_list"); - vec![] + if Network::TaikoA7.to_string() == chain_spec.network() { + let tx_list = zlib_decompress_data(tx_list).unwrap_or_default(); + if validate_calldata_tx_list(&tx_list) { + tx_list + } else { + println!("validate_calldata_tx_list failed, use empty tx_list"); + vec![] + } + } else { + if validate_calldata_tx_list(tx_list) { + zlib_decompress_data(tx_list).unwrap_or_default() + } else { + println!("validate_calldata_tx_list failed, use empty tx_list"); + vec![] + } + } } } else { // no limitation on non-taiko chains @@ -61,38 +58,15 @@ pub fn generate_transactions( chain_spec: &ChainSpec, is_blob_data: bool, tx_list: &[u8], - anchor_tx: Option, -) -> Vec { + anchor_tx: &Option, +) -> Vec { // Decode the tx list from the raw data posted onchain let tx_list = get_tx_list(chain_spec, is_blob_data, tx_list); - // Decode the transactions from the tx list let mut transactions = decode_transactions(&tx_list); + // Add the anchor tx at the start of the list if let Some(anchor_tx) = anchor_tx { - // Create a tx from the anchor tx that has the same type as the transactions encoded from - // the tx list - let signed_eip1559_tx = Signed::::new_unchecked( - TxEip1559 { - chain_id: anchor_tx.chain_id.unwrap(), - nonce: anchor_tx.nonce, - gas_limit: anchor_tx.gas, - max_fee_per_gas: anchor_tx.max_fee_per_gas.unwrap(), - max_priority_fee_per_gas: anchor_tx.max_priority_fee_per_gas.unwrap(), - to: TxKind::Call(anchor_tx.to.unwrap()), - value: anchor_tx.value, - access_list: Default::default(), - input: anchor_tx.input, - }, - Signature::from_rs_and_parity( - anchor_tx.signature.unwrap().r, - anchor_tx.signature.unwrap().s, - anchor_tx.signature.unwrap().y_parity.unwrap().0, - ) - .unwrap(), - anchor_tx.hash, - ); - // Insert the anchor transactions generated by the node (which needs to be verified!) - transactions.insert(0, TxEnvelope::from(signed_eip1559_tx)); + transactions.insert(0, anchor_tx.clone()); } transactions } From d5599305fe7e916d7afe257078558d4d450bcaf4 Mon Sep 17 00:00:00 2001 From: Brechtpd Date: Tue, 2 Jul 2024 07:27:11 +0200 Subject: [PATCH 2/4] simplify transaction serialization --- core/src/preflight.rs | 54 ++++++++++++++----------------------------- lib/src/input.rs | 4 ++-- 2 files changed, 19 insertions(+), 39 deletions(-) diff --git a/core/src/preflight.rs b/core/src/preflight.rs index 7aa07aa00..48687aa0a 100644 --- a/core/src/preflight.rs +++ b/core/src/preflight.rs @@ -2,10 +2,9 @@ use crate::{ interfaces::{RaikoError, RaikoResult}, provider::{db::ProviderDb, rpc::RpcBlockDataProvider, BlockDataProvider}, }; -use alloy_consensus::TxEnvelope; pub use alloy_primitives::*; use alloy_provider::{Provider, ReqwestProvider}; -use alloy_rpc_types::{Block, BlockTransactions, Filter, Transaction as AlloyRpcTransaction}; +use alloy_rpc_types::{Filter, Transaction as AlloyRpcTransaction}; use alloy_sol_types::{SolCall, SolEvent}; use anyhow::{anyhow, bail, Result}; use kzg_traits::{ @@ -29,7 +28,7 @@ use raiko_lib::{ Measurement, }; use reth_evm_ethereum::taiko::decode_anchor; -use reth_primitives::Block as RethBlock; +use reth_primitives::Block; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use tracing::{debug, info, warn}; @@ -52,7 +51,7 @@ pub async fn preflight( blocks.first().ok_or_else(|| { RaikoError::Preflight("No block data for the requested block".to_owned()) })?, - &blocks.get(1).ok_or_else(|| { + blocks.get(1).ok_or_else(|| { RaikoError::Preflight("No parent block data for the requested block".to_owned()) })?, ); @@ -66,12 +65,17 @@ pub async fn preflight( debug!("block gas used: {:?}", block.header.gas_used); debug!("block transactions: {:?}", block.transactions.len()); + // Convert the alloy block to a reth block + let block = Block::try_from(block.clone()).map_err(|e| { + RaikoError::Conversion(format!("Failed converting to reth block: {}", e).to_owned()) + })?; + let taiko_guest_input = if taiko_chain_spec.is_taiko() { prepare_taiko_chain_input( &l1_chain_spec, &taiko_chain_spec, block_number, - block, + &block, prover_data, blob_proof_type, ) @@ -80,17 +84,15 @@ pub async fn preflight( // For Ethereum blocks we just convert the block transactions in a tx_list // so that we don't have to supports separate paths. TaikoGuestInput { - tx_data: zlib_compress_data(&alloy_rlp::encode(&get_transactions_from_block(block)?))?, + tx_data: zlib_compress_data(&alloy_rlp::encode(&block.body))?, ..Default::default() } }; measurement.stop(); - let reth_block = RethBlock::try_from(block.clone()).map_err(|e| { - RaikoError::Conversion(format!("Failed converting to reth block: {}", e).to_owned()) - })?; + // Create the guest input let input = GuestInput { - block: reth_block.clone(), + block: block.clone(), chain_spec: taiko_chain_spec.clone(), parent_state_trie: Default::default(), parent_storage: Default::default(), @@ -114,8 +116,8 @@ pub async fn preflight( ) .await?; + // Now re-execute the transactions in the block to collect all required data let mut builder = RethBlockBuilder::new(&input, provider_db); - // Optimize data gathering by executing the transactions multiple times so data can be requested in batches let is_local = false; let max_iterations = if is_local { 1 } else { 100 }; @@ -169,6 +171,7 @@ pub async fn preflight( } measurement.stop(); + // Fill in remaining generated guest input data let input = GuestInput { parent_state_trie: state_trie, parent_storage: storage, @@ -177,7 +180,6 @@ pub async fn preflight( ..input }; - // Add the collected data to the input Ok(input) } @@ -193,11 +195,8 @@ async fn prepare_taiko_chain_input( let provider_l1 = RpcBlockDataProvider::new(&l1_chain_spec.rpc, block_number)?; // Decode the anchor tx to find out which L1 blocks we need to fetch - let anchor_tx = match &block.transactions { - BlockTransactions::Full(txs) => txs[0].clone(), - _ => unreachable!(), - }; - let anchor_call = decode_anchor(anchor_tx.input.as_ref())?; + let anchor_tx = &block.body[0].clone(); + let anchor_call = decode_anchor(anchor_tx.input())?; // The L1 blocks we need let l1_state_block_number = anchor_call.l1BlockId; let l1_inclusion_block_number = l1_state_block_number + 1; @@ -268,7 +267,7 @@ async fn prepare_taiko_chain_input( Ok(TaikoGuestInput { l1_header: l1_state_block.header.clone().try_into().unwrap(), tx_data, - anchor_tx: Some(anchor_tx.try_into().unwrap()), + anchor_tx: Some(anchor_tx.clone()), blob_commitment, block_proposed: proposal_event, prover_data, @@ -465,25 +464,6 @@ async fn get_block_proposed_event( bail!("No BlockProposed event found for block {l2_block_number}"); } -fn get_transactions_from_block(block: &Block) -> RaikoResult> { - let mut transactions: Vec = Vec::new(); - if !block.transactions.is_empty() { - match &block.transactions { - BlockTransactions::Full(txs) => { - for tx in txs { - transactions.push(TxEnvelope::try_from(tx.clone()).unwrap()); - } - }, - _ => unreachable!("Block is too old, please connect to an archive node or use a block that is at most 128 blocks old."), - }; - assert!( - transactions.len() == block.transactions.len(), - "unexpected number of transactions" - ); - } - Ok(transactions) -} - #[cfg(test)] mod test { use ethers_core::types::Transaction; diff --git a/lib/src/input.rs b/lib/src/input.rs index e3f6cfa1f..22b796be6 100644 --- a/lib/src/input.rs +++ b/lib/src/input.rs @@ -11,7 +11,7 @@ use reth_primitives::{ use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use reth_primitives::{Block as RethBlock, Header}; +use reth_primitives::{Block, Header}; #[cfg(not(feature = "std"))] use crate::no_std::*; @@ -27,7 +27,7 @@ pub type StorageEntry = (MptNode, Vec); #[derive(Debug, Clone, Default, Deserialize, Serialize)] pub struct GuestInput { /// Reth block - pub block: RethBlock, + pub block: Block, /// The network to generate the proof for pub chain_spec: ChainSpec, /// Previous block header From 8f9477f8ce57e2fabe446e0fc8e72d642d9e2425 Mon Sep 17 00:00:00 2001 From: Brechtpd Date: Tue, 2 Jul 2024 07:35:00 +0200 Subject: [PATCH 3/4] update guest packages to new reth git version --- provers/risc0/guest/Cargo.lock | 74 +++++++++++++++++----------------- provers/sp1/guest/Cargo.lock | 74 +++++++++++++++++----------------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/provers/risc0/guest/Cargo.lock b/provers/risc0/guest/Cargo.lock index d0eace428..691f3d8c8 100644 --- a/provers/risc0/guest/Cargo.lock +++ b/provers/risc0/guest/Cargo.lock @@ -776,9 +776,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779e6b7d17797c0b42023d417228c02889300190e700cb074c3438d9c541d332" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cfg-if" @@ -2133,7 +2133,7 @@ dependencies = [ "rust-kzg-zkcrypto", "serde", "serde_json", - "serde_with 3.8.1", + "serde_with 3.8.2", "sha2 0.10.8", "sha3", "thiserror", @@ -2248,7 +2248,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reth-chainspec" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-eips", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "reth-codecs" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -2293,7 +2293,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-primitives", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -2313,7 +2313,7 @@ dependencies = [ [[package]] name = "reth-db" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -2339,7 +2339,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -2358,7 +2358,7 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-primitives", @@ -2383,7 +2383,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "futures-util", @@ -2400,7 +2400,7 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-sol-types", @@ -2420,7 +2420,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-primitives", @@ -2434,7 +2434,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-execution-errors", "reth-primitives", @@ -2445,7 +2445,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "serde_json", "thiserror", @@ -2454,7 +2454,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "metrics", "reth-metrics-derive", @@ -2463,7 +2463,7 @@ dependencies = [ [[package]] name = "reth-metrics-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "once_cell", "proc-macro2", @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2509,7 +2509,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2528,7 +2528,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -2542,7 +2542,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-rlp", @@ -2560,7 +2560,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -2573,7 +2573,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "derive_more", @@ -2584,7 +2584,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-chainspec", @@ -2601,7 +2601,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-fs-util", "reth-primitives", @@ -2611,7 +2611,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "clap", "eyre", @@ -2626,7 +2626,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rlp", "auto_impl", @@ -2645,7 +2645,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -3120,9 +3120,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.118" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "indexmap 2.2.6", "itoa", @@ -3148,9 +3148,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +checksum = "079f3a42cd87588d924ed95b533f8d30a483388c4e400ab736a7058e34f16169" dependencies = [ "base64 0.22.1", "chrono", @@ -3160,7 +3160,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with_macros 3.8.1", + "serde_with_macros 3.8.2", "time", ] @@ -3178,9 +3178,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +checksum = "bc03aad67c1d26b7de277d51c86892e7d9a0110a2fe44bf6b26cc569fba302d6" dependencies = [ "darling", "proc-macro2", diff --git a/provers/sp1/guest/Cargo.lock b/provers/sp1/guest/Cargo.lock index 49592c66b..e93bb71ea 100644 --- a/provers/sp1/guest/Cargo.lock +++ b/provers/sp1/guest/Cargo.lock @@ -643,9 +643,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779e6b7d17797c0b42023d417228c02889300190e700cb074c3438d9c541d332" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cfg-if" @@ -1970,7 +1970,7 @@ dependencies = [ "rust-kzg-zkcrypto", "serde", "serde_json", - "serde_with 3.8.1", + "serde_with 3.8.2", "sha2 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)", "sha3", "thiserror", @@ -2094,7 +2094,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reth-chainspec" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-eips", @@ -2113,7 +2113,7 @@ dependencies = [ [[package]] name = "reth-codecs" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2128,7 +2128,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "convert_case 0.6.0", "proc-macro2", @@ -2139,7 +2139,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-primitives", @@ -2149,7 +2149,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "reth-db" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -2185,7 +2185,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "bytes", "derive_more", @@ -2204,7 +2204,7 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-chainspec", "reth-consensus", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-chains", "alloy-primitives", @@ -2229,7 +2229,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "futures-util", @@ -2246,7 +2246,7 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-sol-types", @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-primitives", @@ -2280,7 +2280,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-execution-errors", "reth-primitives", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "serde_json", "thiserror", @@ -2300,7 +2300,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "metrics", "reth-metrics-derive", @@ -2309,7 +2309,7 @@ dependencies = [ [[package]] name = "reth-metrics-derive" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "once_cell", "proc-macro2", @@ -2321,7 +2321,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -2388,7 +2388,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-eips", "alloy-rlp", @@ -2406,7 +2406,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "bytes", @@ -2419,7 +2419,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-primitives", "derive_more", @@ -2430,7 +2430,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "auto_impl", "reth-chainspec", @@ -2447,7 +2447,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "reth-fs-util", "reth-primitives", @@ -2457,7 +2457,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "clap", "eyre", @@ -2472,7 +2472,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-rlp", "auto_impl", @@ -2491,7 +2491,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.0.0-rc.2" -source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#c73555d1d94dcbb602370415291d1f4e577ce006" +source = "git+https://github.com/taikoxyz/taiko-reth.git?branch=v1.0.0-rc.2-taiko#3043c66ac743ef765f7c403f589d124d115ff9eb" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -2836,9 +2836,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.118" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "indexmap 2.2.6", "itoa", @@ -2864,9 +2864,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +checksum = "079f3a42cd87588d924ed95b533f8d30a483388c4e400ab736a7058e34f16169" dependencies = [ "base64 0.22.1", "chrono", @@ -2876,7 +2876,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with_macros 3.8.1", + "serde_with_macros 3.8.2", "time", ] @@ -2894,9 +2894,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +checksum = "bc03aad67c1d26b7de277d51c86892e7d9a0110a2fe44bf6b26cc569fba302d6" dependencies = [ "darling", "proc-macro2", From fbbfd2bf2c60078a0f66c5be7d499df13f1b2a42 Mon Sep 17 00:00:00 2001 From: Brechtpd Date: Tue, 2 Jul 2024 07:40:44 +0200 Subject: [PATCH 4/4] fix sgx --- provers/sgx/guest/src/one_shot.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provers/sgx/guest/src/one_shot.rs b/provers/sgx/guest/src/one_shot.rs index ab4f78ded..4c4cfee71 100644 --- a/provers/sgx/guest/src/one_shot.rs +++ b/provers/sgx/guest/src/one_shot.rs @@ -136,7 +136,7 @@ pub async fn one_shot(global_opts: GlobalOpts, args: OneShotArgs) -> Result<()> println!( "Block {}. PI data to be signed: {pi_hash}", - input.block_number + input.block.number ); // Sign the public input hash which contains all required block inputs and outputs