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!: protocol contracts #9025

Merged
merged 30 commits into from
Oct 8, 2024
Merged

feat!: protocol contracts #9025

merged 30 commits into from
Oct 8, 2024

Conversation

LeilaWang
Copy link
Contributor

@LeilaWang LeilaWang commented Oct 4, 2024

  • Fixed protocol contract addresses: currently from 1 - 6.
  • No need to deploy protocol contracts anymore. The artifacts are added to archiver and pxe by default.
  • Update the protocolContractTreeRoot in the L1 contract to "upgrade" protocol contracts. The root can be generate by calling yarn generate in yarn-project/protocol-contracts.
  • We still need to call initialize on FeeJuiceContract to set the portal contract address. We can hard code the address in FeeJuiceContract and skip the public data read when it's not going to change.

@LeilaWang LeilaWang added the e2e-all CI: Enables this CI job. label Oct 4, 2024
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Changes to public function bytecode sizes

Generated at commit: 1440ab6ee02184a0abf1e50cde2300c4c3bbd714, compared to commit: f8267f292b9aabfa29e3e056cb42f56d5ad0f163

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
TokenBlacklist::public_dispatch -37 ✅ -0.03%
Token::public_dispatch -37 ✅ -0.06%
NFT::public_dispatch -37 ✅ -0.09%
Uniswap::public_dispatch -37 ✅ -0.11%
TokenBlacklist::transfer_public -32 ✅ -0.21%
Uniswap::swap_public -37 ✅ -0.24%
TokenBlacklist::burn_public -32 ✅ -0.31%
TokenBlacklist::shield -37 ✅ -0.31%
Token::transfer_public -32 ✅ -0.33%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 -37 ✅ -0.39%
Token::shield -37 ✅ -0.41%
Token::burn_public -32 ✅ -0.44%
NFT::transfer_in_public -32 ✅ -0.57%
AuthWitTest::public_dispatch -32 ✅ -1.43%
AuthWitTest::consume_public -32 ✅ -3.52%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
TokenBlacklist::public_dispatch 130,896 (-37) -0.03%
Token::public_dispatch 67,185 (-37) -0.06%
NFT::public_dispatch 39,933 (-37) -0.09%
Uniswap::public_dispatch 33,488 (-37) -0.11%
TokenBlacklist::transfer_public 15,568 (-32) -0.21%
Uniswap::swap_public 15,322 (-37) -0.24%
TokenBlacklist::burn_public 10,283 (-32) -0.31%
TokenBlacklist::shield 11,847 (-37) -0.31%
Token::transfer_public 9,734 (-32) -0.33%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 9,393 (-37) -0.39%
Token::shield 8,883 (-37) -0.41%
Token::burn_public 7,319 (-32) -0.44%
NFT::transfer_in_public 5,565 (-32) -0.57%
AuthWitTest::public_dispatch 2,201 (-32) -1.43%
AuthWitTest::consume_public 878 (-32) -3.52%

Copy link
Contributor

github-actions bot commented Oct 4, 2024

Changes to circuit sizes

Generated at commit: 1440ab6ee02184a0abf1e50cde2300c4c3bbd714, compared to commit: f8267f292b9aabfa29e3e056cb42f56d5ad0f163

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_init +110 ❌ +0.44% +431 ❌ +1.35%
private_kernel_inner +110 ❌ +0.25% +432 ❌ +0.83%
rollup_block_root_empty +1 ❌ +0.80% +1 ❌ +0.03%
private_kernel_empty +1 ❌ +0.15% +1 ❌ +0.03%
private_kernel_tail +2 ❌ +0.04% +1 ❌ +0.01%
rollup_merge +2 ❌ +0.05% +165 ❌ +0.01%
rollup_block_root +2 ❌ +0.05% +165 ❌ +0.01%
private_kernel_reset_4_4_4_4_4_4_4_4_1 +2 ❌ +0.01% +3 ❌ +0.00%
private_kernel_tail_to_public +2 ❌ +0.01% +1 ❌ +0.00%
rollup_root +2 ❌ +0.00% +13 ❌ +0.00%
rollup_block_merge +2 ❌ +0.00% +13 ❌ +0.00%
public_kernel_merge +2 ❌ +0.00% +7 ❌ +0.00%
public_kernel_inner +3 ❌ +0.00% +3 ❌ +0.00%
private_kernel_reset +2 ❌ +0.00% +2 ❌ +0.00%
public_kernel_tail +2 ❌ +0.00% +7 ❌ +0.00%
rollup_base +1 ❌ +0.00% +6 ❌ +0.00%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_init 25,003 (+110) +0.44% 32,266 (+431) +1.35%
private_kernel_inner 44,042 (+110) +0.25% 52,337 (+432) +0.83%
rollup_block_root_empty 126 (+1) +0.80% 2,908 (+1) +0.03%
private_kernel_empty 671 (+1) +0.15% 3,469 (+1) +0.03%
private_kernel_tail 4,744 (+2) +0.04% 9,024 (+1) +0.01%
rollup_merge 3,673 (+2) +0.05% 1,896,232 (+165) +0.01%
rollup_block_root 4,188 (+2) +0.05% 2,837,317 (+165) +0.01%
private_kernel_reset_4_4_4_4_4_4_4_4_1 34,897 (+2) +0.01% 74,462 (+3) +0.00%
private_kernel_tail_to_public 29,828 (+2) +0.01% 39,493 (+1) +0.00%
rollup_root 41,521 (+2) +0.00% 1,983,353 (+13) +0.00%
rollup_block_merge 41,537 (+2) +0.00% 1,983,369 (+13) +0.00%
public_kernel_merge 53,490 (+2) +0.00% 1,103,546 (+7) +0.00%
public_kernel_inner 268,759 (+3) +0.00% 516,564 (+3) +0.00%
private_kernel_reset 91,933 (+2) +0.00% 467,713 (+2) +0.00%
public_kernel_tail 258,424 (+2) +0.00% 2,270,246 (+7) +0.00%
rollup_base 671,888 (+1) +0.00% 3,525,980 (+6) +0.00%

Copy link
Contributor

@MirandaWood MirandaWood left a comment

Choose a reason for hiding this comment

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

🚀

@@ -285,15 +288,15 @@ global VM_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = COMBINED_CONSTANT_DATA_LENGTH + PU

global KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH: u32 = ROLLUP_VALIDATION_REQUESTS_LENGTH + COMBINED_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH + PARTIAL_STATE_REFERENCE_LENGTH + 1 + AZTEC_ADDRESS_LENGTH;

global CONSTANT_ROLLUP_DATA_LENGTH: u32 = APPEND_ONLY_TREE_SNAPSHOT_LENGTH + 1 + GLOBAL_VARIABLES_LENGTH;
global CONSTANT_ROLLUP_DATA_LENGTH: u32 = APPEND_ONLY_TREE_SNAPSHOT_LENGTH + 1 + 1 + GLOBAL_VARIABLES_LENGTH;
Copy link
Contributor

Choose a reason for hiding this comment

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

Small thing - could we add a comment like +1 for vk tree root, +1 for protocol tree root? I find those helpful when changing constants


// + 5 for rollup_type, height_in_block_tree, txs_effects_hash, out_hash, accumulated_fees
global BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH: u32 = CONSTANT_ROLLUP_DATA_LENGTH + PARTIAL_STATE_REFERENCE_LENGTH + PARTIAL_STATE_REFERENCE_LENGTH + 5;
// + 64 for 32 * FeeRecipient { recipient, value }, + 4 for previous_block_hash, end_block_hash, out_hash, vk_tree_root + 1 temporarily for prover_id
global BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH: u32 = 2 * APPEND_ONLY_TREE_SNAPSHOT_LENGTH + 2 * GLOBAL_VARIABLES_LENGTH + 69;
global BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH: u32 = 2 * APPEND_ONLY_TREE_SNAPSHOT_LENGTH + 2 * GLOBAL_VARIABLES_LENGTH + 70;
Copy link
Contributor

Choose a reason for hiding this comment

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

As above for here (update comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!!!

@LeilaWang LeilaWang merged commit f3bcff0 into master Oct 8, 2024
93 checks passed
@LeilaWang LeilaWang deleted the lw/precompile branch October 8, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-all CI: Enables this CI job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants