Skip to content

fix: small fixes for OP chains#495

Merged
hai-rise merged 1 commit intomainfrom
fix-op
Apr 14, 2026
Merged

fix: small fixes for OP chains#495
hai-rise merged 1 commit intomainfrom
fix-op

Conversation

@hai-rise
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the nonce check logic in the Rise chain implementation to be more concise and updates the initial capacity of the WriteSet in the VM to better accommodate fee recipients on OP Stack chains. The reviewer suggests that instead of hardcoding the capacity to 6, a more robust approach would be to initialize the WriteSet based on the actual state length after the journal is finalized to avoid unnecessary reallocations.

Comment thread crates/pevm/src/vm.rs
Comment on lines +581 to +584
// There are at least six locations most of the time: the sender,
// the recipient, and up to four fee recipients (beneficiary, base fee,
// L1 fee, operator fee on OP Stack chains).
let mut write_set = WriteSet::with_capacity(6);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While increasing the capacity to 6 is a good heuristic for simple transactions on OP Stack chains, complex transactions touching many accounts will still trigger multiple reallocations. A more robust approach would be to initialize write_set after the journal is finalized, using the resulting state's length as a base for the capacity. This would minimize reallocations in the hot path for all transaction types.

@hai-rise hai-rise merged commit b9e5ae8 into main Apr 14, 2026
6 checks passed
@hai-rise hai-rise deleted the fix-op branch April 14, 2026 02:25
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.

1 participant