Skip to content

Commit

Permalink
prepare for ontake upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: smtmfft <smtm@taiko.xyz>
  • Loading branch information
smtmfft committed Jul 25, 2024
1 parent 6cc82cf commit cb85f7d
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 78 deletions.
180 changes: 119 additions & 61 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
1 change: 1 addition & 0 deletions crates/ethereum-forks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 6 additions & 1 deletion crates/ethereum-forks/src/hardfork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ pub enum Hardfork {
/// Ecotone: <https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/superchain-upgrades.md#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: <https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/prague.md>
Prague,
Expand Down
4 changes: 2 additions & 2 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use reth_chainspec::ChainSpec;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_primitives::{
revm::{config::revm_spec, env::fill_tx_env},
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TaikoProtocolSpecId, 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;
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ optimism = [
taiko = [
"revm-primitives/taiko",
"revm/taiko",
"reth-ethereum-forks/taiko",
]
alloy-compat = [
"reth-primitives-traits/alloy-compat",
Expand Down
21 changes: 15 additions & 6 deletions crates/primitives/src/revm/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
}

Expand Down
2 changes: 0 additions & 2 deletions testing/ef-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ thiserror.workspace = true
rayon.workspace = true

# raiko
raiko-core.workspace = true
raiko-lib.workspace = true
anyhow.workspace = true

0 comments on commit cb85f7d

Please sign in to comment.