Skip to content

Conversation

@wlawt
Copy link
Contributor

@wlawt wlawt commented Jan 23, 2026

Motivation: base/tips#76

Changes

  • Before metering, we validate the tx first
  • A valid transaction must satisfy the following criteria:
    • The transaction is not EIP-4844
    • The transaction is not a cross chain tx
    • If the transaction is a 7702 tx, then the account is a 7702 account
    • The transaction's nonce is the latest
    • The transaction's execution cost is less than the account's balance
    • The transaction's L1 gas cost is less than the account's balance
  • We don't need to check for EIP-4844 because bundle transactions are Recovered<OpTxEnvelope>, which consists of only Legacy, Eip2930, Eip1559, Eip7702, and Deposit types.

Tests

  • Added unit tests in transaction.rs
  • Modified rpc.rs and meter.rs tests

TODO:

  • Add unit tests to meter.rs

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 23, 2026

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@wlawt wlawt changed the title feat: validate transaction before metering (WIP) feat: validate transaction before metering Jan 23, 2026
@wlawt wlawt force-pushed the validate-tx-metering branch from 95e5f8b to 26e20ac Compare January 23, 2026 16:09
@wlawt wlawt changed the title (WIP) feat: validate transaction before metering feat: validate transaction before metering Jan 23, 2026

// Get the first transaction from a L2 block to retrieve the L1 block info. The L1 block
// info is required to check for transaction validity.
let first_tx = self
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we extract this into a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wlawt wlawt marked this pull request as ready for review January 23, 2026 20:07
@wlawt wlawt requested a review from niran January 23, 2026 20:07
@wlawt wlawt added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit 126484e Jan 23, 2026
15 checks passed
@wlawt wlawt deleted the validate-tx-metering branch January 23, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants