Skip to content

Commit

Permalink
feat: update order of the hardforks for Fjord (#70)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
yutianwu and pythonberg1997 authored Sep 6, 2024
1 parent 7a4d6dd commit dc4cc14
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions crates/interpreter/src/function_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ impl FunctionStack {

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

Expand Down
6 changes: 5 additions & 1 deletion crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,18 @@ impl PrecompileSpecId {
PRAGUE | PRAGUE_EOF => Self::PRAGUE,
#[cfg(feature = "optimism")]
BEDROCK | REGOLITH | CANYON => Self::BERLIN,
#[cfg(feature = "optimism")]
#[cfg(all(feature = "optimism", not(feature = "opbnb")))]
ECOTONE | FJORD => Self::CANCUN,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
ECOTONE => Self::CANCUN,
#[cfg(feature = "opbnb")]
FERMAT => Self::FERMAT,
#[cfg(any(feature = "bsc", feature = "opbnb"))]
HABER => Self::HABER,
#[cfg(feature = "opbnb")]
WRIGHT => Self::HABER,
#[cfg(all(feature = "optimism", feature = "opbnb"))]
FJORD => Self::HABER,
#[cfg(feature = "bsc")]
HABER_FIX => Self::HABER,
#[cfg(feature = "bsc")]
Expand Down
6 changes: 2 additions & 4 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
.handler
.validation()
.initial_tx_gas(&self.context.evm.env)
.map_err(|e| {
.inspect_err(|_| {
self.clear();
e
})?;
let output = self.transact_preverified_inner(initial_gas_spend);
let output = self.handler.post_execution().end(&mut self.context, output);
Expand All @@ -228,9 +227,8 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
/// This function will validate the transaction.
#[inline]
pub fn transact(&mut self) -> EVMResult<DB::Error> {
let initial_gas_spend = self.preverify_transaction_inner().map_err(|e| {
let initial_gas_spend = self.preverify_transaction_inner().inspect_err(|_| {
self.clear();
e
})?;

let output = self.transact_preverified_inner(initial_gas_spend);
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/optimism/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn last_frame_return<SPEC: Spec, EXT, DB: Database>(
pub fn load_precompiles<SPEC: Spec, EXT, DB: Database>() -> ContextPrecompiles<DB> {
let mut precompiles = ContextPrecompiles::new(PrecompileSpecId::from_spec_id(SPEC::SPEC_ID));

if SPEC::enabled(SpecId::FJORD) {
if SPEC::enabled(SpecId::FJORD) || SPEC::enabled(SpecId::HABER) {
precompiles.extend([
// EIP-7212: secp256r1 P256verify
secp256r1::P256VERIFY,
Expand Down

0 comments on commit dc4cc14

Please sign in to comment.