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

refactor: keep track of blocks emitting/cancelling messages #4028

Merged
merged 3 commits into from
Jan 17, 2024

Conversation

alexghr
Copy link
Contributor

@alexghr alexghr commented Jan 16, 2024

This PR refactors the archiver to keep track of which L1 block last emitted messages or cancelled messages (similar to how it discovers L2 blocks) in order to make the synch process more efficient.

@alexghr alexghr changed the title refactor: process l1-l2 messages per block refactor: keep track of blocks emitting/cancelling messages Jan 16, 2024
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 16, 2024

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 309 (-22%)
  • note_trial_decrypting_time_in_ms (8): 18.0 (-83%)
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 09090e87 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 220,944 866,360 3,447,800
l1_rollup_execution_gas 934,088 3,968,834 24,791,336
l2_block_processing_time_in_ms 1,402 (+5%) 5,306 (+2%) 21,965 (-11%)
note_successful_decrypting_time_in_ms ⚠️ 309 (-22%) 939 (+1%) 3,530 (+1%)
note_trial_decrypting_time_in_ms ⚠️ 18.0 (-83%) 64.7 (+22%) 146 (+11%)
l2_block_building_time_in_ms 16,080 63,931 256,180 (-1%)
l2_block_rollup_simulation_time_in_ms 11,705 (+1%) 46,615 (+1%) 187,101 (-2%)
l2_block_public_tx_process_time_in_ms 4,338 (-1%) 17,230 68,792

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 15,945 (+7%) 29,960 (+4%)
note_history_successful_decrypting_time_in_ms 2,194 4,259 (-2%)
note_history_trial_decrypting_time_in_ms 122 (+5%) 188 (+5%)
node_database_size_in_bytes 3,579,589 3,648,978
pxe_database_size_in_bytes 29,923 59,478

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 213 44,681 25,561
private-kernel-ordering 165 (-1%) 43,753 14,809
base-rollup 1,197 128,338 881
root-rollup 78.9 4,088 677
private-kernel-inner 292 71,208 25,561
public-kernel-private-input 205 31,863 25,561
public-kernel-non-first-iteration 203 31,905 25,561
merge-rollup 7.65 (-1%) 2,608 881

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 2 leaves 8 leaves 16 leaves 32 leaves 128 leaves 64 leaves 512 leaves 1024 leaves 2048 leaves 8192 leaves
batch_insert_into_append_only_tree_16_depth_ms 12.4 (+6%) 19.6 (+8%) 13.4 (-2%) 19.3 (+5%) 26.2 (+8%) 68.4 (-15%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.9 17.5 23.0 31.6 47.0 143 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.628 (-1%) 0.647 (+1%) 0.543 0.539 (+2%) 0.488 0.443 (-18%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A N/A N/A N/A 87.8 (+2%) 52.2 (-1%) 252 (+3%) 473 919 3,598 (-7%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A N/A N/A N/A 159 96.0 543 1,055 2,079 8,223
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A N/A N/A N/A 0.491 (-2%) 0.501 (-4%) 0.439 0.434 0.431 0.429 (-7%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A N/A N/A N/A 116 (-10%) 62.6 (-1%) 367 (+1%) 756 (+1%) 1,439 (+1%) 5,965 (-10%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A N/A N/A N/A 197 104 691 1,363 2,707 10,771
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A N/A N/A N/A 0.498 (-12%) 0.506 (-5%) 0.478 0.482 (+1%) 0.476 (-1%) 0.486 (-14%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A 67.5 (-2%) N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A 94.1 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A 0.595 (-7%) N/A N/A N/A N/A N/A N/A N/A

Miscellaneous

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

Metric 0 deployed contracts 1 deployed contracts
tx_size_in_bytes 15,455 32,219

Transaction processing duration by data writes.

Metric 0 new commitments 1 new commitments
tx_pxe_processing_time_ms 374 1,086
Metric 1 public data writes
tx_sequencer_processing_time_ms 535

@alexghr alexghr marked this pull request as ready for review January 16, 2024 09: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.

Just a couple of minor nits.

@@ -600,19 +574,18 @@ export class LMDBArchiverStore implements ArchiverDataStore {
return Promise.resolve(typeof lastBlockNumber === 'number' ? lastBlockNumber : INITIAL_L2_BLOCK_NUM - 1);
}

getL1BlockNumber(): Promise<bigint> {
getL1BlockNumber() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you comment this please?

@alexghr alexghr merged commit d250a0e into master Jan 17, 2024
83 checks passed
@alexghr alexghr deleted the alexg/refactor/l1-l2-msg-synch branch January 17, 2024 09:48
PhilWindle pushed a commit that referenced this pull request Jan 19, 2024
This PR refactors the archiver store to use `@aztec/kv-store` instead of
lmdb directly. It is stacked on top of #4028.

The diff looks massive but all it does is split the archiver store into
individual pieces to better separate them conceptually (blocks, logs,
contracts, messages) and replace direct uses of lmdb with the data
structures from kv-store.
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
…tocol#4028)

This PR refactors the archiver to keep track of which L1 block last
emitted messages or cancelled messages (similar to how it discovers L2
blocks) in order to make the synch process more efficient.
michaelelliot pushed a commit to Swoir/noir_rs that referenced this pull request Feb 28, 2024
This PR refactors the archiver store to use `@aztec/kv-store` instead of
lmdb directly. It is stacked on top of AztecProtocol#4028.

The diff looks massive but all it does is split the archiver store into
individual pieces to better separate them conceptually (blocks, logs,
contracts, messages) and replace direct uses of lmdb with the data
structures from kv-store.
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