From 80f3c0b9bcd38d876e5113af84d0018e035e49af Mon Sep 17 00:00:00 2001 From: smtmfft Date: Thu, 25 Jul 2024 17:03:50 +0800 Subject: [PATCH 01/10] prepare for ontake upgrade Signed-off-by: smtmfft --- Cargo.lock | 180 +++++++++++++++++--------- Cargo.toml | 10 +- crates/ethereum-forks/Cargo.toml | 1 + crates/ethereum-forks/src/hardfork.rs | 7 +- crates/ethereum/evm/src/lib.rs | 2 +- crates/primitives/Cargo.toml | 1 + crates/primitives/src/revm/config.rs | 21 ++- testing/ef-tests/Cargo.toml | 2 - 8 files changed, 147 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 545e39190424..ba8e8d0accae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,7 +132,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "arbitrary", - "c-kzg", + "c-kzg 1.0.2", "proptest", "proptest-derive", "serde", @@ -166,7 +166,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "arbitrary", - "c-kzg", + "c-kzg 1.0.2", "derive_more", "once_cell", "proptest", @@ -1577,6 +1577,19 @@ dependencies = [ "serde", ] +[[package]] +name = "c-kzg" +version = "1.0.0" +source = "git+https://github.com/brechtpd/c-kzg-4844?branch=for-alpha7#3bf0372e8c7a4ba908aff65da0508fcaaf9d38e6" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "serde", +] + [[package]] name = "c-kzg" version = "1.0.2" @@ -2698,14 +2711,23 @@ name = "ef-tests" version = "1.0.0-rc.2" dependencies = [ "alloy-rlp", + "anyhow", "rayon", "reth-chainspec", "reth-db", "reth-db-api", "reth-evm-ethereum", + "reth-network-api", + "reth-node-ethereum", "reth-primitives", "reth-provider", + "reth-revm", + "reth-rpc", + "reth-rpc-types", + "reth-rpc-types-compat", "reth-stages", + "reth-tasks", + "reth-transaction-pool", "serde", "serde_json", "thiserror", @@ -5331,18 +5353,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2 0.10.8", -] - [[package]] name = "page_size" version = "0.6.0" @@ -5754,15 +5764,6 @@ dependencies = [ "syn 2.0.66", ] -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "primitive-types" version = "0.12.2" @@ -6340,7 +6341,7 @@ dependencies = [ "reth-revm", "reth-tasks", "reth-transaction-pool", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "tokio", "tracing", ] @@ -6961,7 +6962,7 @@ dependencies = [ "reth-primitives", "reth-rpc-types", "reth-rpc-types-compat", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde", "serde_json", "sha2 0.10.8", @@ -6995,7 +6996,7 @@ dependencies = [ "reth-provider", "reth-revm", "reth-transaction-pool", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "tracing", ] @@ -7022,8 +7023,8 @@ dependencies = [ "reth-primitives", "reth-prune-types", "reth-storage-errors", - "revm", - "revm-primitives", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", ] [[package]] @@ -7032,7 +7033,10 @@ version = "1.0.0-rc.2" dependencies = [ "alloy-eips", "alloy-sol-types", + "anyhow", + "lazy_static", "reth-chainspec", + "reth-consensus", "reth-ethereum-consensus", "reth-evm", "reth-execution-types", @@ -7040,7 +7044,7 @@ dependencies = [ "reth-prune-types", "reth-revm", "reth-testing-utils", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "secp256k1", "serde_json", ] @@ -7058,8 +7062,8 @@ dependencies = [ "reth-provider", "reth-prune-types", "reth-revm", - "revm", - "revm-primitives", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "thiserror", "tracing", ] @@ -7073,7 +7077,7 @@ dependencies = [ "reth-consensus", "reth-prune-types", "reth-storage-errors", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "thiserror-no-std", ] @@ -7087,7 +7091,7 @@ dependencies = [ "reth-execution-errors", "reth-primitives", "reth-trie", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", ] [[package]] @@ -7592,7 +7596,7 @@ dependencies = [ "reth-rpc-types-compat", "reth-tracing", "reth-transaction-pool", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde", "serde_json", "thiserror", @@ -7628,7 +7632,7 @@ dependencies = [ "reth-rpc-types", "reth-rpc-types-compat", "reth-transaction-pool", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "sha2 0.10.8", "thiserror", "tracing", @@ -7652,7 +7656,7 @@ dependencies = [ "reth-provider", "reth-rpc-types", "reth-transaction-pool", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde_json", "thiserror", "tokio", @@ -7699,7 +7703,7 @@ dependencies = [ "assert_matches", "byteorder", "bytes", - "c-kzg", + "c-kzg 1.0.2", "criterion", "derive_more", "modular-bitfield", @@ -7716,8 +7720,9 @@ dependencies = [ "reth-primitives-traits", "reth-static-file-types", "reth-trie-common", - "revm", - "revm-primitives", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "roaring", "secp256k1", "serde", @@ -7749,7 +7754,7 @@ dependencies = [ "proptest-derive", "rand 0.8.5", "reth-codecs", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde", "test-fuzz", ] @@ -7788,7 +7793,7 @@ dependencies = [ "reth-storage-errors", "reth-testing-utils", "reth-trie", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "strum", "tempfile", "tokio", @@ -7858,7 +7863,7 @@ dependencies = [ "reth-storage-api", "reth-storage-errors", "reth-trie", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "tracing", ] @@ -7904,9 +7909,9 @@ dependencies = [ "reth-tasks", "reth-testing-utils", "reth-transaction-pool", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "revm-inspectors", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "schnellru", "secp256k1", "serde", @@ -8221,7 +8226,7 @@ dependencies = [ "reth-stages-types", "reth-storage-errors", "reth-trie", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", ] [[package]] @@ -8342,7 +8347,7 @@ dependencies = [ "reth-stages-types", "reth-storage-errors", "reth-trie-common", - "revm", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde_json", "similar-asserts", "tokio", @@ -8372,7 +8377,7 @@ dependencies = [ "proptest-derive", "reth-codecs", "reth-primitives-traits", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde", "serde_json", "test-fuzz", @@ -8404,6 +8409,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "revm" +version = "9.0.0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +dependencies = [ + "auto_impl", + "cfg-if", + "dyn-clone", + "revm-interpreter 5.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "serde", + "serde_json", +] + [[package]] name = "revm" version = "9.0.0" @@ -8412,8 +8431,8 @@ dependencies = [ "auto_impl", "cfg-if", "dyn-clone", - "revm-interpreter", - "revm-precompile", + "revm-interpreter 5.0.0 (git+https://github.com/bluealloy/revm.git?rev=41e2f7f)", + "revm-precompile 7.0.0 (git+https://github.com/bluealloy/revm.git?rev=41e2f7f)", "serde", "serde_json", ] @@ -8430,32 +8449,56 @@ dependencies = [ "boa_engine", "boa_gc", "colorchoice", - "revm", + "revm 9.0.0 (git+https://github.com/bluealloy/revm.git?rev=41e2f7f)", "serde_json", "thiserror", ] +[[package]] +name = "revm-interpreter" +version = "5.0.0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +dependencies = [ + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "serde", +] + [[package]] name = "revm-interpreter" version = "5.0.0" source = "git+https://github.com/bluealloy/revm.git?rev=41e2f7f#41e2f7f9740c0fb70c5ba888a36453712b6de39c" dependencies = [ - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/bluealloy/revm.git?rev=41e2f7f)", "serde", ] [[package]] name = "revm-precompile" version = "7.0.0" -source = "git+https://github.com/bluealloy/revm.git?rev=41e2f7f#41e2f7f9740c0fb70c5ba888a36453712b6de39c" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" dependencies = [ "aurora-engine-modexp", "blst", - "c-kzg", + "c-kzg 1.0.0", + "k256", + "once_cell", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "ripemd", + "secp256k1", + "sha2 0.10.8", + "substrate-bn", +] + +[[package]] +name = "revm-precompile" +version = "7.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=41e2f7f#41e2f7f9740c0fb70c5ba888a36453712b6de39c" +dependencies = [ + "aurora-engine-modexp", + "c-kzg 1.0.2", "k256", "once_cell", - "p256", - "revm-primitives", + "revm-primitives 4.0.0 (git+https://github.com/bluealloy/revm.git?rev=41e2f7f)", "ripemd", "secp256k1", "sha2 0.10.8", @@ -8465,13 +8508,13 @@ dependencies = [ [[package]] name = "revm-primitives" version = "4.0.0" -source = "git+https://github.com/bluealloy/revm.git?rev=41e2f7f#41e2f7f9740c0fb70c5ba888a36453712b6de39c" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" dependencies = [ "alloy-primitives", "auto_impl", "bitflags 2.5.0", "bitvec", - "c-kzg", + "c-kzg 1.0.0", "cfg-if", "derive_more", "dyn-clone", @@ -8482,6 +8525,23 @@ dependencies = [ "serde", ] +[[package]] +name = "revm-primitives" +version = "4.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=41e2f7f#41e2f7f9740c0fb70c5ba888a36453712b6de39c" +dependencies = [ + "alloy-primitives", + "auto_impl", + "bitflags 2.5.0", + "bitvec", + "cfg-if", + "dyn-clone", + "enumn", + "hashbrown 0.14.5", + "hex", + "serde", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -8888,8 +8948,7 @@ dependencies = [ [[package]] name = "secp256k1" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#26d5313e6fb992a0f393ffcbf9be3c03b23295f1" dependencies = [ "rand 0.8.5", "secp256k1-sys", @@ -8899,8 +8958,7 @@ dependencies = [ [[package]] name = "secp256k1-sys" version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" +source = "git+https://github.com/CeciliaZ030/rust-secp256k1?branch=sp1-patch#26d5313e6fb992a0f393ffcbf9be3c03b23295f1" dependencies = [ "cc", ] diff --git a/Cargo.toml b/Cargo.toml index cef90dbb9607..d1a0a0de1f79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -504,18 +504,16 @@ similar-asserts = "1.5.0" test-fuzz = "5" # raiko -raiko-core = { git = "https://github.com/taikoxyz/raiko.git", branch = "reth-wip" } -raiko-lib = { git = "https://github.com/taikoxyz/raiko.git", branch = "reth-wip" } anyhow = "1.0" [patch.crates-io] -revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko", default-features = false, features = [ +revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake", default-features = false, features = [ "std", "serde", "taiko", ]} -revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko" } -revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko" } -revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko"} +revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake" } +revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake" } +revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake"} c-kzg = { git = "https://github.com/brechtpd/c-kzg-4844", branch = "for-alpha7" } secp256k1 = { git = "https://github.com/CeciliaZ030/rust-secp256k1", branch = "sp1-patch" } \ No newline at end of file diff --git a/crates/ethereum-forks/Cargo.toml b/crates/ethereum-forks/Cargo.toml index ac9836c5438a..fc8dab7649ff 100644 --- a/crates/ethereum-forks/Cargo.toml +++ b/crates/ethereum-forks/Cargo.toml @@ -36,6 +36,7 @@ proptest-derive.workspace = true [features] default = ["std", "serde"] +taiko = [] std = ["thiserror-no-std/std"] serde = ["dep:serde"] arbitrary = ["dep:arbitrary", "dep:proptest", "dep:proptest-derive"] diff --git a/crates/ethereum-forks/src/hardfork.rs b/crates/ethereum-forks/src/hardfork.rs index fa095dea5a18..e5c1d7cadcc3 100644 --- a/crates/ethereum-forks/src/hardfork.rs +++ b/crates/ethereum-forks/src/hardfork.rs @@ -75,8 +75,13 @@ pub enum Hardfork { /// Ecotone: . #[cfg(feature = "optimism")] Ecotone, + /// Hekla: the 1st taiko mainnet version: <> + #[cfg(feature = "taiko")] + Hekla, + /// Ontake: the 1st taiko mainnet fork: <> + #[cfg(feature = "taiko")] + Ontake, // ArbOS20Atlas, - // Upcoming /// Prague: Prague, diff --git a/crates/ethereum/evm/src/lib.rs b/crates/ethereum/evm/src/lib.rs index 2d7d179aa014..b1fc31d681cb 100644 --- a/crates/ethereum/evm/src/lib.rs +++ b/crates/ethereum/evm/src/lib.rs @@ -15,8 +15,8 @@ use reth_primitives::{ revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv}, Address, Head, Header, TransactionSigned, U256, }; -use reth_revm::{Database, EvmBuilder}; use reth_revm::taiko::handler_register; +use reth_revm::{Database, EvmBuilder}; pub mod execute; pub mod taiko; diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 080df0b8e3ab..d1f4cf25207a 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -121,6 +121,7 @@ optimism = [ taiko = [ "revm-primitives/taiko", "revm/taiko", + "reth-ethereum-forks/taiko", ] alloy-compat = [ "reth-primitives-traits/alloy-compat", diff --git a/crates/primitives/src/revm/config.rs b/crates/primitives/src/revm/config.rs index 5914dbf59348..2cfe7cdf16e7 100644 --- a/crates/primitives/src/revm/config.rs +++ b/crates/primitives/src/revm/config.rs @@ -21,7 +21,7 @@ pub fn revm_spec_by_timestamp_after_merge( revm_primitives::REGOLITH } else { revm_primitives::BEDROCK - } + }; } if chain_spec.is_prague_active_at_timestamp(timestamp) { @@ -40,15 +40,24 @@ pub fn revm_spec(chain_spec: &ChainSpec, block: Head) -> revm_primitives::SpecId #[cfg(feature = "optimism")] if chain_spec.is_optimism() { if chain_spec.fork(Hardfork::Fjord).active_at_head(&block) { - return revm_primitives::FJORD + return revm_primitives::FJORD; } else if chain_spec.fork(Hardfork::Ecotone).active_at_head(&block) { - return revm_primitives::ECOTONE + return revm_primitives::ECOTONE; } else if chain_spec.fork(Hardfork::Canyon).active_at_head(&block) { - return revm_primitives::CANYON + return revm_primitives::CANYON; } else if chain_spec.fork(Hardfork::Regolith).active_at_head(&block) { - return revm_primitives::REGOLITH + return revm_primitives::REGOLITH; } else if chain_spec.fork(Hardfork::Bedrock).active_at_head(&block) { - return revm_primitives::BEDROCK + return revm_primitives::BEDROCK; + } + } + + #[cfg(feature = "taiko")] + if chain_spec.is_taiko() { + if chain_spec.fork(Hardfork::Ontake).active_at_head(&block) { + return revm_primitives::ONTAKE; + } else if chain_spec.fork(Hardfork::Hekla).active_at_head(&block) { + return revm_primitives::HEKLA; } } diff --git a/testing/ef-tests/Cargo.toml b/testing/ef-tests/Cargo.toml index 0eef88fabf84..6fc08af3276d 100644 --- a/testing/ef-tests/Cargo.toml +++ b/testing/ef-tests/Cargo.toml @@ -41,6 +41,4 @@ thiserror.workspace = true rayon.workspace = true # raiko -raiko-core.workspace = true -raiko-lib.workspace = true anyhow.workspace = true From bf329f44c2ab8ea2bcaa89ed7dbe320cbb3a7da1 Mon Sep 17 00:00:00 2001 From: smtmfft Date: Wed, 31 Jul 2024 15:46:10 +0800 Subject: [PATCH 02/10] config fork & add new anchor logic --- crates/chainspec/Cargo.toml | 1 + crates/chainspec/src/spec.rs | 14 ++- crates/ethereum-forks/src/hardfork.rs | 12 +-- crates/ethereum/evm/src/execute.rs | 84 +++++++++++++---- crates/ethereum/evm/src/taiko.rs | 124 +++++++++++++++++--------- crates/primitives/src/revm/env.rs | 2 +- 6 files changed, 166 insertions(+), 71 deletions(-) diff --git a/crates/chainspec/Cargo.toml b/crates/chainspec/Cargo.toml index 6bd5bb26a5b0..8702d6851af0 100644 --- a/crates/chainspec/Cargo.toml +++ b/crates/chainspec/Cargo.toml @@ -50,3 +50,4 @@ arbitrary = [ "alloy-chains/arbitrary" ] network = ["reth-network-peers"] +taiko = ["reth-ethereum-forks/taiko"] diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 18eb95b6e14c..835e8690811f 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -118,6 +118,8 @@ pub static TAIKO_A7: Lazy> = Lazy::new(|| { ForkCondition::TTD { fork_block: None, total_difficulty: U256::from(0) }, ), (Hardfork::Shanghai, ForkCondition::Timestamp(0)), + #[cfg(feature = "taiko")] + (Hardfork::Hekla, ForkCondition::Block(0)), ]), deposit_contract: None, ..Default::default() @@ -150,6 +152,10 @@ pub static TAIKO_DEV: Lazy> = Lazy::new(|| { ForkCondition::TTD { fork_block: None, total_difficulty: U256::from(0) }, ), (Hardfork::Shanghai, ForkCondition::Timestamp(0)), + #[cfg(feature = "taiko")] + (Hardfork::Hekla, ForkCondition::Block(0)), + #[cfg(feature = "taiko")] + (Hardfork::Ontake, ForkCondition::Block(9999999)), //todo ]), deposit_contract: None, ..Default::default() @@ -174,14 +180,16 @@ pub static TAIKO_MAINNET: Lazy> = Lazy::new(|| { (Hardfork::Byzantium, ForkCondition::Block(0)), (Hardfork::Constantinople, ForkCondition::Block(0)), (Hardfork::Petersburg, ForkCondition::Block(0)), - (Hardfork::Istanbul, ForkCondition::Block(1561651)), - (Hardfork::Berlin, ForkCondition::Block(4460644)), - (Hardfork::London, ForkCondition::Block(5062605)), + (Hardfork::Istanbul, ForkCondition::Block(0)), + (Hardfork::Berlin, ForkCondition::Block(0)), + (Hardfork::London, ForkCondition::Block(0)), ( Hardfork::Paris, ForkCondition::TTD { fork_block: None, total_difficulty: U256::from(0) }, ), (Hardfork::Shanghai, ForkCondition::Timestamp(0)), + #[cfg(feature = "taiko")] + (Hardfork::Hekla, ForkCondition::Block(0)), ]), deposit_contract: None, ..Default::default() diff --git a/crates/ethereum-forks/src/hardfork.rs b/crates/ethereum-forks/src/hardfork.rs index e5c1d7cadcc3..8de845c2d728 100644 --- a/crates/ethereum-forks/src/hardfork.rs +++ b/crates/ethereum-forks/src/hardfork.rs @@ -65,6 +65,12 @@ pub enum Hardfork { Regolith, /// Shanghai: . Shanghai, + /// Hekla: the 1st taiko mainnet version: <> + #[cfg(feature = "taiko")] + Hekla, + /// Ontake: the 1st taiko mainnet fork: <> + #[cfg(feature = "taiko")] + Ontake, /// Canyon: /// . #[cfg(feature = "optimism")] @@ -75,12 +81,6 @@ pub enum Hardfork { /// Ecotone: . #[cfg(feature = "optimism")] Ecotone, - /// Hekla: the 1st taiko mainnet version: <> - #[cfg(feature = "taiko")] - Hekla, - /// Ontake: the 1st taiko mainnet fork: <> - #[cfg(feature = "taiko")] - Ontake, // ArbOS20Atlas, // Upcoming /// Prague: diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 449b2ef762b4..e292a622b565 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -2,11 +2,13 @@ use crate::{ dao_fork::{DAO_HARDFORK_BENEFICIARY, DAO_HARDKFORK_ACCOUNTS}, - taiko::{check_anchor_tx, TaikoData}, EthEvmConfig, + taiko::{check_anchor_tx, check_anchor_tx_ontake, TaikoData}, + EthEvmConfig, }; +use anyhow::Result; use reth_chainspec::{ChainSpec, MAINNET}; pub use reth_consensus::Consensus; -pub use reth_ethereum_consensus::{EthBeaconConsensus, validate_block_post_execution}; +pub use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus}; use reth_evm::{ execute::{ BatchExecutor, BlockExecutionError, BlockExecutionInput, BlockExecutionOutput, @@ -16,7 +18,8 @@ use reth_evm::{ }; use reth_execution_types::ExecutionOutcome; use reth_primitives::{ - BlockNumber, BlockWithSenders, Hardfork, Header, Receipt, Request, Withdrawals, U256, + revm::config::revm_spec, BlockNumber, BlockWithSenders, Hardfork, Head, Header, Receipt, + Request, Withdrawals, U256, }; use reth_prune_types::PruneModes; use reth_revm::{ @@ -26,15 +29,14 @@ use reth_revm::{ apply_beacon_root_contract_call, apply_blockhashes_update, apply_withdrawal_requests_contract_call, post_block_balance_increments, }, - Evm, State, - JournaledState, + Evm, JournaledState, State, }; use revm_primitives::{ - db::{Database, DatabaseCommit}, Address, BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, - EVMError, HashSet, + db::{Database, DatabaseCommit}, + Address, BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, HashSet, ResultAndState, + SpecId, }; use std::sync::Arc; -use anyhow::Result; /// Provides executors to execute regular ethereum blocks #[derive(Debug, Clone)] @@ -176,8 +178,24 @@ where // verify the anchor tx if is_anchor { - check_anchor_tx(transaction, sender, &block.block, taiko_data.clone().unwrap()) + let spec_id = revm_spec( + &self.chain_spec, + Head { number: block.number, ..Default::default() }, + ); + if spec_id.is_enabled_in(SpecId::ONTAKE) { + check_anchor_tx_ontake( + transaction, + sender, + &block.block, + taiko_data.clone().unwrap(), + ) .map_err(|e| BlockExecutionError::CanonicalRevert { inner: e.to_string() })?; + } else { + check_anchor_tx(transaction, sender, &block.block, taiko_data.clone().unwrap()) + .map_err(|e| BlockExecutionError::CanonicalRevert { + inner: e.to_string(), + })?; + } } // If the signature was not valid, the sender address will have been set to zero @@ -188,7 +206,9 @@ where continue; } // In all other cases, the tx needs to have a valid signature - return Err(BlockExecutionError::CanonicalRevert { inner: "invalid tx".to_string() }); + return Err(BlockExecutionError::CanonicalRevert { + inner: "invalid tx".to_string(), + }); } // The sum of the transaction’s gas limit, Tg, and the gas utilized in this block prior, @@ -202,7 +222,7 @@ where transaction_gas_limit: transaction.gas_limit(), block_available_gas, } - .into()) + .into()); } EvmConfig::fill_tx_env(evm.tx_mut(), transaction, *sender); @@ -211,6 +231,7 @@ where evm.tx_mut().taiko.is_anchor = is_anchor; // set the treasury address evm.tx_mut().taiko.treasury = taiko_data.clone().unwrap().l2_contract; + evm.tx_mut().taiko.basefee_ratio = taiko_data.clone().unwrap().basefee_ratio; // Execute transaction. let res = evm.transact().map_err(move |err| { @@ -222,7 +243,8 @@ where }); if res.is_err() { // Clear the state for the next tx - evm.context.evm.journaled_state = JournaledState::new(evm.context.evm.journaled_state.spec, HashSet::new()); + evm.context.evm.journaled_state = + JournaledState::new(evm.context.evm.journaled_state.spec, HashSet::new()); if optimistic { continue; @@ -239,11 +261,13 @@ where println!("Invalid tx at {}: {:?}", idx, invalid_transaction); // skip the tx continue; - }, + } _ => { // any other error is not allowed - return Err(BlockExecutionError::Validation(BlockValidationError::EVM { hash, error })); - }, + return Err(BlockExecutionError::Validation( + BlockValidationError::EVM { hash, error }, + )); + } }, _ => { // Any other type of error is not allowed @@ -289,7 +313,12 @@ where vec![] }; - Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used, valid_transaction_indices }) + Ok(EthExecuteOutput { + receipts, + requests, + gas_used: cumulative_gas_used, + valid_transaction_indices, + }) } } @@ -313,7 +342,12 @@ pub struct EthBlockExecutor { impl EthBlockExecutor { /// Creates a new Ethereum block executor. pub const fn new(chain_spec: Arc, evm_config: EvmConfig, state: State) -> Self { - Self { executor: EthEvmExecutor { chain_spec, evm_config }, state, optimistic: false, taiko_data: None } + Self { + executor: EthEvmExecutor { chain_spec, evm_config }, + state, + optimistic: false, + taiko_data: None, + } } /// Optimistic execution @@ -382,7 +416,12 @@ where let env = self.evm_env_for_block(&block.header, total_difficulty); let output = { let evm = self.executor.evm_config.evm_with_env(&mut self.state, env); - self.executor.execute_state_transitions(block, evm, self.optimistic, self.taiko_data.clone()) + self.executor.execute_state_transitions( + block, + evm, + self.optimistic, + self.taiko_data.clone(), + ) }?; // 3. apply post execution changes @@ -462,7 +501,14 @@ where // NOTE: we need to merge keep the reverts for the bundle retention self.state.merge_transitions(BundleRetention::Reverts); - Ok(BlockExecutionOutput { state: self.state.take_bundle(), receipts, requests, gas_used, db: self.state, valid_transaction_indices }) + Ok(BlockExecutionOutput { + state: self.state.take_bundle(), + receipts, + requests, + gas_used, + db: self.state, + valid_transaction_indices, + }) } } diff --git a/crates/ethereum/evm/src/taiko.rs b/crates/ethereum/evm/src/taiko.rs index 980cb30f9d60..9c305cdc8d1b 100644 --- a/crates/ethereum/evm/src/taiko.rs +++ b/crates/ethereum/evm/src/taiko.rs @@ -1,10 +1,10 @@ //! Taiko related functionality for the block executor. +use anyhow::{anyhow, bail, ensure, Context, Result}; +use lazy_static::lazy_static; use reth_primitives::{Block, Header, TransactionSigned, TxKind}; use revm_primitives::{alloy_primitives::uint, Address, U256}; use std::str::FromStr; -use lazy_static::lazy_static; -use anyhow::{bail, Context, Result, ensure, anyhow}; /// Data required to validate a Taiko Block #[derive(Clone, Debug, Default)] @@ -15,6 +15,8 @@ pub struct TaikoData { pub parent_header: Header, /// L2 contract pub l2_contract: Address, + /// base fee sharing ratio + pub basefee_ratio: u8, } /// Anchor tx gas limit @@ -36,7 +38,6 @@ lazy_static! { uint!(0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5_U256); } - /// check the anchor signature with fixed K value fn check_anchor_signature(anchor: &TransactionSigned) -> Result<()> { let sign = anchor.signature(); @@ -56,12 +57,7 @@ fn check_anchor_signature(anchor: &TransactionSigned) -> Result<()> { } return Ok(()); } - Err(anyhow!( - "r != *GX1 && r != GX2, r: {}, *GX1: {}, GX2: {}", - sign.r, - *GX1, - *GX2 - )) + Err(anyhow!("r != *GX1 && r != GX2, r: {}, *GX1: {}, GX2: {}", sign.r, *GX1, *GX2)) } use alloy_sol_types::{sol, SolCall}; @@ -80,44 +76,48 @@ sol! { ) external {} + + function anchorV2( + uint64 _anchorBlockId, + bytes32 _anchorStateRoot + ) + external + nonReentrant + {} } +// todo, use compiled abi once test passes +// sol!(TaikoL2, "./res/TaikoL2.json"); +// use TaikoL2::{anchor, anchorV2}; + /// Decode anchor tx data pub fn decode_anchor(bytes: &[u8]) -> Result { anchorCall::abi_decode(bytes, true).map_err(|e| anyhow!(e)) } /// Verifies the anchor tx correctness -pub fn check_anchor_tx(tx: &TransactionSigned, from: &Address, block: &Block, taiko_data: TaikoData) -> Result<()> { - let anchor = tx.as_eip1559().context(anyhow!("anchor tx is not an EIP1559 tx"))?; +pub fn check_anchor_tx( + tx: &TransactionSigned, + from: &Address, + block: &Block, + taiko_data: TaikoData, +) -> Result<()> { + let anchor: &reth_primitives::TxEip1559 = + tx.as_eip1559().context(anyhow!("anchor tx is not an EIP1559 tx"))?; // Check the signature check_anchor_signature(tx).context(anyhow!("failed to check anchor signature"))?; // Extract the `to` address - let TxKind::Call(to) = anchor.to else { - panic!("anchor tx not a smart contract call") - }; + let TxKind::Call(to) = anchor.to else { panic!("anchor tx not a smart contract call") }; // Check that it's from the golden touch address - ensure!( - *from == *GOLDEN_TOUCH_ACCOUNT, - "anchor transaction from mismatch" - ); + ensure!(*from == *GOLDEN_TOUCH_ACCOUNT, "anchor transaction from mismatch"); // Check that the L2 contract is being called - ensure!( - to == taiko_data.l2_contract, - "anchor transaction to mismatch" - ); + ensure!(to == taiko_data.l2_contract, "anchor transaction to mismatch"); // Tx can't have any ETH attached - ensure!( - anchor.value == U256::from(0), - "anchor transaction value mismatch" - ); + ensure!(anchor.value == U256::from(0), "anchor transaction value mismatch"); // Tx needs to have the expected gas limit - ensure!( - anchor.gas_limit == ANCHOR_GAS_LIMIT, - "anchor transaction gas price mismatch" - ); + ensure!(anchor.gas_limit == ANCHOR_GAS_LIMIT, "anchor transaction gas price mismatch"); // Check needs to have the base fee set to the block base fee ensure!( anchor.max_fee_per_gas == block.header.base_fee_per_gas.unwrap().into(), @@ -127,23 +127,63 @@ pub fn check_anchor_tx(tx: &TransactionSigned, from: &Address, block: &Block, ta // Okay now let's decode the anchor tx to verify the inputs let anchor_call = decode_anchor(&anchor.input)?; // The L1 blockhash needs to match the expected value + ensure!(anchor_call.l1Hash == taiko_data.l1_header.hash_slow(), "L1 hash mismatch"); + ensure!(anchor_call.l1StateRoot == taiko_data.l1_header.state_root, "L1 state root mismatch"); + ensure!(anchor_call.l1BlockId == taiko_data.l1_header.number, "L1 block number mismatch"); + // The parent gas used input needs to match the gas used value of the parent block ensure!( - anchor_call.l1Hash == taiko_data.l1_header.hash_slow(), - "L1 hash mismatch" - ); - ensure!( - anchor_call.l1StateRoot == taiko_data.l1_header.state_root, - "L1 state root mismatch" + anchor_call.parentGasUsed == taiko_data.parent_header.gas_used as u32, + "parentGasUsed mismatch" ); + + Ok(()) +} + +fn decode_anchor_ontake(bytes: &[u8]) -> Result { + anchorV2Call::abi_decode(bytes, true).map_err(|e| anyhow!(e)) +} + +/// Verifies the anchor tx correctness in ontake fork +pub fn check_anchor_tx_ontake( + tx: &TransactionSigned, + from: &Address, + block: &Block, + taiko_data: TaikoData, +) -> Result<()> { + let anchor: &reth_primitives::TxEip1559 = + tx.as_eip1559().context(anyhow!("anchor tx is not an EIP1559 tx"))?; + + // Check the signature + check_anchor_signature(tx).context(anyhow!("failed to check anchor signature"))?; + + // Extract the `to` address + let TxKind::Call(to) = anchor.to else { panic!("anchor tx not a smart contract call") }; + // Check that it's from the golden touch address + ensure!(*from == *GOLDEN_TOUCH_ACCOUNT, "anchor transaction from mismatch"); + // Check that the L2 contract is being called + ensure!(to == taiko_data.l2_contract, "anchor transaction to mismatch"); + // Tx can't have any ETH attached + ensure!(anchor.value == U256::from(0), "anchor transaction value mismatch"); + // Tx needs to have the expected gas limit + ensure!(anchor.gas_limit == ANCHOR_GAS_LIMIT, "anchor transaction gas price mismatch"); + // Check needs to have the base fee set to the block base fee ensure!( - anchor_call.l1BlockId == taiko_data.l1_header.number, - "L1 block number mismatch" + anchor.max_fee_per_gas == block.header.base_fee_per_gas.unwrap().into(), + "anchor transaction gas mismatch" ); - // The parent gas used input needs to match the gas used value of the parent block + + /* + uint64 _anchorBlockId, + bytes32 _anchorStateRoot, + */ + + // Okay now let's decode the anchor tx to verify the inputs + let anchor_call = decode_anchor_ontake(&anchor.input)?; ensure!( - anchor_call.parentGasUsed == taiko_data.parent_header.gas_used as u32, - "parentGasUsed mismatch" + anchor_call._anchorStateRoot == taiko_data.l1_header.state_root, + "L1 state root mismatch" ); + ensure!(anchor_call._anchorBlockId == taiko_data.l1_header.number, "L1 block number mismatch"); Ok(()) -} \ No newline at end of file +} diff --git a/crates/primitives/src/revm/env.rs b/crates/primitives/src/revm/env.rs index 4cf85c273460..5bb81562f710 100644 --- a/crates/primitives/src/revm/env.rs +++ b/crates/primitives/src/revm/env.rs @@ -212,7 +212,7 @@ fn fill_tx_env_with_system_contract_call( enveloped_tx: Some(Bytes::default()), }, #[cfg(feature = "taiko")] - taiko: revm_primitives::TaikoFields { treasury: Address::default(), is_anchor: false }, + taiko: revm_primitives::TaikoFields { treasury: Address::default(), is_anchor: false, basefee_ratio: 0u8 }, }; // ensure the block gas limit is >= the tx From 2535a5d021f27bb3d045dd12805556a0a419e327 Mon Sep 17 00:00:00 2001 From: smtmfft Date: Tue, 6 Aug 2024 18:43:05 +0800 Subject: [PATCH 03/10] update anchor def Signed-off-by: smtmfft --- crates/ethereum/evm/src/taiko.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/ethereum/evm/src/taiko.rs b/crates/ethereum/evm/src/taiko.rs index 9c305cdc8d1b..d157417903e2 100644 --- a/crates/ethereum/evm/src/taiko.rs +++ b/crates/ethereum/evm/src/taiko.rs @@ -79,7 +79,10 @@ sol! { function anchorV2( uint64 _anchorBlockId, - bytes32 _anchorStateRoot + bytes32 _anchorStateRoot, + uint32 _parentGasUsed, + uint32 _gasIssuancePerSecond, + uint8 _basefeeAdjustmentQuotient ) external nonReentrant @@ -139,7 +142,7 @@ pub fn check_anchor_tx( Ok(()) } -fn decode_anchor_ontake(bytes: &[u8]) -> Result { +pub fn decode_anchor_ontake(bytes: &[u8]) -> Result { anchorV2Call::abi_decode(bytes, true).map_err(|e| anyhow!(e)) } @@ -173,8 +176,11 @@ pub fn check_anchor_tx_ontake( ); /* - uint64 _anchorBlockId, - bytes32 _anchorStateRoot, + uint64 _anchorBlockId, + bytes32 _anchorStateRoot, + uint32 _parentGasUsed, + uint32 _gasIssuancePerSecond, + uint8 _basefeeAdjustmentQuotient */ // Okay now let's decode the anchor tx to verify the inputs @@ -184,6 +190,12 @@ pub fn check_anchor_tx_ontake( "L1 state root mismatch" ); ensure!(anchor_call._anchorBlockId == taiko_data.l1_header.number, "L1 block number mismatch"); + ensure!(anchor_call._anchorStateRoot == taiko_data.l1_header.state_root, "L1 state root mismatch"); + // The parent gas used input needs to match the gas used value of the parent block + ensure!( + anchor_call.parentGasUsed == taiko_data.parent_header.gas_used as u32, + "parentGasUsed mismatch" + ); Ok(()) } From 70c1bab0d2683470f7c5fb4ae7b155c0a1710bdb Mon Sep 17 00:00:00 2001 From: smtmfft Date: Thu, 8 Aug 2024 10:01:30 +0800 Subject: [PATCH 04/10] sync with protocol change --- crates/chainspec/src/spec.rs | 2 +- crates/ethereum/evm/src/taiko.rs | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 835e8690811f..2e6c35a099c4 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -155,7 +155,7 @@ pub static TAIKO_DEV: Lazy> = Lazy::new(|| { #[cfg(feature = "taiko")] (Hardfork::Hekla, ForkCondition::Block(0)), #[cfg(feature = "taiko")] - (Hardfork::Ontake, ForkCondition::Block(9999999)), //todo + (Hardfork::Ontake, ForkCondition::Block(20)), //todo ]), deposit_contract: None, ..Default::default() diff --git a/crates/ethereum/evm/src/taiko.rs b/crates/ethereum/evm/src/taiko.rs index d157417903e2..05f833c76052 100644 --- a/crates/ethereum/evm/src/taiko.rs +++ b/crates/ethereum/evm/src/taiko.rs @@ -17,6 +17,10 @@ pub struct TaikoData { pub l2_contract: Address, /// base fee sharing ratio pub basefee_ratio: u8, + /// base fee adjustment quotient + pub basefee_adj_quotient: u8, + /// gas issuance per second + pub gas_issue_per_sec: u32, } /// Anchor tx gas limit @@ -190,12 +194,23 @@ pub fn check_anchor_tx_ontake( "L1 state root mismatch" ); ensure!(anchor_call._anchorBlockId == taiko_data.l1_header.number, "L1 block number mismatch"); - ensure!(anchor_call._anchorStateRoot == taiko_data.l1_header.state_root, "L1 state root mismatch"); + ensure!( + anchor_call._anchorStateRoot == taiko_data.l1_header.state_root, + "L1 state root mismatch" + ); // The parent gas used input needs to match the gas used value of the parent block ensure!( - anchor_call.parentGasUsed == taiko_data.parent_header.gas_used as u32, + anchor_call._parentGasUsed == taiko_data.parent_header.gas_used as u32, "parentGasUsed mismatch" ); + ensure!( + anchor_call._gasIssuancePerSecond == taiko_data.gas_issue_per_sec, + "gas issuance per second mismatch" + ); + ensure!( + anchor_call._basefeeAdjustmentQuotient == taiko_data.basefee_adj_quotient, + "basefee adjustment quotient mismatch" + ); Ok(()) } From d2598b8be05a244fda3e7fb2c761bf4bb2ef4e6a Mon Sep 17 00:00:00 2001 From: smtmfft Date: Fri, 9 Aug 2024 23:44:12 +0800 Subject: [PATCH 05/10] minor refine --- crates/ethereum/evm/src/execute.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index e292a622b565..998720e0752c 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -190,11 +190,15 @@ where taiko_data.clone().unwrap(), ) .map_err(|e| BlockExecutionError::CanonicalRevert { inner: e.to_string() })?; - } else { + } else if spec_id.is_enabled_in(SpecId::HEKLA) { check_anchor_tx(transaction, sender, &block.block, taiko_data.clone().unwrap()) .map_err(|e| BlockExecutionError::CanonicalRevert { inner: e.to_string(), })?; + } else { + return Err(BlockExecutionError::CanonicalRevert { + inner: "unknown spec id for anchor".to_string(), + }); } } From 2039f419be4b25a15a8c884a68036880b5fbf74d Mon Sep 17 00:00:00 2001 From: smtmfft Date: Sat, 10 Aug 2024 12:57:16 +0800 Subject: [PATCH 06/10] update cargo lock --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba8e8d0accae..d0b8f9013c58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8412,7 +8412,7 @@ dependencies = [ [[package]] name = "revm" version = "9.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" dependencies = [ "auto_impl", "cfg-if", @@ -8457,7 +8457,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "5.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" dependencies = [ "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", "serde", @@ -8475,7 +8475,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "7.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" dependencies = [ "aurora-engine-modexp", "blst", @@ -8508,7 +8508,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "4.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#a533af35f70e9bbcca451c6b728a493b2044e036" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" dependencies = [ "alloy-primitives", "auto_impl", From 919aaf56217b1682f28c44c0bae399080807e9e9 Mon Sep 17 00:00:00 2001 From: smtmfft <99081233+smtmfft@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:01:24 +0800 Subject: [PATCH 07/10] Update crates/ethereum-forks/src/hardfork.rs Co-authored-by: Brecht Devos --- crates/ethereum-forks/src/hardfork.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ethereum-forks/src/hardfork.rs b/crates/ethereum-forks/src/hardfork.rs index 8de845c2d728..4e5e4173659e 100644 --- a/crates/ethereum-forks/src/hardfork.rs +++ b/crates/ethereum-forks/src/hardfork.rs @@ -68,7 +68,7 @@ pub enum Hardfork { /// Hekla: the 1st taiko mainnet version: <> #[cfg(feature = "taiko")] Hekla, - /// Ontake: the 1st taiko mainnet fork: <> + /// Ontake: the 2nd taiko mainnet fork: <> #[cfg(feature = "taiko")] Ontake, /// Canyon: From eaf942ac8189930a65ba34610af0afc54b6851d3 Mon Sep 17 00:00:00 2001 From: smtmfft Date: Fri, 16 Aug 2024 00:17:09 +0800 Subject: [PATCH 08/10] revert pure fmt change --- crates/ethereum-forks/src/hardfork.rs | 1 + crates/ethereum/evm/src/execute.rs | 47 +++++----------------- crates/ethereum/evm/src/lib.rs | 2 +- crates/ethereum/evm/src/taiko.rs | 57 +++++++++++++++++++-------- crates/primitives/src/revm/config.rs | 12 +++--- 5 files changed, 58 insertions(+), 61 deletions(-) diff --git a/crates/ethereum-forks/src/hardfork.rs b/crates/ethereum-forks/src/hardfork.rs index 4e5e4173659e..cd10bce4d6bb 100644 --- a/crates/ethereum-forks/src/hardfork.rs +++ b/crates/ethereum-forks/src/hardfork.rs @@ -82,6 +82,7 @@ pub enum Hardfork { #[cfg(feature = "optimism")] Ecotone, // ArbOS20Atlas, + // Upcoming /// Prague: Prague, diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 998720e0752c..58c9d80ad467 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -210,9 +210,7 @@ where continue; } // In all other cases, the tx needs to have a valid signature - return Err(BlockExecutionError::CanonicalRevert { - inner: "invalid tx".to_string(), - }); + return Err(BlockExecutionError::CanonicalRevert { inner: "invalid tx".to_string() }); } // The sum of the transaction’s gas limit, Tg, and the gas utilized in this block prior, @@ -226,7 +224,7 @@ where transaction_gas_limit: transaction.gas_limit(), block_available_gas, } - .into()); + .into()) } EvmConfig::fill_tx_env(evm.tx_mut(), transaction, *sender); @@ -247,8 +245,7 @@ where }); if res.is_err() { // Clear the state for the next tx - evm.context.evm.journaled_state = - JournaledState::new(evm.context.evm.journaled_state.spec, HashSet::new()); + evm.context.evm.journaled_state = JournaledState::new(evm.context.evm.journaled_state.spec, HashSet::new()); if optimistic { continue; @@ -265,13 +262,11 @@ where println!("Invalid tx at {}: {:?}", idx, invalid_transaction); // skip the tx continue; - } + }, _ => { // any other error is not allowed - return Err(BlockExecutionError::Validation( - BlockValidationError::EVM { hash, error }, - )); - } + return Err(BlockExecutionError::Validation(BlockValidationError::EVM { hash, error })); + }, }, _ => { // Any other type of error is not allowed @@ -317,12 +312,7 @@ where vec![] }; - Ok(EthExecuteOutput { - receipts, - requests, - gas_used: cumulative_gas_used, - valid_transaction_indices, - }) + Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used, valid_transaction_indices }) } } @@ -346,12 +336,7 @@ pub struct EthBlockExecutor { impl EthBlockExecutor { /// Creates a new Ethereum block executor. pub const fn new(chain_spec: Arc, evm_config: EvmConfig, state: State) -> Self { - Self { - executor: EthEvmExecutor { chain_spec, evm_config }, - state, - optimistic: false, - taiko_data: None, - } + Self { executor: EthEvmExecutor { chain_spec, evm_config }, state, optimistic: false, taiko_data: None } } /// Optimistic execution @@ -420,12 +405,7 @@ where let env = self.evm_env_for_block(&block.header, total_difficulty); let output = { let evm = self.executor.evm_config.evm_with_env(&mut self.state, env); - self.executor.execute_state_transitions( - block, - evm, - self.optimistic, - self.taiko_data.clone(), - ) + self.executor.execute_state_transitions(block, evm, self.optimistic, self.taiko_data.clone()) }?; // 3. apply post execution changes @@ -505,14 +485,7 @@ where // NOTE: we need to merge keep the reverts for the bundle retention self.state.merge_transitions(BundleRetention::Reverts); - Ok(BlockExecutionOutput { - state: self.state.take_bundle(), - receipts, - requests, - gas_used, - db: self.state, - valid_transaction_indices, - }) + Ok(BlockExecutionOutput { state: self.state.take_bundle(), receipts, requests, gas_used, db: self.state, valid_transaction_indices }) } } diff --git a/crates/ethereum/evm/src/lib.rs b/crates/ethereum/evm/src/lib.rs index b1fc31d681cb..2d7d179aa014 100644 --- a/crates/ethereum/evm/src/lib.rs +++ b/crates/ethereum/evm/src/lib.rs @@ -15,8 +15,8 @@ use reth_primitives::{ revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv}, Address, Head, Header, TransactionSigned, U256, }; -use reth_revm::taiko::handler_register; use reth_revm::{Database, EvmBuilder}; +use reth_revm::taiko::handler_register; pub mod execute; pub mod taiko; diff --git a/crates/ethereum/evm/src/taiko.rs b/crates/ethereum/evm/src/taiko.rs index 05f833c76052..c4322e9f2d37 100644 --- a/crates/ethereum/evm/src/taiko.rs +++ b/crates/ethereum/evm/src/taiko.rs @@ -42,6 +42,7 @@ lazy_static! { uint!(0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5_U256); } + /// check the anchor signature with fixed K value fn check_anchor_signature(anchor: &TransactionSigned) -> Result<()> { let sign = anchor.signature(); @@ -61,7 +62,12 @@ fn check_anchor_signature(anchor: &TransactionSigned) -> Result<()> { } return Ok(()); } - Err(anyhow!("r != *GX1 && r != GX2, r: {}, *GX1: {}, GX2: {}", sign.r, *GX1, *GX2)) + Err(anyhow!( + "r != *GX1 && r != GX2, r: {}, *GX1: {}, GX2: {}", + sign.r, + *GX1, + *GX2 + )) } use alloy_sol_types::{sol, SolCall}; @@ -103,28 +109,36 @@ pub fn decode_anchor(bytes: &[u8]) -> Result { } /// Verifies the anchor tx correctness -pub fn check_anchor_tx( - tx: &TransactionSigned, - from: &Address, - block: &Block, - taiko_data: TaikoData, -) -> Result<()> { - let anchor: &reth_primitives::TxEip1559 = - tx.as_eip1559().context(anyhow!("anchor tx is not an EIP1559 tx"))?; +pub fn check_anchor_tx(tx: &TransactionSigned, from: &Address, block: &Block, taiko_data: TaikoData) -> Result<()> { + let anchor = tx.as_eip1559().context(anyhow!("anchor tx is not an EIP1559 tx"))?; // Check the signature check_anchor_signature(tx).context(anyhow!("failed to check anchor signature"))?; // Extract the `to` address - let TxKind::Call(to) = anchor.to else { panic!("anchor tx not a smart contract call") }; + let TxKind::Call(to) = anchor.to else { + panic!("anchor tx not a smart contract call") + }; // Check that it's from the golden touch address - ensure!(*from == *GOLDEN_TOUCH_ACCOUNT, "anchor transaction from mismatch"); + ensure!( + *from == *GOLDEN_TOUCH_ACCOUNT, + "anchor transaction from mismatch" + ); // Check that the L2 contract is being called - ensure!(to == taiko_data.l2_contract, "anchor transaction to mismatch"); + ensure!( + to == taiko_data.l2_contract, + "anchor transaction to mismatch" + ); // Tx can't have any ETH attached - ensure!(anchor.value == U256::from(0), "anchor transaction value mismatch"); + ensure!( + anchor.value == U256::from(0), + "anchor transaction value mismatch" + ); // Tx needs to have the expected gas limit - ensure!(anchor.gas_limit == ANCHOR_GAS_LIMIT, "anchor transaction gas price mismatch"); + ensure!( + anchor.gas_limit == ANCHOR_GAS_LIMIT, + "anchor transaction gas price mismatch" + ); // Check needs to have the base fee set to the block base fee ensure!( anchor.max_fee_per_gas == block.header.base_fee_per_gas.unwrap().into(), @@ -134,9 +148,18 @@ pub fn check_anchor_tx( // Okay now let's decode the anchor tx to verify the inputs let anchor_call = decode_anchor(&anchor.input)?; // The L1 blockhash needs to match the expected value - ensure!(anchor_call.l1Hash == taiko_data.l1_header.hash_slow(), "L1 hash mismatch"); - ensure!(anchor_call.l1StateRoot == taiko_data.l1_header.state_root, "L1 state root mismatch"); - ensure!(anchor_call.l1BlockId == taiko_data.l1_header.number, "L1 block number mismatch"); + ensure!( + anchor_call.l1Hash == taiko_data.l1_header.hash_slow(), + "L1 hash mismatch" + ); + ensure!( + anchor_call.l1StateRoot == taiko_data.l1_header.state_root, + "L1 state root mismatch" + ); + ensure!( + anchor_call.l1BlockId == taiko_data.l1_header.number, + "L1 block number mismatch" + ); // The parent gas used input needs to match the gas used value of the parent block ensure!( anchor_call.parentGasUsed == taiko_data.parent_header.gas_used as u32, diff --git a/crates/primitives/src/revm/config.rs b/crates/primitives/src/revm/config.rs index 2cfe7cdf16e7..f06814e5feea 100644 --- a/crates/primitives/src/revm/config.rs +++ b/crates/primitives/src/revm/config.rs @@ -21,7 +21,7 @@ pub fn revm_spec_by_timestamp_after_merge( revm_primitives::REGOLITH } else { revm_primitives::BEDROCK - }; + } } if chain_spec.is_prague_active_at_timestamp(timestamp) { @@ -40,15 +40,15 @@ pub fn revm_spec(chain_spec: &ChainSpec, block: Head) -> revm_primitives::SpecId #[cfg(feature = "optimism")] if chain_spec.is_optimism() { if chain_spec.fork(Hardfork::Fjord).active_at_head(&block) { - return revm_primitives::FJORD; + return revm_primitives::FJORD } else if chain_spec.fork(Hardfork::Ecotone).active_at_head(&block) { - return revm_primitives::ECOTONE; + return revm_primitives::ECOTONE } else if chain_spec.fork(Hardfork::Canyon).active_at_head(&block) { - return revm_primitives::CANYON; + return revm_primitives::CANYON } else if chain_spec.fork(Hardfork::Regolith).active_at_head(&block) { - return revm_primitives::REGOLITH; + return revm_primitives::REGOLITH } else if chain_spec.fork(Hardfork::Bedrock).active_at_head(&block) { - return revm_primitives::BEDROCK; + return revm_primitives::BEDROCK } } From ba41ea6f2b065d4f022b37cc1e93311049188516 Mon Sep 17 00:00:00 2001 From: smtmfft Date: Fri, 16 Aug 2024 00:19:44 +0800 Subject: [PATCH 09/10] switch back to v36-taiko revm --- Cargo.lock | 64 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 8 +++---- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0b8f9013c58..ee56abd5b14f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6341,7 +6341,7 @@ dependencies = [ "reth-revm", "reth-tasks", "reth-transaction-pool", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "tokio", "tracing", ] @@ -6962,7 +6962,7 @@ dependencies = [ "reth-primitives", "reth-rpc-types", "reth-rpc-types-compat", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", "serde_json", "sha2 0.10.8", @@ -6996,7 +6996,7 @@ dependencies = [ "reth-provider", "reth-revm", "reth-transaction-pool", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "tracing", ] @@ -7023,8 +7023,8 @@ dependencies = [ "reth-primitives", "reth-prune-types", "reth-storage-errors", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", ] [[package]] @@ -7044,7 +7044,7 @@ dependencies = [ "reth-prune-types", "reth-revm", "reth-testing-utils", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "secp256k1", "serde_json", ] @@ -7062,8 +7062,8 @@ dependencies = [ "reth-provider", "reth-prune-types", "reth-revm", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "thiserror", "tracing", ] @@ -7077,7 +7077,7 @@ dependencies = [ "reth-consensus", "reth-prune-types", "reth-storage-errors", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "thiserror-no-std", ] @@ -7091,7 +7091,7 @@ dependencies = [ "reth-execution-errors", "reth-primitives", "reth-trie", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", ] [[package]] @@ -7596,7 +7596,7 @@ dependencies = [ "reth-rpc-types-compat", "reth-tracing", "reth-transaction-pool", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", "serde_json", "thiserror", @@ -7632,7 +7632,7 @@ dependencies = [ "reth-rpc-types", "reth-rpc-types-compat", "reth-transaction-pool", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "sha2 0.10.8", "thiserror", "tracing", @@ -7656,7 +7656,7 @@ dependencies = [ "reth-provider", "reth-rpc-types", "reth-transaction-pool", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde_json", "thiserror", "tokio", @@ -7720,9 +7720,9 @@ dependencies = [ "reth-primitives-traits", "reth-static-file-types", "reth-trie-common", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", - "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", + "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "roaring", "secp256k1", "serde", @@ -7754,7 +7754,7 @@ dependencies = [ "proptest-derive", "rand 0.8.5", "reth-codecs", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", "test-fuzz", ] @@ -7793,7 +7793,7 @@ dependencies = [ "reth-storage-errors", "reth-testing-utils", "reth-trie", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "strum", "tempfile", "tokio", @@ -7863,7 +7863,7 @@ dependencies = [ "reth-storage-api", "reth-storage-errors", "reth-trie", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "tracing", ] @@ -7909,9 +7909,9 @@ dependencies = [ "reth-tasks", "reth-testing-utils", "reth-transaction-pool", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "revm-inspectors", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "schnellru", "secp256k1", "serde", @@ -8226,7 +8226,7 @@ dependencies = [ "reth-stages-types", "reth-storage-errors", "reth-trie", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", ] [[package]] @@ -8347,7 +8347,7 @@ dependencies = [ "reth-stages-types", "reth-storage-errors", "reth-trie-common", - "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm 9.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde_json", "similar-asserts", "tokio", @@ -8377,7 +8377,7 @@ dependencies = [ "proptest-derive", "reth-codecs", "reth-primitives-traits", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", "serde_json", "test-fuzz", @@ -8412,13 +8412,13 @@ dependencies = [ [[package]] name = "revm" version = "9.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko#337a98f982e165c5a84cfc25d965344bfd4081bc" dependencies = [ "auto_impl", "cfg-if", "dyn-clone", - "revm-interpreter 5.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", - "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-interpreter 5.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", + "revm-precompile 7.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", "serde_json", ] @@ -8457,9 +8457,9 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "5.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko#337a98f982e165c5a84cfc25d965344bfd4081bc" dependencies = [ - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "serde", ] @@ -8475,14 +8475,14 @@ dependencies = [ [[package]] name = "revm-precompile" version = "7.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko#337a98f982e165c5a84cfc25d965344bfd4081bc" dependencies = [ "aurora-engine-modexp", "blst", "c-kzg 1.0.0", "k256", "once_cell", - "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake)", + "revm-primitives 4.0.0 (git+https://github.com/taikoxyz/revm.git?branch=v36-taiko)", "ripemd", "secp256k1", "sha2 0.10.8", @@ -8508,7 +8508,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "4.0.0" -source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko-ontake#e5f0306818ae8b16d537fa3a582e9aded4beeec0" +source = "git+https://github.com/taikoxyz/revm.git?branch=v36-taiko#337a98f982e165c5a84cfc25d965344bfd4081bc" dependencies = [ "alloy-primitives", "auto_impl", diff --git a/Cargo.toml b/Cargo.toml index d1a0a0de1f79..edae771ca099 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -507,13 +507,13 @@ test-fuzz = "5" anyhow = "1.0" [patch.crates-io] -revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake", default-features = false, features = [ +revm = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko", default-features = false, features = [ "std", "serde", "taiko", ]} -revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake" } -revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake" } -revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko-ontake"} +revm-interpreter = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko" } +revm-precompile = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko" } +revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "v36-taiko"} c-kzg = { git = "https://github.com/brechtpd/c-kzg-4844", branch = "for-alpha7" } secp256k1 = { git = "https://github.com/CeciliaZ030/rust-secp256k1", branch = "sp1-patch" } \ No newline at end of file From 018d2a6a84c475f1fe8c88b8c7ec2f1664ea51c0 Mon Sep 17 00:00:00 2001 From: smtmfft Date: Fri, 16 Aug 2024 13:03:16 +0800 Subject: [PATCH 10/10] keep reverting fmt changes --- crates/ethereum/evm/src/execute.rs | 12 ++++++------ crates/ethereum/evm/src/taiko.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index 58c9d80ad467..c288b071c1a7 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -5,10 +5,9 @@ use crate::{ taiko::{check_anchor_tx, check_anchor_tx_ontake, TaikoData}, EthEvmConfig, }; -use anyhow::Result; use reth_chainspec::{ChainSpec, MAINNET}; pub use reth_consensus::Consensus; -pub use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus}; +pub use reth_ethereum_consensus::{EthBeaconConsensus, validate_block_post_execution}; use reth_evm::{ execute::{ BatchExecutor, BlockExecutionError, BlockExecutionInput, BlockExecutionOutput, @@ -29,14 +28,15 @@ use reth_revm::{ apply_beacon_root_contract_call, apply_blockhashes_update, apply_withdrawal_requests_contract_call, post_block_balance_increments, }, - Evm, JournaledState, State, + Evm, State, + JournaledState, }; use revm_primitives::{ - db::{Database, DatabaseCommit}, - Address, BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, HashSet, ResultAndState, - SpecId, + db::{Database, DatabaseCommit}, Address, BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, + EVMError, HashSet, SpecId, }; use std::sync::Arc; +use anyhow::Result; /// Provides executors to execute regular ethereum blocks #[derive(Debug, Clone)] diff --git a/crates/ethereum/evm/src/taiko.rs b/crates/ethereum/evm/src/taiko.rs index c4322e9f2d37..2060853b4c47 100644 --- a/crates/ethereum/evm/src/taiko.rs +++ b/crates/ethereum/evm/src/taiko.rs @@ -1,10 +1,10 @@ //! Taiko related functionality for the block executor. -use anyhow::{anyhow, bail, ensure, Context, Result}; -use lazy_static::lazy_static; use reth_primitives::{Block, Header, TransactionSigned, TxKind}; use revm_primitives::{alloy_primitives::uint, Address, U256}; use std::str::FromStr; +use lazy_static::lazy_static; +use anyhow::{bail, Context, Result, ensure, anyhow}; /// Data required to validate a Taiko Block #[derive(Clone, Debug, Default)]