Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the gas price check for opBNB #86

Merged
merged 2 commits into from
Nov 12, 2024
Merged
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
34 changes: 18 additions & 16 deletions crates/revm/src/optimism/handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,18 @@ pub fn deduct_caller<SPEC: Spec, EXT, DB: Database>(
));
};

let tx_l1_cost = if context.evm.inner.env.tx.gas_price.is_zero() && SPEC::enabled(WRIGHT) {
U256::ZERO
} else {
context
.evm
.inner
.l1_block_info
.as_ref()
.expect("L1BlockInfo should be loaded")
.calculate_tx_l1_cost(enveloped_tx, SPEC::SPEC_ID)
};
let tx_l1_cost =
if context.evm.inner.env.effective_gas_price().is_zero() && SPEC::enabled(WRIGHT) {
U256::ZERO
} else {
context
.evm
.inner
.l1_block_info
.as_ref()
.expect("L1BlockInfo should be loaded")
.calculate_tx_l1_cost(enveloped_tx, SPEC::SPEC_ID)
};

if tx_l1_cost.gt(&caller_account.info.balance) {
return Err(EVMError::Transaction(
Expand Down Expand Up @@ -287,11 +288,12 @@ pub fn reward_beneficiary<SPEC: Spec, EXT, DB: Database>(
));
};

let l1_cost = if context.evm.inner.env.tx.gas_price.is_zero() && SPEC::enabled(WRIGHT) {
U256::ZERO
} else {
l1_block_info.calculate_tx_l1_cost(enveloped_tx, SPEC::SPEC_ID)
};
let l1_cost =
if context.evm.inner.env.effective_gas_price().is_zero() && SPEC::enabled(WRIGHT) {
U256::ZERO
} else {
l1_block_info.calculate_tx_l1_cost(enveloped_tx, SPEC::SPEC_ID)
};

// Send the L1 cost of the transaction to the L1 Fee Vault.
let mut l1_fee_vault_account = context
Expand Down
Loading