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: erroneous nonce updates #839

Merged
merged 21 commits into from
Jan 23, 2025
Merged

fix: erroneous nonce updates #839

merged 21 commits into from
Jan 23, 2025

Conversation

nbaztec
Copy link
Collaborator

@nbaztec nbaztec commented Jan 14, 2025

What 💻

  • Fixes erroneous nonce updates
    • We now revert tx nonce update for CALL (on tx caller) while leaving the nonce update for CREATE as we are manually dispatching the CALLs to zkEVM which does not constitute a real transaction.
  • Support zksync-specific nonce cheatcodes
  • Make nonces u128 as that's their theoretical maximum.

Why ✋

  • Nonces were erroneously being skipped or updated that was inconsistent with EVM logic
  • getNonce cheatcode was previously only returning tx nonce causing confusion, with no way to obtain deployment nonce.
  • Avoid inconsistency of nonce bit sizes. Theoretical maximum 128-bit, server accepts 32-bit.

Evidence 📷

Tests pass

Documentation 📚

Please ensure the following before submitting your PR:

  • Check if these changes affect any documented features or workflows.
  • Update the book if these changes affect any documented features or workflows.

Notes 📝

  • Add test

@nbaztec nbaztec requested a review from a team as a code owner January 14, 2025 12:04
@nbaztec nbaztec marked this pull request as draft January 14, 2025 12:08
@nbaztec nbaztec marked this pull request as ready for review January 16, 2025 19:19
elfedy
elfedy previously approved these changes Jan 17, 2025
Copy link
Contributor

@elfedy elfedy left a comment

Choose a reason for hiding this comment

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

Did I get correctly that tx_nonce stays consistent with evm and deploy_nonce stays consistent with zkEVM? If so (and if not, then even more) maybe we should document the nonce expected flow somewhere so it does not get lost in ancient lore.

crates/cheatcodes/spec/src/vm.rs Outdated Show resolved Hide resolved
crates/cheatcodes/spec/src/vm.rs Outdated Show resolved Hide resolved
crates/zksync/core/src/vm/inspect.rs Outdated Show resolved Hide resolved
Co-authored-by: Federico Rodríguez <[email protected]>
@nbaztec nbaztec merged commit 7630fbd into main Jan 23, 2025
23 checks passed
@nbaztec nbaztec deleted the nish-fix-nonce-updates branch January 23, 2025 17:24
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.

2 participants