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

chore: rework nonces (#1210) #1331

Merged
merged 26 commits into from
Aug 3, 2023
Merged

chore: rework nonces (#1210) #1331

merged 26 commits into from
Aug 3, 2023

Conversation

dbanks12
Copy link
Collaborator

@dbanks12 dbanks12 commented Aug 1, 2023

Description

The way nonces work now, there can be inconsistencies in nonce assignment in the simulator vs the private kernel. Furthermore, you cannot know during function execution what the full set of commitments will be for the whole TX as some new commitments may be nullified and squashed. But we still want the ability to determine nonces and therefore uniqueNoteHashes from L1 calldata alone. I am sure I am not explaining all of the issues well enough, but it was determined that the current nonce paradigm will not work and therefore we must rework it.

Rework nonces so that siloing by contract address happens first and uniqueness comes later. For now, nonces are injeced by the private ordering circuit (vs suggestion which was base rollup circuit). Pending notes and their reads have no nonces when processed in kernel. The public kernel (and therefore all commitments created in public functions) does not use nonces.

Here was Mike's proposal for the rework:
image

Why not just use leaf index as nonce?
image

Followup tasks

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • The branch has been merged or rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

@dbanks12 dbanks12 marked this pull request as ready for review August 2, 2023 18:03
@iAmMichaelConnor
Copy link
Contributor

Just planting a flag that I've begun reviewing this, to save duplicated efforts from anyone else :)

Copy link
Contributor

@iAmMichaelConnor iAmMichaelConnor left a comment

Choose a reason for hiding this comment

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

Thanks for this! It's clear you've been very meticulous and methodical, which is fantastic for such a fiddly part of the protocol. Only a few minor change requests. Most of my comments can be addressed in later PRs, or are asking questions.

@iAmMichaelConnor iAmMichaelConnor enabled auto-merge (squash) August 3, 2023 15:34
@iAmMichaelConnor iAmMichaelConnor merged commit 665cb75 into master Aug 3, 2023
@iAmMichaelConnor iAmMichaelConnor deleted the db/1210-rework-nonces branch August 3, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants