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

feat: extra check on time #8204

Closed
wants to merge 1 commit into from
Closed

Conversation

LHerskind
Copy link
Contributor

@LHerskind LHerskind commented Aug 27, 2024

Adds a check that the timestamp is not in the future.

Copy link
Contributor Author

LHerskind commented Aug 27, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @LHerskind and the rest of your teammates on Graphite Graphite

@AztecBot
Copy link
Collaborator

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (FeeJuice:set_portal): 13.4 (+39%)
  • avm_simulation_time_ms (Token:mint_public): 77.4 (+75%)
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.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,746 1,556 712 740 (-3%) 768 (-1%)
proof_construction_time_sha256_30_ms 11,593 (+1%) 3,080 1,382 (+1%) 1,432 1,452
proof_construction_time_sha256_100_ms 44,160 11,832 5,429 5,478 (+1%) 5,935 (+3%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 58.0 87.0 (-1%)
proof_construction_time_poseidon_hash_30_ms 1,528 422 202 229 (+2%) 269
proof_construction_time_poseidon_hash_100_ms 5,645 1,513 670 736 (-1%) 743

L2 block published to L1

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

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 4,356 7,876 14,884
l1_rollup_calldata_gas 50,220 92,992 178,264
l1_rollup_execution_gas 843,030 1,576,698 3,362,026
l2_block_processing_time_in_ms 257 452 (+3%) 830 (-2%)
l2_block_building_time_in_ms 11,318 22,229 44,262
l2_block_rollup_simulation_time_in_ms 11,317 22,229 44,262
l2_block_public_tx_process_time_in_ms 9,615 20,425 42,439

L2 chain processing

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

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 3,040 (+4%) 3,856 (+1%)
node_database_size_in_bytes 12,660,816 16,683,088
pxe_database_size_in_bytes 16,254 26,813

Circuits stats

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

Circuit simulation_time_in_ms witness_generation_time_in_ms input_size_in_bytes output_size_in_bytes proving_time_in_ms
private-kernel-init 98.4 (+7%) 399 21,735 44,860 N/A
private-kernel-inner 176 (+1%) 708 (-1%) 72,544 45,007 N/A
private-kernel-reset-tiny 315 (+1%) 724 (+1%) 65,593 44,846 N/A
private-kernel-tail 166 156 (+12%) 50,644 52,257 N/A
base-parity 5.66 (+1%) N/A 160 96.0 N/A
root-parity 37.0 (+5%) N/A 73,948 96.0 N/A
base-rollup 3,448 N/A 189,136 664 N/A
block-root-rollup 41.6 N/A 58,205 2,448 N/A
public-kernel-setup 86.5 (+2%) N/A 105,085 71,222 N/A
public-kernel-app-logic 96.8 N/A 104,911 71,222 N/A
public-kernel-tail 862 N/A 390,582 16,414 N/A
private-kernel-reset-small 316 (+2%) N/A 66,341 45,629 N/A
private-kernel-tail-to-public 673 (+1%) 620 (+1%) 455,400 1,825 N/A
public-kernel-teardown 85.6 (+2%) N/A 105,349 71,222 N/A
merge-rollup 20.4 N/A 38,174 664 N/A
undefined N/A N/A N/A N/A 78,338

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms
ContractClassRegisterer:register 1,344 11,731 344 (+1%)
ContractInstanceDeployer:deploy 1,408 11,731 18.4
MultiCallEntrypoint:entrypoint 1,920 11,731 406 (+1%)
FeeJuice:deploy 1,376 11,731 399 (+2%)
SchnorrAccount:constructor 1,312 11,731 73.7 (+1%)
SchnorrAccount:entrypoint 2,304 11,731 398 (+1%)
Token:privately_mint_private_note 1,280 11,731 103 (-1%)
FPC:fee_entrypoint_public 1,344 11,731 27.4 (+5%)
Token:transfer 1,312 11,731 237 (+4%)
Benchmarking:create_note 1,344 11,731 86.2 (-1%)
SchnorrAccount:verify_private_authwit 1,280 11,731 28.4 (+4%)
Token:unshield 1,376 11,731 534 (+2%)
FPC:fee_entrypoint_private 1,376 11,731 753 (+2%)

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
FeeJuice:_increase_public_balance 63.8 (+16%) 7,101
FeeJuice:set_portal ⚠️ 13.4 (+39%) 2,128
Token:constructor 79.8 (+1%) 25,285
FPC:constructor 53.0 17,853
FeeJuice:mint_public 39.9 (+2%) 5,415
Token:mint_public ⚠️ 77.4 (+75%) 10,101
Token:assert_minter_and_mint 50.0 (-23%) 6,844
AuthRegistry:set_authorized 47.0 (-2%) 3,969
FPC:prepare_fee 238 (+1%) 6,747
Token:transfer_public 22.1 (-19%) 38,126
FPC:pay_refund 53.0 9,398
Benchmarking:increment_balance 1,195 6,179
Token:_increase_public_balance 41.8 (+3%) 7,705
FPC:pay_refund_with_shielded_rebate 63.2 (+4%) 9,881

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.156

Tree insertion stats

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

Metric 1 leaves 16 leaves 64 leaves 128 leaves 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 2.18 3.93 (+2%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.113 0.111 (+2%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.3 (+1%) 17.8 (-1%) 30.6 (+1%) 59.3 (+1%) 113 (-1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.108 (+1%) 0.103 (-1%) 0.0994 (+1%) 0.102 (+1%) 0.101 (-1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.5 (+2%) 25.7 (+1%) 43.4 (+1%) 83.7 (+2%) 163 (+1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.110 (+2%) 0.104 (+1%) 0.105 (+1%) 0.103 (+2%) 0.103 (+1%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.7 (+1%) N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 132 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.107 (+1%) N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 64,779 668,997

Transaction size based on fee payment method

| Metric | |
| - | |

@@ -609,6 +609,16 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
revert Errors.Rollup__InvalidTimestamp(timestamp, _header.globalVariables.timestamp);
}

if (timestamp > block.timestamp) {
// @note If you are hitting this error, it is likely because you the chain have a blocktime that differs
Copy link
Collaborator

Choose a reason for hiding this comment

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

driveby nit: 'you the chain'

@LHerskind LHerskind marked this pull request as ready for review August 27, 2024 13:12
@LHerskind LHerskind force-pushed the lh/extra-l1-timestamp-checks branch 2 times, most recently from c40163d to 4c856ea Compare August 27, 2024 15:29
Base automatically changed from lh/8103-devnet-prune to master August 28, 2024 07:22
@LHerskind LHerskind force-pushed the lh/extra-l1-timestamp-checks branch 2 times, most recently from 5ab61a1 to eaf2271 Compare August 28, 2024 13:34
@LHerskind LHerskind enabled auto-merge (squash) August 28, 2024 13:40
@LHerskind
Copy link
Contributor Author

Closing this, handled by #8148.

@LHerskind LHerskind closed this Aug 29, 2024
auto-merge was automatically disabled August 29, 2024 06:33

Pull request was closed

LHerskind added a commit that referenced this pull request Aug 29, 2024
Doing some cleanup after #7850, looking to address the issue of #8153
and #8110.

- #8153
- Addressed by including a "watcher" as part of the setup, which will
push us to the next slot if there is already a block proposed for the
current one.
- #8110
- Updates the logic in the contract such that we can deal with
"simulating" in the future, and use this from the sequencer.

Gets rid of the `time_traveler` from the l1-publisher, now lives in the
watcher which is used in tests.

Issues related to slot duration is still to be addressed, so the name of
this branch got slightly funky.

Taking over the extra check added in #8204 since i) they are related and
ii) the pain of going through CI made me do it.
codygunton pushed a commit that referenced this pull request Aug 30, 2024
Doing some cleanup after #7850, looking to address the issue of #8153
and #8110.

- #8153
- Addressed by including a "watcher" as part of the setup, which will
push us to the next slot if there is already a block proposed for the
current one.
- #8110
- Updates the logic in the contract such that we can deal with
"simulating" in the future, and use this from the sequencer.

Gets rid of the `time_traveler` from the l1-publisher, now lives in the
watcher which is used in tests.

Issues related to slot duration is still to be addressed, so the name of
this branch got slightly funky.

Taking over the extra check added in #8204 since i) they are related and
ii) the pain of going through CI made me do it.
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.

4 participants