Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/revm/src/optimism/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ pub fn validate_env<SPEC: Spec, DB: Database>(env: &Env) -> Result<(), EVMError<
pub fn validate_tx_against_state<SPEC: Spec, EXT, DB: Database>(
context: &mut Context<EXT, DB>,
) -> Result<(), EVMError<DB::Error>> {
// No validation is needed for deposit transactions, as they are pre-verified on L1.
if context.evm.inner.env.tx.optimism.source_hash.is_some() {
return Ok(());
}

// storage l1 block info for later use. l1_block_info is cleared after execution.
if context.evm.inner.l1_block_info.is_none() {
// the L1-cost fee is only computed for Optimism non-deposit transactions.
Expand All @@ -77,11 +82,6 @@ pub fn validate_tx_against_state<SPEC: Spec, EXT, DB: Database>(
context.evm.inner.l1_block_info = Some(l1_block_info);
}

// No validation is needed for deposit transactions, as they are pre-verified on L1.
if context.evm.inner.env.tx.optimism.source_hash.is_some() {
return Ok(());
}

Comment on lines -80 to -84
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this move intentional?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's a performance improvement not to do this

let env @ Env { cfg, tx, .. } = context.evm.inner.env.as_ref();

// load acc
Expand Down Expand Up @@ -285,7 +285,7 @@ pub fn reimburse_caller<SPEC: Spec, EXT, DB: Database>(
mainnet::reimburse_caller::<SPEC, EXT, DB>(context, gas)?;
}

if SPEC::SPEC_ID.is_enabled_in(SpecId::ISTHMUS) {
if !is_deposit && SPEC::SPEC_ID.is_enabled_in(SpecId::ISTHMUS) {
let operator_fee_refund = context
.evm
.inner
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/src/optimism/l1block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ impl L1BlockInfo {
///
/// Introduced in isthmus. Prior to isthmus, the operator fee is always zero.
pub fn operator_fee_charge(&self, input: &[u8], gas_limit: U256, spec_id: SpecId) -> U256 {
// If the input is a deposit transaction or empty, the default value is zero.
if input.is_empty() || input.first() == Some(&0x7E) {
// If the input is a deposit transaction, the default value is zero.
if input.first() == Some(&0x7E) {
return U256::ZERO;
}
if !spec_id.is_enabled_in(SpecId::ISTHMUS) {
Expand Down