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: redo nullifier tree insertion algorithm #240

Merged
merged 42 commits into from
Apr 14, 2023
Merged

Conversation

Maddiaa0
Copy link
Member

@Maddiaa0 Maddiaa0 commented Apr 11, 2023

Description

Fixes batch insertion algorithm that did not handle random test cases well enough. This pr covers most cases but further investigation is being done and more test cases written to harden the implementation

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.

@Maddiaa0 Maddiaa0 marked this pull request as draft April 11, 2023 19:10
@Maddiaa0
Copy link
Member Author

depends on this pr AztecProtocol/aztec3-circuits#231

@Maddiaa0 Maddiaa0 marked this pull request as ready for review April 12, 2023 21:41
@Maddiaa0 Maddiaa0 marked this pull request as draft April 12, 2023 21:41
@ludamad
Copy link
Collaborator

ludamad commented Apr 13, 2023

Looks like you're getting some of the issues I was trying to tackle here #216

@Maddiaa0 Maddiaa0 changed the base branch from master to pw/fix-nullifier-tree April 14, 2023 10:44
@Maddiaa0 Maddiaa0 changed the base branch from pw/fix-nullifier-tree to master April 14, 2023 10:44
@Maddiaa0 Maddiaa0 marked this pull request as ready for review April 14, 2023 10:49
* val 0 5 10 15 2 3 20 19
* nextIdx 5 2 3 8 6 2 0 7
* nextVal 2 10 15 19 3 5 0 20
*
* TODO: this implementation will change once the zero value is changed from h(0,0,0). Changes incoming over the next sprint
* @param leaves Values to insert into the tree
* @returns
*/
public async performBaseRollupBatchInsertionProofs(leaves: Buffer[]): Promise<LowNullifierWitnessData[] | undefined> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like we should break this function out into a seperate file, inject the db instance and create some test cases for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1, but I think it's part of a bigger refactor on the block builder. I can take it once this is merged.

yarn-project/end-to-end/src/e2e_zk_token_contract.test.ts Outdated Show resolved Hide resolved
@Maddiaa0 Maddiaa0 marked this pull request as draft April 14, 2023 14:00
@Maddiaa0 Maddiaa0 mentioned this pull request Apr 14, 2023
6 tasks
Copy link
Collaborator

@spalladino spalladino left a comment

Choose a reason for hiding this comment

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

LGTM, though I didn't go in depth on the workings of the algorithm itself, so take this approval with a grain of salt.

@Maddiaa0 Maddiaa0 marked this pull request as ready for review April 14, 2023 19:07
spypsy and others added 6 commits April 14, 2023 19:45
* add config from env vars in projects + update e2e config

* remove comment

* Fix automatic import

* remove comments

* remove hardcoded addresses + reduce .isMined poll freq

* more chagnes to isMined freq

* fix zero EthAddress
@Maddiaa0 Maddiaa0 force-pushed the md/new-nt-insertion-algo branch from aa14bd5 to b95e098 Compare April 14, 2023 19:48
@Maddiaa0 Maddiaa0 dismissed PhilWindle’s stale review April 14, 2023 20:01

Changes will be addressed as part of a wider refactor

* val 0 5 10 15 2 3 20 19
* nextIdx 5 2 3 8 6 2 0 7
* nextVal 2 10 15 19 3 5 0 20
*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Beautiful megacomment

Copy link
Collaborator

@dbanks12 dbanks12 left a comment

Choose a reason for hiding this comment

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

LGTM

@Maddiaa0 Maddiaa0 merged commit c6d6913 into master Apr 14, 2023
@Maddiaa0 Maddiaa0 deleted the md/new-nt-insertion-algo branch April 14, 2023 20:42
ludamad pushed a commit that referenced this pull request Apr 14, 2023
ludamad pushed a commit that referenced this pull request Apr 17, 2023
ludamad pushed a commit that referenced this pull request Apr 17, 2023
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.

9 participants