Skip to content

Commit dc4cc14

Browse files
feat: update order of the hardforks for Fjord (#70)
* feat: update order of the hardforks * compatible with optimims * fix ci * fix ci * fix ci * fix ci --------- Co-authored-by: Roshan <48975233+pythonberg1997@users.noreply.github.com>
1 parent 7a4d6dd commit dc4cc14

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

crates/interpreter/src/function_stack.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ impl FunctionStack {
5151

5252
/// Pops a frame from the stack and sets current_code_idx to the popped frame's idx.
5353
pub fn pop(&mut self) -> Option<FunctionReturnFrame> {
54-
self.return_stack.pop().map(|frame| {
54+
self.return_stack.pop().inspect(|frame| {
5555
self.current_code_idx = frame.idx;
56-
frame
5756
})
5857
}
5958

crates/precompile/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,18 @@ impl PrecompileSpecId {
485485
PRAGUE | PRAGUE_EOF => Self::PRAGUE,
486486
#[cfg(feature = "optimism")]
487487
BEDROCK | REGOLITH | CANYON => Self::BERLIN,
488-
#[cfg(feature = "optimism")]
488+
#[cfg(all(feature = "optimism", not(feature = "opbnb")))]
489489
ECOTONE | FJORD => Self::CANCUN,
490+
#[cfg(all(feature = "optimism", feature = "opbnb"))]
491+
ECOTONE => Self::CANCUN,
490492
#[cfg(feature = "opbnb")]
491493
FERMAT => Self::FERMAT,
492494
#[cfg(any(feature = "bsc", feature = "opbnb"))]
493495
HABER => Self::HABER,
494496
#[cfg(feature = "opbnb")]
495497
WRIGHT => Self::HABER,
498+
#[cfg(all(feature = "optimism", feature = "opbnb"))]
499+
FJORD => Self::HABER,
496500
#[cfg(feature = "bsc")]
497501
HABER_FIX => Self::HABER,
498502
#[cfg(feature = "bsc")]

crates/revm/src/evm.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
199199
.handler
200200
.validation()
201201
.initial_tx_gas(&self.context.evm.env)
202-
.map_err(|e| {
202+
.inspect_err(|_| {
203203
self.clear();
204-
e
205204
})?;
206205
let output = self.transact_preverified_inner(initial_gas_spend);
207206
let output = self.handler.post_execution().end(&mut self.context, output);
@@ -228,9 +227,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
228227
/// This function will validate the transaction.
229228
#[inline]
230229
pub fn transact(&mut self) -> EVMResult<DB::Error> {
231-
let initial_gas_spend = self.preverify_transaction_inner().map_err(|e| {
230+
let initial_gas_spend = self.preverify_transaction_inner().inspect_err(|_| {
232231
self.clear();
233-
e
234232
})?;
235233

236234
let output = self.transact_preverified_inner(initial_gas_spend);

crates/revm/src/optimism/handler_register.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub fn last_frame_return<SPEC: Spec, EXT, DB: Database>(
149149
pub fn load_precompiles<SPEC: Spec, EXT, DB: Database>() -> ContextPrecompiles<DB> {
150150
let mut precompiles = ContextPrecompiles::new(PrecompileSpecId::from_spec_id(SPEC::SPEC_ID));
151151

152-
if SPEC::enabled(SpecId::FJORD) {
152+
if SPEC::enabled(SpecId::FJORD) || SPEC::enabled(SpecId::HABER) {
153153
precompiles.extend([
154154
// EIP-7212: secp256r1 P256verify
155155
secp256r1::P256VERIFY,

0 commit comments

Comments
 (0)