Skip to content

Commit 983db4b

Browse files
committed
non exclusive op & taiko flags
1 parent 115d5fe commit 983db4b

File tree

9 files changed

+23
-41
lines changed

9 files changed

+23
-41
lines changed

crates/interpreter/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#![deny(unused_must_use, rust_2018_idioms)]
77
#![cfg_attr(not(feature = "std"), no_std)]
88
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9-
#[cfg(all(feature = "optimism", feature = "taiko"))]
10-
compile_error!("Features 'optimism' and 'taiko' cannot be enabled at the same time.");
119

1210
extern crate alloc;
1311

crates/precompile/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#![deny(unused_must_use, rust_2018_idioms)]
77
#![cfg_attr(not(feature = "std"), no_std)]
88
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9-
#[cfg(all(feature = "optimism", feature = "taiko"))]
10-
compile_error!("Features 'optimism' and 'taiko' cannot be enabled at the same time.");
119

1210
#[macro_use]
1311
extern crate alloc;

crates/primitives/src/env.rs

+8-17
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ impl Env {
256256
}
257257
}
258258

259-
260259
/// EVM configuration.
261260
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
262261
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -320,7 +319,8 @@ pub struct CfgEnv {
320319
#[cfg(all(feature = "optimism", not(feature = "taiko")))]
321320
pub optimism: bool,
322321

323-
#[cfg(all(feature = "taiko", not(feature = "optimism")))] pub taiko: bool,
322+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
323+
pub taiko: bool,
324324
}
325325

326326
impl CfgEnv {
@@ -389,7 +389,8 @@ impl CfgEnv {
389389
self.optimism
390390
}
391391

392-
#[cfg(all(feature = "taiko", not(feature = "optimism")))] pub fn is_taiko(&self) -> bool {
392+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
393+
pub fn is_taiko(&self) -> bool {
393394
self.taiko
394395
}
395396
}
@@ -465,17 +466,6 @@ pub struct BlockEnv {
465466
pub blob_excess_gas_and_price: Option<BlobExcessGasAndPrice>,
466467
}
467468

468-
impl BlobExcessGasAndPrice {
469-
/// Takes excess blob gas and calculated blob fee with [`calc_blob_fee`]
470-
pub fn new(excess_blob_gas: u64) -> Self {
471-
let blob_gasprice = calc_blob_gasprice(excess_blob_gas);
472-
Self {
473-
excess_blob_gas,
474-
blob_gasprice,
475-
}
476-
}
477-
}
478-
479469
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
480470
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
481471
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -484,7 +474,6 @@ pub struct TaikoFields {
484474
pub is_anchor: bool,
485475
}
486476

487-
488477
impl BlockEnv {
489478
/// Takes `blob_excess_gas` saves it inside env
490479
/// and calculates `blob_fee` with [`BlobExcessGasAndPrice`].
@@ -597,7 +586,8 @@ pub struct TxEnv {
597586
pub optimism: OptimismFields,
598587

599588
#[cfg_attr(feature = "serde", serde(flatten))]
600-
#[cfg(all(feature = "taiko", not(feature = "optimism")))] pub taiko: TaikoFields,
589+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
590+
pub taiko: TaikoFields,
601591
}
602592

603593
impl TxEnv {
@@ -813,7 +803,8 @@ mod tests {
813803
.is_ok());
814804
}
815805

816-
#[cfg(all(feature = "taiko", not(feature = "optimism")))] #[test]
806+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
807+
#[test]
817808
fn test_taiko() {
818809
// TODO(Cecilia): taiko tests
819810
}

crates/primitives/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#![deny(unused_must_use, rust_2018_idioms)]
77
#![cfg_attr(not(feature = "std"), no_std)]
88
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
9-
#[cfg(all(feature = "optimism", feature = "taiko"))]
10-
compile_error!("Features 'optimism' and 'taiko' cannot be enabled at the same time.");
119

1210
extern crate alloc;
1311

crates/primitives/src/result.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ pub enum InvalidTransaction {
255255
HaltedDepositPostRegolith,
256256

257257
/// Anchor check failed
258-
#[cfg(all(feature = "taiko", not(feature = "optimism")))] InvalidAnchorTransaction,
258+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
259+
InvalidAnchorTransaction,
259260
}
260261

261262
#[cfg(feature = "std")]
@@ -330,10 +331,7 @@ impl fmt::Display for InvalidTransaction {
330331
}
331332
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
332333
InvalidTransaction::InvalidAnchorTransaction => {
333-
write!(
334-
f,
335-
"Invalid Anchor transaction."
336-
)
334+
write!(f, "Invalid Anchor transaction.")
337335
}
338336
}
339337
}

crates/primitives/src/specification.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ pub use SpecId::*;
44
/// Specification IDs and their activation block.
55
///
66
/// Information was obtained from the [Ethereum Execution Specifications](https://github.com/ethereum/execution-specs)
7-
#[cfg(all(not(feature = "optimism"), not(feature = "taiko")))]
7+
#[cfg(any(
8+
all(feature = "optimism", feature = "taiko"),
9+
all(not(feature = "optimism"), not(feature = "taiko"))
10+
))]
811
#[repr(u8)]
912
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, enumn::N)]
1013
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -65,7 +68,8 @@ pub enum SpecId {
6568
/// Specification IDs and their activation block.
6669
///
6770
/// Information was obtained from the [Ethereum Execution Specifications](https://github.com/ethereum/execution-specs)
68-
#[cfg(all(feature = "taiko", not(feature = "optimism")))]#[repr(u8)]
71+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
72+
#[repr(u8)]
6973
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, enumn::N)]
7074
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7175
pub enum SpecId {
@@ -130,7 +134,7 @@ impl From<&str> for SpecId {
130134
"Regolith" => SpecId::REGOLITH,
131135
#[cfg(all(feature = "optimism", not(feature = "taiko")))]
132136
"Canyon" => SpecId::CANYON,
133-
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
137+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
134138
"Katla" => SpecId::KATLA,
135139
_ => Self::LATEST,
136140
}
@@ -380,10 +384,11 @@ mod optimism_tests {
380384
}
381385
}
382386

383-
#[cfg(all(feature = "taiko", not(feature = "optimism")))]#[cfg(test)]
387+
#[cfg(all(feature = "taiko", not(feature = "optimism")))]
388+
#[cfg(test)]
384389
mod tests {
385390
use super::*;
386-
391+
387392
// TODO(Cecilia): update this range of bits
388393
#[test]
389394
fn test_katla_post_merge_hardforks() {
@@ -393,4 +398,4 @@ mod tests {
393398
assert!(!SpecId::enabled(SpecId::LATEST));
394399
assert!(SpecId::enabled(SpecId::KATLA));
395400
}
396-
}
401+
}

crates/revm/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
66
#![deny(unused_must_use, rust_2018_idioms)]
77
#![cfg_attr(not(feature = "std"), no_std)]
8-
#[cfg(all(feature = "optimism", feature = "taiko"))]
9-
compile_error!("Features 'optimism' and 'taiko' cannot be enabled at the same time.");
108

119
#[macro_use]
1210
extern crate alloc;

crates/revm/src/taiko.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
//! Optimism-specific constants, types, and helpers.
22
33
mod handler_register;
4-
5-
pub use handler_register::{
6-
// deduct_caller, end, handle_call_return, optimism_handle_register, output, reward_beneficiary,
7-
};

crates/revm/src/taiko/handler_register.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ use crate::{
1111
HashMap, InvalidTransaction, Output, ResultAndState, Spec, SpecId, U256,
1212
},
1313
Context,
14-
};
14+
};

0 commit comments

Comments
 (0)