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(sync): Sync latest globals within merkle tree ops #1612

Merged
merged 16 commits into from
Aug 18, 2023
Merged

Conversation

Maddiaa0
Copy link
Member

@Maddiaa0 Maddiaa0 commented Aug 17, 2023

Overview

Ci has been failing due to a race condition where world state operations were not being synchronised.
The offending value was that the world latestGlobalVariablesHash was not stored with the rest of the merkle trees, and such could not use the same serial queue to sync their update operations. This lead to the trees being out of sync with the globals value on some occasions. (I think)

This pr may be slightly contraversial as it stores non merkle tree data within the merkle_trees abstraction. However think the naming of the merkle_trees abstraction is the limiting factor. The file just stores and synchronises the world state, it just so happens that until now this state was all trees. (although this could be me bending reality to suit my current needs)

Adds a Committable type which allows us to add rollback functionality to anything

@Maddiaa0 Maddiaa0 marked this pull request as ready for review August 17, 2023 16:12
@@ -348,7 +346,7 @@ export class AztecNodeService implements AztecNode {
await getTreeRoot(MerkleTreeId.BLOCKS_TREE),
Fr.ZERO,
await getTreeRoot(MerkleTreeId.PUBLIC_DATA_TREE),
globalsHash,
await this.merkleTreeDB.getLatestGlobalVariablesHash(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm is there any chance this would advance such that the global variable hash is too new? Like if the system moves on after await getTreeRoot(MerkleTreeId.PUBLIC_DATA_TREE),

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't fully understand the code, but if we're fetching data it would be good to fetch it all at once representing one snapshot, 'latest' makes me nervous when used with other async calls

Copy link
Member Author

Choose a reason for hiding this comment

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

These changes have unfortunately broken the p2p tests, this could be the culprit

@Maddiaa0 Maddiaa0 marked this pull request as draft August 17, 2023 16:19
Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

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

LGTM if we can get a few runs of this without issue, however some comment from you on if the latest globals match the rest of the tree data we're getting would be good

@ludamad ludamad self-requested a review August 17, 2023 16:20
@ludamad
Copy link
Collaborator

ludamad commented Aug 17, 2023

Revoking acceptance given the comment

@Maddiaa0 Maddiaa0 marked this pull request as ready for review August 18, 2023 17:57
Copy link
Contributor

@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! Well done!

@Maddiaa0 Maddiaa0 enabled auto-merge (squash) August 18, 2023 18:19
@Maddiaa0 Maddiaa0 merged commit 03b4cf6 into master Aug 18, 2023
1 check passed
@Maddiaa0 Maddiaa0 deleted the md/fix-race branch August 18, 2023 18:27
@ludamad
Copy link
Collaborator

ludamad commented Aug 18, 2023

Only nit is a future comment would be nice

@Maddiaa0
Copy link
Member Author

Only nit is a future comment would be nice

Where should I place the comment and what should I highlight, ill incorporate it into a coming pr

@ludamad
Copy link
Collaborator

ludamad commented Aug 19, 2023

Would be nice to comment the promise all

codygunton pushed a commit that referenced this pull request Jan 23, 2024
* dynamic reference to redis cluster subnet group (#1594)

Co-authored-by: PhilWindle <philip.windle@gmail.com>

* Created generic swapping agent for both uniswap and lido-curve bridges (#1265)

* JB/Website changes (#1554)

* Bruno changes

* Grants changes

* Update grants page, edit team page

* Fix typos, change header, footer links; noir links

* Fix sliders

* Copy changes

* Adds two RFPs

* Add Michael to Careers, typos

* Fix titles of roles

* JB/Website changes (#1612)

* Bruno changes

* Grants changes

* Update grants page, edit team page

* Fix typos, change header, footer links; noir links

* Fix sliders

* Copy changes

* Adds two RFPs

* Add Michael to Careers, typos

* Fix titles of roles

* Fix lint, replace images

* Pass the uint context to the return value of uint::at  (#1593)

* Construct return value from current context in uint::at

Fixes AztecProtocol/aztec2-internal#1433

* Add uint test which asserts context inheritance

* Move to yarn 3 plug 'n play and workspaces, pure ESM modules. (#1599)

* Transferrables and webpack to build a worker.js until we have loader chaining...

* Prod/dev conf

* Update bb imports.

* bb tests passing.

* Integrate wasm back in bb.js. Passing tests. Reduce wasm memory footprint.

* Can run halloumi and falafel.

* Falafel tests pass.

* Sdk tests pass.

* e2e.test passes.

* webpack

* bb.js yarn 3.2.2

* fix mem align

* fix bitwise warning on newer clang

* Tweaks towards wasi 16 (more to figure out)

* yarn 3.2.2

* remove encoding headers from block source client

* bb.js updates

* Blockchain test transpile to cjs for hardhat.

* Fix blockchain.

* SDK alternates proving keys.

* Falafel/halloumi start_e2e scripts args.

* Shared linting, formatting for bb.js and blockchain.

* explorer import changes. build needs fixing.

* end-to-end, falafel, halloumi linting

* Hummus just a terminal. Linting. Version upgrades.

* Linting. Bootstrapping. Wallet.

* prettier config.

* Basic working wallet.

* Fix apollo server stuff in falafel...

* account-migrator. explorer.

* Cleanup JSON stuff.

* wasabi.

* Revert jest->mocha

* Merge fixes.

* Initial zk-money.

* - Reconnect bootstrap scripts
- set prettier as js default

* - es-module style imports
- upgrade typescript
- copy wasm

* zk-money builds.

* Linting

* Dockerfile and build stuff.

* Move yarn project into own folder.

* explorer build. min cci yml.

* Introduce a build manifest to compute rebuild patterns.

* Addition of a script for auto launching tmux and running a test.

* Streamline bootstrapping.

* Add bash to falafel image.

* build image

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* Attempt to fix deploy.

* When scanning for rollups, we only cache the last block number where … (#1611)

* When scanning for rollups, we only cache the last block number where we actually found a rollup

* Fixed bug

* fix typo in zk-money app obs intial -> initial (#1633)

* Adress comments about docs (#1500)

* Adress comments about docs

* Update schnorr.md

Co-authored-by: Michael Connor <mike@aztecprotocol.com>

* Move genesis data from bb.js to falafel (#1640)

* moved init/genesis data from bb.js to falafel along with helper functions for reading the init data.

* data files no longer need to be moved as part of bb.js webpack

* obsolete comment in bb.js env

* Moved some init helper functions back to bb.js. Renamed helper class in falafel. Fixed missing 'any' type in falafel env init.ts

* copy init account data to dest in falafel

Co-authored-by: spypsy <spypsy@users.noreply.github.com>
Co-authored-by: Jonathan Bursztyn <jobur93@gmail.com>
Co-authored-by: Guido Vranken <guidovranken@users.noreply.github.com>
Co-authored-by: Charlie Lye <charlie@aztecprotocol.com>
Co-authored-by: Charlie Lye <karl.lye@gmail.com>
Co-authored-by: David Banks <47112877+dbanks12@users.noreply.github.com>
Co-authored-by: Adrian Hamelink <adrian.hamelink@gmail.com>
Co-authored-by: Michael Connor <mike@aztecprotocol.com>
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.

3 participants