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: set side effect hwm in child private calls #5624

Closed

Conversation

alexghr
Copy link
Contributor

@alexghr alexghr commented Apr 9, 2024

Please read contributing guidelines and remove this line.

Copy link
Contributor Author

alexghr commented Apr 9, 2024

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

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

@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from ce3b85d to 7f4090c Compare April 9, 2024 08:44
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from 1c39111 to 10c0bcd Compare April 9, 2024 08:44
@alexghr alexghr linked an issue Apr 9, 2024 that may be closed by this pull request
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from 7f4090c to bb0fc4f Compare April 9, 2024 09:15
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from 10c0bcd to a5d749b Compare April 9, 2024 09:15
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from bb0fc4f to 18350f2 Compare April 9, 2024 09:40
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from a5d749b to 31d58d1 Compare April 9, 2024 09:40
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from 18350f2 to ff81957 Compare April 9, 2024 16:48
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from 31d58d1 to e64797a Compare April 9, 2024 16:48
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from ff81957 to ed2bdc1 Compare April 9, 2024 16:56
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from e64797a to f5a40fd Compare April 9, 2024 16:57
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from ed2bdc1 to 9535bd2 Compare April 10, 2024 06:12
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from f5a40fd to 7135942 Compare April 10, 2024 06:12
@alexghr alexghr force-pushed the 04-05-refactor_account_bootstrap_entrypoint branch from 9535bd2 to 3f3c7de Compare April 10, 2024 08:49
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from 7135942 to 971867b Compare April 10, 2024 08:49
Base automatically changed from 04-05-refactor_account_bootstrap_entrypoint to master April 10, 2024 09:22
@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch 2 times, most recently from c4ebb1f to c4a05e8 Compare April 10, 2024 09:59
@alexghr alexghr marked this pull request as ready for review April 10, 2024 10:00
@AztecBot
Copy link
Collaborator

AztecBot commented Apr 10, 2024

Benchmark results

Metrics with a significant change:

  • note_successful_decrypting_time_in_ms (8): 200 (-19%)
  • note_trial_decrypting_time_in_ms (8): 103 (+119%)
  • note_trial_decrypting_time_in_ms (32): 113 (+161%)
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 aa0d2e4b 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 64 txs
l1_rollup_calldata_size_in_bytes 676 676 676
l1_rollup_calldata_gas 6,412 6,424 6,412
l1_rollup_execution_gas 585,745 585,757 585,745
l2_block_processing_time_in_ms 1,306 (+1%) 4,885 (+4%) 9,447
note_successful_decrypting_time_in_ms ⚠️ 200 (-19%) 602 (+13%) 961 (-9%)
note_trial_decrypting_time_in_ms ⚠️ 103 (+119%) ⚠️ 113 (+161%) 79.0 (+13%)
l2_block_building_time_in_ms 11,905 (+1%) 43,150 (+1%) 84,980 (+1%)
l2_block_rollup_simulation_time_in_ms 11,869 (+1%) 43,035 (+1%) 84,749 (+1%)
l2_block_public_tx_process_time_in_ms 6,202 (+1%) 24,350 (+1%) 48,933 (+1%)

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 13,870 (-4%) 25,416 (-8%)
note_history_successful_decrypting_time_in_ms 1,275 (-3%) 2,353 (-2%)
note_history_trial_decrypting_time_in_ms 71.0 (+13%) 99.8 (-2%)
node_database_size_in_bytes 18,636,880 34,902,096
pxe_database_size_in_bytes 29,859 59,414

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 181 (+1%) 44,377 26,164
private-kernel-inner 216 71,744 26,164
private-kernel-ordering 163 (+1%) 50,830 39,026
base-parity 3,888 (+2%) 128 311
root-parity 1,117 (+3%) 1,244 311
base-rollup 14,166 110,464 861
root-rollup 49.7 4,359 725
public-kernel-app-logic 120 (-2%) 47,695 40,661
public-kernel-tail 164 53,372 7,125
merge-rollup 9.32 (-12%) 2,568 861
public-kernel-teardown 119 (+2%) 47,695 40,661
public-kernel-setup 117 (+2%) 47,695 40,661

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 512 leaves 1024 leaves 2048 leaves 4096 leaves 32 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.0 16.1 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.6 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.585 0.496 N/A N/A N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 46.0 73.4 (+1%) 233 (+1%) 446 878 1,745 (+1%) N/A
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 96.0 159 543 1,055 2,079 4,127 N/A
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.472 0.452 (+1%) 0.424 (+1%) 0.417 0.416 0.417 (+1%) N/A
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 54.4 108 (+1%) 339 (+1%) 659 1,329 (+1%) 2,615 (-1%) N/A
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 105 207 691 1,363 2,707 5,395 N/A
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.480 0.484 (+1%) 0.460 0.454 0.458 (+1%) 0.455 (-1%) N/A
batch_insert_into_indexed_tree_40_depth_ms N/A N/A N/A N/A N/A N/A N/A N/A 61.2
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A N/A N/A N/A N/A N/A N/A 109
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A N/A N/A N/A N/A N/A N/A 0.534

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 40,372 496,534

Transaction size based on fee payment method

Metric native fee payment method fpc_public fee payment method fpc_private fee payment method
tx_with_fee_size_in_bytes 905 1,161 1,377

Transaction processing duration by data writes.

Metric 0 new note hashes 1 new note hashes 2 new note hashes
tx_pxe_processing_time_ms 1,652 (-2%) 1,086 (+1%) 5,431 (+1%)
Metric 1 public data writes 2 public data writes 3 public data writes 4 public data writes 5 public data writes 8 public data writes
tx_sequencer_processing_time_ms 577 401 (+1%) 1,073 (+1%) 522 (+6%) 1,721 (-1%) 587 (+1%)

@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch 2 times, most recently from 5b7af0e to ba801e0 Compare April 16, 2024 08:16
const [kernelInputs, publicKernelOutput, publicKernelProof, newUnencryptedFunctionLogs, revertReason] =
await this.processEnqueuedPublicCalls(tx, previousPublicKernelOutput, previousPublicKernelProof).catch(
// the abstract phase manager throws if simulation gives error in a non-revertible phase
async err => {
await this.publicContractsDB.removeNewContracts(tx);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, not for this PR but maybe we need to create a seperate issue.

If App logic fails, will any contracts added here get removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The app logic phase manager would remove all the contract from the transaction.
I just realised that this is wrong and we need to differentiate between contracts deployed in revertible vs non-revertible so that public effects are properly accounted for. I'll add a comment about this to #4712

@@ -0,0 +1,3 @@
pub fn max(a: u32, b: u32) -> u32 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought I saw someone else was using a generic min and or max function. Can you check if that got merged and maybe we can use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked and I couldn't see a "max" function in noir. I could remove this and go back to the if statement?

@alexghr alexghr force-pushed the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch from ba801e0 to 4768687 Compare April 17, 2024 15:45
@alexghr alexghr requested a review from PhilWindle April 17, 2024 15:51
@alexghr
Copy link
Contributor Author

alexghr commented May 24, 2024

This was rolled into a different PR.

@alexghr alexghr closed this May 24, 2024
@alexghr alexghr deleted the 04-09-fix_set_side_effect_hwm_in_child_private_calls branch May 24, 2024 09:35
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.

Enable private calls to set min_non_revertible_side_effect_counter
3 participants