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: wait for accounts to catch up with notes when deployed #2834

Merged
merged 7 commits into from
Nov 7, 2023

Conversation

alexghr
Copy link
Contributor

@alexghr alexghr commented Oct 13, 2023

Fix #466. This PR ensures that the PXE (and its Synchronizer service) are fully synced up with the node before accepting transactions.

Checklist:

Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.

  • If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag.
  • I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code.
  • Every change is related to the PR description.
  • I have linked this pull request to relevant issues (if any exist).

@AztecBot
Copy link
Collaborator

AztecBot commented Oct 13, 2023

Benchmark results

No metrics with a significant change found.

Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Values are compared against data from master at commit a062026d and shown if the difference exceeds 1%.

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 8 txs 32 txs 128 txs
l1_rollup_calldata_size_in_bytes 45,444 179,588 716,132
l1_rollup_calldata_gas 222,960 868,088 3,449,468
l1_rollup_execution_gas 842,047 3,595,196 22,204,837
l2_block_processing_time_in_ms 1,962 (-1%) 7,507 (-1%) 29,494 (-1%)
note_successful_decrypting_time_in_ms 291 (-3%) 866 (+1%) 3,142 (-2%)
note_trial_decrypting_time_in_ms 95.0 (-5%) 76.0 (+12%) 135 (+1%)
l2_block_building_time_in_ms 13,488 (+2%) 52,388 209,331
l2_block_rollup_simulation_time_in_ms 12,124 (+2%) 47,101 188,204
l2_block_public_tx_process_time_in_ms 1,318 (+1%) 5,153 (-1%) 20,633

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 16 txs.

Metric 5 blocks 10 blocks
node_history_sync_time_in_ms 21,399 (-1%) 41,820 (-1%)
note_history_successful_decrypting_time_in_ms 1,987 (-2%) 3,892 (-1%)
note_history_trial_decrypting_time_in_ms 121 (+1%) 142 (-1%)
node_database_size_in_bytes 1,633,150 1,101,069
pxe_database_size_in_bytes 29,748 59,307

Circuits stats

Stats on running time and I/O sizes collected for every circuit run across all benchmarks.

Circuit circuit_simulation_time_in_ms circuit_input_size_in_bytes circuit_output_size_in_bytes
private-kernel-init 772 (-1%) 61,697 18,905
private-kernel-ordering 123 (-1%) 24,297 8,153
base-rollup 1,769 656,311 814
root-rollup 83.3 (+4%) 4,072 1,097
private-kernel-inner 789 81,568 18,905
public-kernel-private-input 41.4 41,519 18,841
public-kernel-non-first-iteration 26.2 41,497 18,841
merge-rollup 0.891 (-8%) 2,592 873

Miscellaneous

Transaction sizes based on how many contracts are deployed in the tx.

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 8,787 27,547

@alexghr alexghr marked this pull request as draft October 13, 2023 12:28
@alexghr alexghr force-pushed the alexg/fix/pxe-block-initial-sync branch from c8120a4 to 627dfaa Compare October 16, 2023 09:23
@alexghr alexghr changed the title fix: catch up synchronizer with node fix: wait for accounts to catch up with notes when deployed Oct 16, 2023
@alexghr alexghr force-pushed the alexg/fix/pxe-block-initial-sync branch from 627dfaa to 01ad942 Compare October 16, 2023 09:39
@alexghr alexghr marked this pull request as ready for review October 16, 2023 15:48
Copy link
Collaborator

@PhilWindle PhilWindle left a comment

Choose a reason for hiding this comment

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

I think we still need to prevent somebody doing the following don't we?

  1. User adds their account contract to the PXE via 'addContracts'.
  2. User calls 'registerAccount' on the PXE to add their account and start a note processor catch-up.
  3. User sends transaction before the note processor is synched. I think we should reject the attempt to do so for the time being.

yarn-project/pxe/src/synchronizer/synchronizer.ts Outdated Show resolved Hide resolved
@alexghr alexghr marked this pull request as draft October 18, 2023 14:02
@alexghr alexghr force-pushed the alexg/fix/pxe-block-initial-sync branch from 62280ec to cc38e45 Compare November 6, 2023 12:47
@alexghr alexghr requested a review from PhilWindle November 6, 2023 17:12
@alexghr alexghr marked this pull request as ready for review November 6, 2023 17:13
@alexghr
Copy link
Contributor Author

alexghr commented Nov 6, 2023

I've updated the PR and now both deploying and registering an account with PXE will wait for it to fully sync up.

@alexghr alexghr merged commit a8f3119 into master Nov 7, 2023
2 checks passed
@alexghr alexghr deleted the alexg/fix/pxe-block-initial-sync branch November 7, 2023 12:39
rahul-kothari pushed a commit that referenced this pull request Nov 7, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.14.2</summary>

##
[0.14.2](aztec-packages-v0.14.1...aztec-packages-v0.14.2)
(2023-11-07)


### Features

* Load private tests and docs
([#3243](#3243))
([f3d8aae](f3d8aae)),
closes
[#1285](#1285)
* Run solidity tests for all acir artifacts
([#3161](#3161))
([d09f667](d09f667))


### Bug Fixes

* Wait for accounts to catch up with notes when deployed
([#2834](#2834))
([a8f3119](a8f3119))


### Miscellaneous

* Add noir-protocol-circuits to deploy_npm
([#3268](#3268))
([1a22cae](1a22cae))
* Aztec-cli better volume mounting strategy
([#3138](#3138))
([d40460e](d40460e))
* Disable circuits tasks
([#3253](#3253))
([e8945f8](e8945f8))
</details>

<details><summary>barretenberg.js: 0.14.2</summary>

##
[0.14.2](barretenberg.js-v0.14.1...barretenberg.js-v0.14.2)
(2023-11-07)


### Features

* Run solidity tests for all acir artifacts
([#3161](#3161))
([d09f667](d09f667))
</details>

<details><summary>barretenberg: 0.14.2</summary>

##
[0.14.2](barretenberg-v0.14.1...barretenberg-v0.14.2)
(2023-11-07)


### Features

* Run solidity tests for all acir artifacts
([#3161](#3161))
([d09f667](d09f667))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
AztecBot added a commit to AztecProtocol/barretenberg that referenced this pull request Nov 8, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>aztec-packages: 0.14.2</summary>

##
[0.14.2](AztecProtocol/aztec-packages@aztec-packages-v0.14.1...aztec-packages-v0.14.2)
(2023-11-07)


### Features

* Load private tests and docs
([#3243](AztecProtocol/aztec-packages#3243))
([f3d8aae](AztecProtocol/aztec-packages@f3d8aae)),
closes
[#1285](AztecProtocol/aztec-packages#1285)
* Run solidity tests for all acir artifacts
([#3161](AztecProtocol/aztec-packages#3161))
([d09f667](AztecProtocol/aztec-packages@d09f667))


### Bug Fixes

* Wait for accounts to catch up with notes when deployed
([#2834](AztecProtocol/aztec-packages#2834))
([a8f3119](AztecProtocol/aztec-packages@a8f3119))


### Miscellaneous

* Add noir-protocol-circuits to deploy_npm
([#3268](AztecProtocol/aztec-packages#3268))
([1a22cae](AztecProtocol/aztec-packages@1a22cae))
* Aztec-cli better volume mounting strategy
([#3138](AztecProtocol/aztec-packages#3138))
([d40460e](AztecProtocol/aztec-packages@d40460e))
* Disable circuits tasks
([#3253](AztecProtocol/aztec-packages#3253))
([e8945f8](AztecProtocol/aztec-packages@e8945f8))
</details>

<details><summary>barretenberg.js: 0.14.2</summary>

##
[0.14.2](AztecProtocol/aztec-packages@barretenberg.js-v0.14.1...barretenberg.js-v0.14.2)
(2023-11-07)


### Features

* Run solidity tests for all acir artifacts
([#3161](AztecProtocol/aztec-packages#3161))
([d09f667](AztecProtocol/aztec-packages@d09f667))
</details>

<details><summary>barretenberg: 0.14.2</summary>

##
[0.14.2](AztecProtocol/aztec-packages@barretenberg-v0.14.1...barretenberg-v0.14.2)
(2023-11-07)


### Features

* Run solidity tests for all acir artifacts
([#3161](AztecProtocol/aztec-packages#3161))
([d09f667](AztecProtocol/aztec-packages@d09f667))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

Aztec RPC server should block until an initial sync is done before allowing the user to send txs
3 participants