Skip to content

Commit

Permalink
chore(EOF): Use Bytecode::new_legacy (#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored Jul 16, 2024
1 parent 887c5d9 commit 6354446
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ impl Bytecode {
matches!(self, Self::Eof(_))
}

/// Creates a new legacy [`Bytecode`].
#[inline]
pub fn new_legacy(raw: Bytes) -> Self {
Self::LegacyRaw(raw)
}

/// Creates a new raw [`Bytecode`].
///
/// # Panics
Expand Down
4 changes: 1 addition & 3 deletions crates/revm/src/context/evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ impl<DB: Database> EvmContext<DB> {
return return_error(InstructionResult::CallTooDeep);
}

//self.precompiles

// Prague EOF
if spec_id.is_enabled_in(PRAGUE_EOF) && inputs.init_code.get(..2) == Some(&EOF_MAGIC_BYTES)
{
Expand Down Expand Up @@ -325,7 +323,7 @@ impl<DB: Database> EvmContext<DB> {
}
};

let bytecode = Bytecode::new_raw(inputs.init_code.clone());
let bytecode = Bytecode::new_legacy(inputs.init_code.clone());

let contract = Contract::new(
Bytes::new(),
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/context/inner_evm_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ impl<DB: Database> InnerEvmContext<DB> {

// Do analysis of bytecode straight away.
let bytecode = match self.env.cfg.perf_analyse_created_bytecodes {
AnalysisKind::Raw => Bytecode::new_raw(interpreter_result.output.clone()),
AnalysisKind::Raw => Bytecode::new_legacy(interpreter_result.output.clone()),
AnalysisKind::Analyse => {
to_analysed(Bytecode::new_raw(interpreter_result.output.clone()))
to_analysed(Bytecode::new_legacy(interpreter_result.output.clone()))
}
};

Expand Down

0 comments on commit 6354446

Please sign in to comment.