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: Test against Sepolia #8176

Merged
merged 16 commits into from
Aug 26, 2024
Merged

feat: Test against Sepolia #8176

merged 16 commits into from
Aug 26, 2024

Conversation

PhilWindle
Copy link
Collaborator

@PhilWindle PhilWindle commented Aug 24, 2024

This PR creates an e2e test that can be used against Sepolia. It also sets up an automated job for the test.

Copy link
Contributor

github-actions bot commented Aug 24, 2024

Changes to circuit sizes

Generated at commit: a3baaea4c32d10c3056f98c100480c78452f7802, compared to commit: bfbc4b2126c0fed038d46575a60311234a1a484a

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail +480,378 ❌ +102.86% +1,090,990 ❌ +36.57%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
public_kernel_tail 947,390 (+480,378) +102.86% 4,073,918 (+1,090,990) +36.57%

@AztecBot
Copy link
Collaborator

AztecBot commented Aug 24, 2024

Benchmark results

Metrics with a significant change:

  • protocol_circuit_simulation_time_in_ms (private-kernel-reset-tiny): 465 (+51%)
  • protocol_circuit_simulation_time_in_ms (base-rollup): 2,758 (-20%)
  • protocol_circuit_simulation_time_in_ms (public-kernel-tail): 557 (-36%)
  • protocol_circuit_simulation_time_in_ms (private-kernel-reset-small): 462 (+50%)
  • protocol_circuit_simulation_time_in_ms (private-kernel-tail-to-public): 1,354 (+106%)
  • avm_simulation_time_ms (Token:mint_public): 73.2 (+64%)
  • avm_simulation_time_ms (Token:assert_minter_and_mint): 41.8 (-37%)
  • avm_simulation_time_ms (Benchmarking:increment_balance): 941 (-22%)
  • protocol_circuit_witness_generation_time_in_ms (private-kernel-reset-tiny): 868 (+21%)
  • l2_block_building_time_in_ms (4): 9,005 (-21%)
  • l2_block_building_time_in_ms (8): 17,551 (-22%)
  • l2_block_building_time_in_ms (16): 35,274 (-20%)
  • l2_block_rollup_simulation_time_in_ms (4): 9,004 (-21%)
  • l2_block_rollup_simulation_time_in_ms (8): 17,550 (-22%)
  • l2_block_rollup_simulation_time_in_ms (16): 35,274 (-20%)
  • l2_block_public_tx_process_time_in_ms (4): 7,596 (-21%)
  • l2_block_public_tx_process_time_in_ms (8): 16,035 (-22%)
  • l2_block_public_tx_process_time_in_ms (16): 33,720 (-20%)
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,757 1,560 714 (+1%) 745 774
proof_construction_time_sha256_30_ms 11,476 3,083 1,380 (+1%) 1,424 1,457
proof_construction_time_sha256_100_ms 44,102 11,826 5,446 5,850 (+7%) 5,377 (-5%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 57.0 88.0 (+1%)
proof_construction_time_poseidon_hash_30_ms 1,526 420 202 222 (-2%) 266 (-3%)
proof_construction_time_poseidon_hash_100_ms 5,642 1,532 (+1%) 675 736 (-1%) 744

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,136 92,990 178,228
l1_rollup_execution_gas 1,396,387 2,130,137 3,915,431
l2_block_processing_time_in_ms 246 (-1%) 457 (+4%) 810 (-2%)
l2_block_building_time_in_ms ⚠️ 9,005 (-21%) ⚠️ 17,551 (-22%) ⚠️ 35,274 (-20%)
l2_block_rollup_simulation_time_in_ms ⚠️ 9,004 (-21%) ⚠️ 17,550 (-22%) ⚠️ 35,274 (-20%)
l2_block_public_tx_process_time_in_ms ⚠️ 7,596 (-21%) ⚠️ 16,035 (-22%) ⚠️ 33,720 (-20%)

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,032 (+5%) 3,892 (+2%)
node_database_size_in_bytes 12,615,760 16,736,336
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 89.9 (+6%) 396 (-1%) 21,755 44,860 N/A
private-kernel-inner 169 (-1%) 706 72,566 45,007 N/A
private-kernel-reset-tiny ⚠️ 465 (+51%) ⚠️ 868 (+21%) 65,675 44,846 N/A
private-kernel-tail 198 (+22%) 157 (+12%) 50,686 52,257 N/A
base-parity 5.66 (+1%) N/A 160 96.0 N/A
root-parity 35.5 N/A 73,948 96.0 N/A
base-rollup ⚠️ 2,758 (-20%) N/A 189,136 664 N/A
block-root-rollup 41.5 N/A 58,205 2,448 N/A
public-kernel-setup 83.6 (-2%) N/A 105,085 71,222 N/A
public-kernel-app-logic 95.8 N/A 104,911 71,222 N/A
public-kernel-tail ⚠️ 557 (-36%) N/A 410,534 (+5%) 16,414 N/A
private-kernel-reset-small ⚠️ 462 (+50%) N/A 66,341 45,629 N/A
private-kernel-tail-to-public ⚠️ 1,354 (+106%) 646 (+5%) 460,796 (+1%) 1,825 N/A
public-kernel-teardown 82.3 N/A 105,349 71,222 N/A
merge-rollup 20.0 (-3%) N/A 38,174 664 N/A
undefined N/A N/A N/A N/A 78,008 (+1%)

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 343
ContractInstanceDeployer:deploy 1,408 11,731 18.3
MultiCallEntrypoint:entrypoint 1,920 11,731 407
FeeJuice:deploy 1,376 11,731 391
SchnorrAccount:constructor 1,312 11,731 75.2
SchnorrAccount:entrypoint 2,304 11,731 400
Token:privately_mint_private_note 1,280 11,731 107 (+7%)
FPC:fee_entrypoint_public 1,344 11,731 27.9 (+1%)
Token:transfer 1,312 11,731 234 (+4%)
Benchmarking:create_note 1,344 11,731 86.1 (-4%)
SchnorrAccount:verify_private_authwit 1,280 11,731 27.7 (-2%)
Token:unshield 1,376 11,731 558 (+6%)
FPC:fee_entrypoint_private 1,376 11,731 745 (+7%)

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
FeeJuice:_increase_public_balance 55.8 7,739
FeeJuice:set_portal 11.3 (+6%) 2,354
Token:constructor 81.9 (+5%) 26,051
FPC:constructor 55.6 (+4%) 18,001
FeeJuice:mint_public 39.5 5,877
Token:mint_public ⚠️ 73.2 (+64%) 10,917
Token:assert_minter_and_mint ⚠️ 41.8 (-37%) 7,512
AuthRegistry:set_authorized 37.7 (+1%) 4,391
FPC:prepare_fee 232 (-2%) 7,043
Token:transfer_public 28.0 (-10%) 39,426
FPC:pay_refund 53.9 (+6%) 10,234
Benchmarking:increment_balance ⚠️ 941 (-22%) 6,563
Token:_increase_public_balance 39.9 (-1%) 8,433
FPC:pay_refund_with_shielded_rebate 63.4 10,783

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.159 (+1%)

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.21 3.96 (+3%) 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.115 0.112 (+3%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 11.6 (+3%) 17.9 (+1%) 31.3 (+1%) 60.8 (+3%) 115 (+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.111 (+3%) 0.103 (+1%) 0.102 (+1%) 0.104 (+3%) 0.103 (+1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 14.7 (+2%) 26.1 44.1 84.5 (+1%) 164 (+2%)
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.111 (+2%) 0.105 0.106 (+1%) 0.104 (+1%) 0.104 (+3%)
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 16.7 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 | |
| - | |

@PhilWindle PhilWindle marked this pull request as ready for review August 25, 2024 14:19
// process.env.SEQ_PUBLISHER_PRIVATE_KEY = '<PRIVATE_KEY_WITH_SEPOLIA_ETH>';
// process.env.PROVER_PUBLISHER_PRIVATE_KEY = '<PRIVATE_KEY_WITH_SEPOLIA_ETH>';
// process.env.ETHEREUM_HOST= 'https://sepolia.infura.io/v3/<API_KEY>';
// process.env.L1_CHAIN_ID = '11155111';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this getting set for the nightly run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently it's not as leaving everything defaulted causes the test to run against a local Anvil. Once I have seen it run successfully against Anvil I will put in another PR to set these values in the sepolia-test.yml

const chain = chainId == sepolia.id ? sepolia : foundry; // Not the best way of doing this.
({ logger, pxe, teardown, config, aztecNode } = await setup(
0,
{ skipProtocolContracts: true, stateLoad: undefined, salt: 1 },
Copy link
Collaborator

Choose a reason for hiding this comment

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

The salt: 1 means that we'll consistently reuse the same set of L1 rollup contracts, which means each test run won't be independent from the previous one. Are we sure about this? I'm worried that we could have breaking changes that screw up the node or prover-node syncing if we keep using the same rollup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh yeah. You make a good point. I was hoping to save on ETH by not re-deploying everytime but that's probably not desirable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I had the same concern.

Comment on lines +16 to +20
# Uncomment the following to run against Sepolia
# SEQ_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_SEQ_PRIVATE_KEY }}
# PROVER_PUBLISHER_PRIVATE_KEY: ${{ secrets.SEPOLIA_PROVER_PRIVATE_KEY }}
# ETHEREUM_HOST: 'https://sepolia.infura.io/v3/${{ secrets.SEPOLIA_API_KEY }}';
# L1_CHAIN_ID: '11155111' # Sepolia Chain ID
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we uncomment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not just yet. Once I have seen a successful Anvil run I will uncomment, and will have to load some ETH.

await teardown();
});

it('calls a private function', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've feel we've written variations of this test a dozen times already

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Possibly. The difference here really is that this uses the EasyPrivateTokenContract which isn't used anywhere else. It has no public bytecode that needs deploying. Once we are able to deploy public bytecode, I'll probably just use the standard token contract and an existing test.

Comment on lines 38 to 39
#ref: "${{ env.GIT_COMMIT }}"
ref: pw/new-test-2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the cron run if it is defined in a PR? If not, let's just change this to env.GIT_COMMIT now, since it won't need this branch, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, this was a oversight.

builder_type: builder-x86
# these are copied to the tester and expected by the earthly command below
# if they fail to copy, it will try to build them on the tester and fail
builder_images_to_copy: aztecprotocol/end-to-end:${{ env.GIT_COMMIT }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

e2e also pulls aztecprotocol/aztec in addition to aztecprotocol/end-to-end. Is it needed here?

@PhilWindle PhilWindle merged commit 758c723 into master Aug 26, 2024
97 checks passed
@PhilWindle PhilWindle deleted the pw/new-test-2 branch August 26, 2024 19:31
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