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!: Brillig with a stack and conditional inlining #8989

Merged
merged 43 commits into from
Oct 10, 2024

Conversation

sirasistant
Copy link
Contributor

@sirasistant sirasistant commented Oct 3, 2024

Adds a stack to brillig by using relative addressing. Also adds conditional inlining based on a heuristic on function size and callsite size. This should succesfully deduplicate any large shared function in the program that is not monomorphized.

@sirasistant sirasistant changed the title feat: Brillig with a stack and conditional inlining (WIP) feat: Brillig with a stack and conditional inlining [WIP] Oct 3, 2024
@sirasistant sirasistant marked this pull request as ready for review October 3, 2024 10:51
@sirasistant
Copy link
Contributor Author

Just taking out of draft to get some size metrics

Copy link
Contributor

github-actions bot commented Oct 3, 2024

Changes to public function bytecode sizes

Generated at commit: 4cdd2812d9fddc9ac724d3dec027c8f2f79da2c4, compared to commit: f4754f7ea9587edbe8367c49539f65d25e251e23

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AvmTest::elliptic_curve_add_and_double +522 ❌ +305.26%
AvmTest::assertion_failure +97 ❌ +115.48%
Child::set_value_with_two_nested_calls +621 ❌ +84.15%
AvmTest::get_fee_per_l2_gas +37 ❌ +53.62%
AvmTest::get_timestamp +37 ❌ +53.62%
AvmTest::get_sender +37 ❌ +53.62%
AvmTest::get_storage_address +37 ❌ +53.62%
AvmTest::get_version +37 ❌ +53.62%
AvmTest::get_fee_per_da_gas +37 ❌ +53.62%
AvmTest::get_da_gas_left +37 ❌ +53.62%
AvmTest::get_l2_gas_left +37 ❌ +53.62%
AvmTest::get_transaction_fee +37 ❌ +53.62%
AvmTest::get_address +37 ❌ +53.62%
AvmTest::get_chain_id +37 ❌ +53.62%
AvmTest::set_opcode_u8 +37 ❌ +53.62%
AvmTest::get_block_number +37 ❌ +53.62%
AvmTest::new_nullifier +37 ❌ +52.86%
AvmTest::new_note_hash +37 ❌ +52.86%
Test::emit_nullifier_public +37 ❌ +52.86%
AvmTest::set_opcode_u32 +37 ❌ +50.68%
AvmTest::nullifier_collision +37 ❌ +48.68%
AvmTest::set_opcode_u64 +37 ❌ +48.05%
DocsExample::spend_public_authwit +37 ❌ +46.84%
AvmTest::send_l2_to_l1_msg +37 ❌ +46.25%
Test::create_l2_to_l1_message_arbitrary_recipient_public +37 ❌ +46.25%
Test::dummy_public_call +37 ❌ +44.05%
AvmTest::set_opcode_small_field +37 ❌ +43.53%
AvmTest::add_args_return +37 ❌ +43.02%
AvmTest::modulo2 +37 ❌ +40.66%
AvmTest::assert_timestamp +37 ❌ +40.22%
AvmTest::nullifier_exists +37 ❌ +39.78%
AvmTest::note_hash_exists +37 ❌ +39.36%
AvmTest::l1_to_l2_msg_exists +37 ❌ +39.36%
AvmTest::assert_nullifier_exists +37 ❌ +37.76%
Test::is_time_equal +37 ❌ +37.76%
AvmTest::set_opcode_big_field +37 ❌ +36.63%
AvmTest::set_opcode_really_big_field +37 ❌ +36.63%
AvmTest::emit_nullifier_and_check +37 ❌ +35.58%
InclusionProofs::push_nullifier_public +37 ❌ +33.94%
AvmTest::assert_same +33 ❌ +32.67%
InclusionProofs::test_nullifier_inclusion_from_public +37 ❌ +28.03%
Child::pub_get_value +33 ❌ +26.83%
AvmTest::get_function_selector +37 ❌ +24.83%
AvmTest::check_selector +37 ❌ +22.56%
StaticChild::pub_get_value +33 ❌ +22.15%
AvmTest::add_u128 +33 ❌ +17.46%
Parent::pub_entry_point_twice +179 ❌ +17.06%
AvmTest::set_storage_single +37 ❌ +16.67%
Test::assert_public_global_vars +37 ❌ +16.30%
DelegatedOn::public_set_value +37 ❌ +16.23%
AvmTest::to_radix_le +37 ❌ +16.09%
AvmTest::set_storage_list +37 ❌ +15.23%
DocsExample::update_leader +37 ❌ +13.17%
Router::_check_block_number +144 ❌ +12.20%
Router::_check_timestamp +144 ❌ +12.03%
Child::pub_set_value +37 ❌ +11.78%
StaticChild::pub_set_value +37 ❌ +11.78%
AvmTest::return_oracle +37 ❌ +11.28%
FPC::pay_refund_with_shielded_rebate +169 ❌ +11.00%
NFT::_store_point_in_transient_storage +37 ❌ +10.98%
AvmTest::pedersen_commit +37 ❌ +10.57%
AvmTest::test_get_contract_instance_raw +37 ❌ +10.14%
DocsExample::get_shared_immutable_constrained_public_indirect +41 ❌ +9.74%
TokenBlacklist::_reduce_total_supply +80 ❌ +9.13%
Token::_reduce_total_supply +80 ❌ +9.13%
AvmTest::assert_calldata_copy +37 ❌ +8.67%
Lending::init +234 ❌ +8.50%
AvmTest::read_storage_single +37 ❌ +8.41%
AvmTest::variable_base_msm +37 ❌ +8.37%
AvmTest::keccak_f1600 +37 ❌ +7.96%
Uniswap::_assert_token_is_same +37 ❌ +7.94%
AvmInitializerTest::read_storage_immutable +37 ❌ +7.72%
Child::public_dispatch +413 ❌ +7.52%
NFT::public_get_symbol +37 ❌ +7.40%
TokenBridge::get_token +37 ❌ +7.40%
Token::get_admin +37 ❌ +7.40%
NFT::get_admin +37 ❌ +7.33%
NFT::public_get_name +37 ❌ +7.33%
Token::public_get_name +37 ❌ +7.33%
Token::public_get_symbol +37 ❌ +7.33%
TokenBridge::_assert_token_is_same +37 ❌ +7.16%
Token::public_get_decimals +37 ❌ +7.12%
AvmTest::elliptic_curve_add +37 ❌ +7.10%
DocsExample::get_shared_immutable_constrained_public +37 ❌ +7.09%
TokenBridge::get_portal_address_public +37 ❌ +6.89%
FPC::pay_refund +112 ❌ +6.74%
AvmTest::set_read_storage_single +37 ❌ +6.28%
TokenBlacklist::total_supply +37 ❌ +6.15%
Token::total_supply +37 ❌ +6.15%
EasyPrivateVoting::end_vote +37 ❌ +5.80%
NFT::set_admin +37 ❌ +5.79%
Token::set_admin +37 ❌ +5.79%
AvmTest::nested_static_call_to_set_storage +37 ❌ +5.47%
Child::pub_inc_value +37 ❌ +5.47%
ImportTest::pub_call_public_fn +37 ❌ +5.47%
StaticChild::pub_inc_value +37 ❌ +5.47%
AvmTest::create_same_nullifier_in_nested_call +37 ❌ +5.41%
AvmTest::create_different_nullifier_in_nested_call +37 ❌ +5.32%
AvmTest::read_storage_list +33 ❌ +5.31%
StaticChild::pub_illegal_inc_value +37 ❌ +5.30%
Child::pub_inc_value_internal +37 ❌ +5.26%
AvmTest::u128_from_integer_overflow +37 ❌ +5.12%
DocsExample::initialize_public_immutable +37 ❌ +4.71%
DocsExample::initialize_shared_immutable +37 ❌ +4.71%
StaticParent::public_get_value_from_child +33 ❌ +4.65%
DocsExample::get_shared_immutable_constrained_public_multiple +33 ❌ +4.61%
Parent::pub_entry_point +33 ❌ +4.60%
StaticParent::public_call +33 ❌ +4.60%
AvmTest::test_get_contract_instance +37 ❌ +4.40%
AuthWitTest::consume_public +37 ❌ +4.21%
Delegator::public_delegate_set_value +37 ❌ +4.21%
Child::set_value_twice_with_nested_first +37 ❌ +4.02%
Child::set_value_twice_with_nested_last +37 ❌ +4.02%
AvmTest::nested_call_to_add_with_gas +33 ❌ +3.94%
AvmTest::nested_call_to_add +33 ❌ +3.82%
AvmTest::nested_call_to_assert_same +33 ❌ +3.82%
AvmTest::nested_static_call_to_add +33 ❌ +3.82%
Test::create_l2_to_l1_message_public +85 ❌ +3.65%
AvmTest::get_args_hash +55 ❌ +3.38%
Parent::public_static_call +33 ❌ +3.36%
StaticParent::public_static_call +33 ❌ +3.36%
TokenBridge::_call_mint_on_token +37 ❌ +2.96%
DelegatedOn::public_dispatch +37 ❌ +2.95%
Crowdfunding::_publish_donation_receipts +37 ❌ +2.91%
AvmTest::debug_logging +37 ❌ +2.78%
AvmTest::pedersen_hash +81 ❌ +2.38%
AvmTest::pedersen_hash_with_index +81 ❌ +2.38%
Delegator::public_dispatch +48 ❌ +2.37%
AvmTest::poseidon2_hash +37 ❌ +2.37%
Test::emit_unencrypted +37 ❌ +2.28%
ImportTest::public_dispatch +37 ❌ +2.14%
Uniswap::swap_public +290 ❌ +1.89%
FeeJuice::check_balance +41 ❌ +1.88%
AvmTest::emit_unencrypted_log +37 ❌ +1.26%
AvmTest::keccak_hash +33 ❌ +1.21%
AvmInitializerTest::constructor +14 ❌ +0.49%
AuthWitTest::public_dispatch +8 ❌ +0.36%
CardGame::on_cards_claimed +21 ❌ +0.28%
AvmInitializerTest::public_dispatch +10 ❌ +0.27%
StaticParent::public_nested_static_call -9 ✅ -0.66%
Lending::get_assets -6 ✅ -0.71%
Auth::get_authorized_delay -22 ✅ -1.00%
Lending::get_asset -25 ✅ -1.21%
NFT::set_minter -35 ✅ -1.74%
Token::set_minter -35 ✅ -1.74%
CardGame::on_game_joined -83 ✅ -1.74%
StatefulTest::increment_public_value -35 ✅ -1.77%
TokenBlacklist::balance_of_public -35 ✅ -1.79%
Token::balance_of_public -35 ✅ -1.79%
StatefulTest::increment_public_value_no_init_check -35 ✅ -1.80%
FeeJuice::balance_of_public -35 ✅ -1.83%
Benchmarking::broadcast -35 ✅ -1.87%
NFT::is_minter -35 ✅ -1.87%
Token::is_minter -35 ✅ -1.87%
PriceFeed::get_price -35 ✅ -1.89%
AuthRegistry::is_reject_all -35 ✅ -1.91%
StatefulTest::get_public_value -35 ✅ -1.92%
AvmTest::read_storage_map -35 ✅ -1.93%
PriceFeed::set_price -35 ✅ -1.93%
NFT::_finish_transfer_to_public -35 ✅ -1.97%
AuthRegistry::set_reject_all -35 ✅ -2.03%
Token::assert_minter_and_mint -56 ✅ -2.29%
FeeJuice::set_portal -32 ✅ -3.15%
NFT::finalize_transfer_to_private -209 ✅ -3.39%
Lending::_deposit -94 ✅ -3.78%
CardGame::on_card_played -232 ✅ -4.05%
Auth::get_authorized -105 ✅ -5.30%
Auth::get_scheduled_authorized -101 ✅ -5.38%
AvmTest::u128_addition_overflow -77 ✅ -5.67%
DocsExample::public_dispatch -346 ✅ -5.97%
Lending::repay_public -128 ✅ -6.89%
TestLog::public_dispatch -260 ✅ -7.53%
TokenBridge::exit_to_l1_public -717 ✅ -8.92%
Lending::deposit_public -185 ✅ -9.12%
CardGame::start_game -681 ✅ -9.35%
AvmTest::sha256_hash -388 ✅ -10.94%
Parent::public_nested_static_call -529 ✅ -11.76%
TestLog::emit_unencrypted_events -313 ✅ -14.69%
TokenBridge::constructor -676 ✅ -15.97%
PrivateFPC::public_dispatch -847 ✅ -16.15%
PrivateFPC::constructor -684 ✅ -16.71%
StatefulTest::public_constructor -804 ✅ -17.64%
AvmTest::bulk_testing -5,654 ✅ -17.69%
StaticChild::public_dispatch -657 ✅ -17.86%
Auth::constructor -758 ✅ -18.11%
FPC::constructor -758 ✅ -18.21%
Uniswap::constructor -758 ✅ -18.21%
Test::consume_message_from_arbitrary_sender_public -1,607 ✅ -18.64%
FPC::public_dispatch -2,191 ✅ -18.69%
EasyPrivateVoting::constructor -864 ✅ -19.46%
Claim::public_dispatch -1,132 ✅ -19.84%
Crowdfunding::public_dispatch -1,673 ✅ -20.41%
InclusionProofs::public_dispatch -1,164 ✅ -20.63%
Token::mint_private -912 ✅ -20.86%
Spam::public_dispatch -956 ✅ -20.98%
Benchmarking::increment_balance -842 ✅ -21.17%
StaticParent::public_dispatch -1,646 ✅ -21.17%
NFT::owner_of -696 ✅ -21.30%
Claim::constructor -974 ✅ -21.38%
TokenBlacklist::_increase_public_balance -729 ✅ -21.63%
Token::_increase_public_balance -729 ✅ -21.63%
TokenBlacklist::get_roles -723 ✅ -21.67%
InclusionProofs::constructor -824 ✅ -21.89%
Parent::public_dispatch -2,538 ✅ -22.51%
PriceFeed::public_dispatch -1,120 ✅ -22.72%
Spam::public_spam -793 ✅ -23.39%
Router::public_dispatch -905 ✅ -23.52%
Crowdfunding::init -1,241 ✅ -24.20%
Uniswap::public_dispatch -8,332 ✅ -24.89%
TokenBlacklist::mint_private -1,524 ✅ -26.06%
Benchmarking::public_dispatch -1,910 ✅ -27.23%
TokenBridge::claim_public -4,084 ✅ -27.60%
FeeJuice::_increase_public_balance -927 ✅ -27.79%
EasyPrivateVoting::add_to_tally_public -1,022 ✅ -30.30%
Token::constructor -2,383 ✅ -30.41%
NFT::constructor -2,256 ✅ -30.71%
Test::consume_mint_public_message -4,108 ✅ -30.75%
EasyPrivateVoting::public_dispatch -2,827 ✅ -30.76%
NFT::transfer_in_public -1,743 ✅ -31.35%
Token::complete_refund -1,513 ✅ -31.85%
AppSubscription::public_dispatch -2,634 ✅ -32.76%
AppSubscription::constructor -2,024 ✅ -33.34%
Token::burn_public -2,493 ✅ -34.09%
Lending::get_position -2,635 ✅ -34.69%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 -3,263 ✅ -34.76%
TokenBridge::public_dispatch -11,194 ✅ -34.78%
AuthRegistry::is_consumable -1,064 ✅ -35.06%
AvmTest::set_storage_map -994 ✅ -35.53%
AuthRegistry::_set_authorized -1,064 ✅ -36.09%
StatefulTest::public_dispatch -4,536 ✅ -36.26%
AuthRegistry::set_authorized -1,064 ✅ -36.43%
Token::mint_public -1,910 ✅ -36.48%
Token::shield -3,288 ✅ -37.04%
AvmTest::public_dispatch -34,899 ✅ -37.30%
FeeJuice::public_dispatch -3,820 ✅ -38.73%
Lending::_withdraw -5,406 ✅ -40.53%
Lending::_repay -3,884 ✅ -41.50%
TokenBlacklist::burn_public -4,298 ✅ -41.82%
Auth::set_authorized_delay -4,151 ✅ -41.98%
CardGame::public_dispatch -11,725 ✅ -42.14%
Auth::set_authorized -4,259 ✅ -42.23%
Test::public_dispatch -13,845 ✅ -42.25%
NFT::public_dispatch -16,879 ✅ -42.34%
TokenBlacklist::shield -5,088 ✅ -42.97%
TokenBlacklist::constructor -6,553 ✅ -44.44%
NFT::mint -2,794 ✅ -47.16%
Lending::_borrow -7,455 ✅ -48.64%
TokenBlacklist::update_roles -7,144 ✅ -49.03%
Token::transfer_public -4,797 ✅ -49.31%
AvmTest::add_storage_map -2,081 ✅ -49.51%
TokenBlacklist::mint_public -5,164 ✅ -53.89%
Token::public_dispatch -37,691 ✅ -56.19%
Lending::update_accumulator -7,304 ✅ -57.14%
TokenBlacklist::transfer_public -9,156 ✅ -58.84%
AuthRegistry::consume -5,173 ✅ -62.78%
Auth::public_dispatch -18,786 ✅ -63.01%
AuthRegistry::public_dispatch -14,928 ✅ -64.32%
Lending::public_dispatch -50,858 ✅ -65.01%
TokenBlacklist::public_dispatch -104,637 ✅ -79.98%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AvmTest::elliptic_curve_add_and_double 693 (+522) +305.26%
AvmTest::assertion_failure 181 (+97) +115.48%
Child::set_value_with_two_nested_calls 1,359 (+621) +84.15%
AvmTest::get_fee_per_l2_gas 106 (+37) +53.62%
AvmTest::get_timestamp 106 (+37) +53.62%
AvmTest::get_sender 106 (+37) +53.62%
AvmTest::get_storage_address 106 (+37) +53.62%
AvmTest::get_version 106 (+37) +53.62%
AvmTest::get_fee_per_da_gas 106 (+37) +53.62%
AvmTest::get_da_gas_left 106 (+37) +53.62%
AvmTest::get_l2_gas_left 106 (+37) +53.62%
AvmTest::get_transaction_fee 106 (+37) +53.62%
AvmTest::get_address 106 (+37) +53.62%
AvmTest::get_chain_id 106 (+37) +53.62%
AvmTest::set_opcode_u8 106 (+37) +53.62%
AvmTest::get_block_number 106 (+37) +53.62%
AvmTest::new_nullifier 107 (+37) +52.86%
AvmTest::new_note_hash 107 (+37) +52.86%
Test::emit_nullifier_public 107 (+37) +52.86%
AvmTest::set_opcode_u32 110 (+37) +50.68%
AvmTest::nullifier_collision 113 (+37) +48.68%
AvmTest::set_opcode_u64 114 (+37) +48.05%
DocsExample::spend_public_authwit 116 (+37) +46.84%
AvmTest::send_l2_to_l1_msg 117 (+37) +46.25%
Test::create_l2_to_l1_message_arbitrary_recipient_public 117 (+37) +46.25%
Test::dummy_public_call 121 (+37) +44.05%
AvmTest::set_opcode_small_field 122 (+37) +43.53%
AvmTest::add_args_return 123 (+37) +43.02%
AvmTest::modulo2 128 (+37) +40.66%
AvmTest::assert_timestamp 129 (+37) +40.22%
AvmTest::nullifier_exists 130 (+37) +39.78%
AvmTest::note_hash_exists 131 (+37) +39.36%
AvmTest::l1_to_l2_msg_exists 131 (+37) +39.36%
AvmTest::assert_nullifier_exists 135 (+37) +37.76%
Test::is_time_equal 135 (+37) +37.76%
AvmTest::set_opcode_big_field 138 (+37) +36.63%
AvmTest::set_opcode_really_big_field 138 (+37) +36.63%
AvmTest::emit_nullifier_and_check 141 (+37) +35.58%
InclusionProofs::push_nullifier_public 146 (+37) +33.94%
AvmTest::assert_same 134 (+33) +32.67%
InclusionProofs::test_nullifier_inclusion_from_public 169 (+37) +28.03%
Child::pub_get_value 156 (+33) +26.83%
AvmTest::get_function_selector 186 (+37) +24.83%
AvmTest::check_selector 201 (+37) +22.56%
StaticChild::pub_get_value 182 (+33) +22.15%
AvmTest::add_u128 222 (+33) +17.46%
Parent::pub_entry_point_twice 1,228 (+179) +17.06%
AvmTest::set_storage_single 259 (+37) +16.67%
Test::assert_public_global_vars 264 (+37) +16.30%
DelegatedOn::public_set_value 265 (+37) +16.23%
AvmTest::to_radix_le 267 (+37) +16.09%
AvmTest::set_storage_list 280 (+37) +15.23%
DocsExample::update_leader 318 (+37) +13.17%
Router::_check_block_number 1,324 (+144) +12.20%
Router::_check_timestamp 1,341 (+144) +12.03%
Child::pub_set_value 351 (+37) +11.78%
StaticChild::pub_set_value 351 (+37) +11.78%
AvmTest::return_oracle 365 (+37) +11.28%
FPC::pay_refund_with_shielded_rebate 1,705 (+169) +11.00%
NFT::_store_point_in_transient_storage 374 (+37) +10.98%
AvmTest::pedersen_commit 387 (+37) +10.57%
AvmTest::test_get_contract_instance_raw 402 (+37) +10.14%
DocsExample::get_shared_immutable_constrained_public_indirect 462 (+41) +9.74%
TokenBlacklist::_reduce_total_supply 956 (+80) +9.13%
Token::_reduce_total_supply 956 (+80) +9.13%
AvmTest::assert_calldata_copy 464 (+37) +8.67%
Lending::init 2,988 (+234) +8.50%
AvmTest::read_storage_single 477 (+37) +8.41%
AvmTest::variable_base_msm 479 (+37) +8.37%
AvmTest::keccak_f1600 502 (+37) +7.96%
Uniswap::_assert_token_is_same 503 (+37) +7.94%
AvmInitializerTest::read_storage_immutable 516 (+37) +7.72%
Child::public_dispatch 5,907 (+413) +7.52%
NFT::public_get_symbol 537 (+37) +7.40%
TokenBridge::get_token 537 (+37) +7.40%
Token::get_admin 537 (+37) +7.40%
NFT::get_admin 542 (+37) +7.33%
NFT::public_get_name 542 (+37) +7.33%
Token::public_get_name 542 (+37) +7.33%
Token::public_get_symbol 542 (+37) +7.33%
TokenBridge::_assert_token_is_same 554 (+37) +7.16%
Token::public_get_decimals 557 (+37) +7.12%
AvmTest::elliptic_curve_add 558 (+37) +7.10%
DocsExample::get_shared_immutable_constrained_public 559 (+37) +7.09%
TokenBridge::get_portal_address_public 574 (+37) +6.89%
FPC::pay_refund 1,773 (+112) +6.74%
AvmTest::set_read_storage_single 626 (+37) +6.28%
TokenBlacklist::total_supply 639 (+37) +6.15%
Token::total_supply 639 (+37) +6.15%
EasyPrivateVoting::end_vote 675 (+37) +5.80%
NFT::set_admin 676 (+37) +5.79%
Token::set_admin 676 (+37) +5.79%
AvmTest::nested_static_call_to_set_storage 713 (+37) +5.47%
Child::pub_inc_value 714 (+37) +5.47%
ImportTest::pub_call_public_fn 714 (+37) +5.47%
StaticChild::pub_inc_value 714 (+37) +5.47%
AvmTest::create_same_nullifier_in_nested_call 721 (+37) +5.41%
AvmTest::create_different_nullifier_in_nested_call 732 (+37) +5.32%
AvmTest::read_storage_list 654 (+33) +5.31%
StaticChild::pub_illegal_inc_value 735 (+37) +5.30%
Child::pub_inc_value_internal 740 (+37) +5.26%
AvmTest::u128_from_integer_overflow 760 (+37) +5.12%
DocsExample::initialize_public_immutable 823 (+37) +4.71%
DocsExample::initialize_shared_immutable 823 (+37) +4.71%
StaticParent::public_get_value_from_child 742 (+33) +4.65%
DocsExample::get_shared_immutable_constrained_public_multiple 749 (+33) +4.61%
Parent::pub_entry_point 751 (+33) +4.60%
StaticParent::public_call 751 (+33) +4.60%
AvmTest::test_get_contract_instance 878 (+37) +4.40%
AuthWitTest::consume_public 915 (+37) +4.21%
Delegator::public_delegate_set_value 916 (+37) +4.21%
Child::set_value_twice_with_nested_first 957 (+37) +4.02%
Child::set_value_twice_with_nested_last 957 (+37) +4.02%
AvmTest::nested_call_to_add_with_gas 871 (+33) +3.94%
AvmTest::nested_call_to_add 896 (+33) +3.82%
AvmTest::nested_call_to_assert_same 896 (+33) +3.82%
AvmTest::nested_static_call_to_add 896 (+33) +3.82%
Test::create_l2_to_l1_message_public 2,415 (+85) +3.65%
AvmTest::get_args_hash 1,684 (+55) +3.38%
Parent::public_static_call 1,015 (+33) +3.36%
StaticParent::public_static_call 1,015 (+33) +3.36%
TokenBridge::_call_mint_on_token 1,286 (+37) +2.96%
DelegatedOn::public_dispatch 1,293 (+37) +2.95%
Crowdfunding::_publish_donation_receipts 1,307 (+37) +2.91%
AvmTest::debug_logging 1,368 (+37) +2.78%
AvmTest::pedersen_hash 3,482 (+81) +2.38%
AvmTest::pedersen_hash_with_index 3,482 (+81) +2.38%
Delegator::public_dispatch 2,073 (+48) +2.37%
AvmTest::poseidon2_hash 1,600 (+37) +2.37%
Test::emit_unencrypted 1,660 (+37) +2.28%
ImportTest::public_dispatch 1,769 (+37) +2.14%
Uniswap::swap_public 15,606 (+290) +1.89%
FeeJuice::check_balance 2,217 (+41) +1.88%
AvmTest::emit_unencrypted_log 2,964 (+37) +1.26%
AvmTest::keccak_hash 2,752 (+33) +1.21%
AvmInitializerTest::constructor 2,891 (+14) +0.49%
AuthWitTest::public_dispatch 2,209 (+8) +0.36%
CardGame::on_cards_claimed 7,493 (+21) +0.28%
AvmInitializerTest::public_dispatch 3,681 (+10) +0.27%
StaticParent::public_nested_static_call 1,365 (-9) -0.66%
Lending::get_assets 838 (-6) -0.71%
Auth::get_authorized_delay 2,183 (-22) -1.00%
Lending::get_asset 2,039 (-25) -1.21%
NFT::set_minter 1,975 (-35) -1.74%
Token::set_minter 1,975 (-35) -1.74%
CardGame::on_game_joined 4,681 (-83) -1.74%
StatefulTest::increment_public_value 1,943 (-35) -1.77%
TokenBlacklist::balance_of_public 1,921 (-35) -1.79%
Token::balance_of_public 1,921 (-35) -1.79%
StatefulTest::increment_public_value_no_init_check 1,909 (-35) -1.80%
FeeJuice::balance_of_public 1,882 (-35) -1.83%
Benchmarking::broadcast 1,840 (-35) -1.87%
NFT::is_minter 1,839 (-35) -1.87%
Token::is_minter 1,839 (-35) -1.87%
PriceFeed::get_price 1,821 (-35) -1.89%
AuthRegistry::is_reject_all 1,800 (-35) -1.91%
StatefulTest::get_public_value 1,790 (-35) -1.92%
AvmTest::read_storage_map 1,779 (-35) -1.93%
PriceFeed::set_price 1,775 (-35) -1.93%
NFT::_finish_transfer_to_public 1,740 (-35) -1.97%
AuthRegistry::set_reject_all 1,691 (-35) -2.03%
Token::assert_minter_and_mint 2,388 (-56) -2.29%
FeeJuice::set_portal 985 (-32) -3.15%
NFT::finalize_transfer_to_private 5,957 (-209) -3.39%
Lending::_deposit 2,394 (-94) -3.78%
CardGame::on_card_played 5,491 (-232) -4.05%
Auth::get_authorized 1,875 (-105) -5.30%
Auth::get_scheduled_authorized 1,778 (-101) -5.38%
AvmTest::u128_addition_overflow 1,280 (-77) -5.67%
DocsExample::public_dispatch 5,454 (-346) -5.97%
Lending::repay_public 1,730 (-128) -6.89%
TestLog::public_dispatch 3,195 (-260) -7.53%
TokenBridge::exit_to_l1_public 7,318 (-717) -8.92%
Lending::deposit_public 1,843 (-185) -9.12%
CardGame::start_game 6,601 (-681) -9.35%
AvmTest::sha256_hash 3,158 (-388) -10.94%
Parent::public_nested_static_call 3,971 (-529) -11.76%
TestLog::emit_unencrypted_events 1,817 (-313) -14.69%
TokenBridge::constructor 3,556 (-676) -15.97%
PrivateFPC::public_dispatch 4,397 (-847) -16.15%
PrivateFPC::constructor 3,410 (-684) -16.71%
StatefulTest::public_constructor 3,754 (-804) -17.64%
AvmTest::bulk_testing 26,310 (-5,654) -17.69%
StaticChild::public_dispatch 3,022 (-657) -17.86%
Auth::constructor 3,427 (-758) -18.11%
FPC::constructor 3,405 (-758) -18.21%
Uniswap::constructor 3,405 (-758) -18.21%
Test::consume_message_from_arbitrary_sender_public 7,014 (-1,607) -18.64%
FPC::public_dispatch 9,529 (-2,191) -18.69%
EasyPrivateVoting::constructor 3,576 (-864) -19.46%
Claim::public_dispatch 4,573 (-1,132) -19.84%
Crowdfunding::public_dispatch 6,522 (-1,673) -20.41%
InclusionProofs::public_dispatch 4,479 (-1,164) -20.63%
Token::mint_private 3,461 (-912) -20.86%
Spam::public_dispatch 3,600 (-956) -20.98%
Benchmarking::increment_balance 3,136 (-842) -21.17%
StaticParent::public_dispatch 6,128 (-1,646) -21.17%
NFT::owner_of 2,571 (-696) -21.30%
Claim::constructor 3,581 (-974) -21.38%
TokenBlacklist::_increase_public_balance 2,641 (-729) -21.63%
Token::_increase_public_balance 2,641 (-729) -21.63%
TokenBlacklist::get_roles 2,613 (-723) -21.67%
InclusionProofs::constructor 2,941 (-824) -21.89%
Parent::public_dispatch 8,738 (-2,538) -22.51%
PriceFeed::public_dispatch 3,809 (-1,120) -22.72%
Spam::public_spam 2,597 (-793) -23.39%
Router::public_dispatch 2,942 (-905) -23.52%
Crowdfunding::init 3,888 (-1,241) -24.20%
Uniswap::public_dispatch 25,138 (-8,332) -24.89%
TokenBlacklist::mint_private 4,325 (-1,524) -26.06%
Benchmarking::public_dispatch 5,105 (-1,910) -27.23%
TokenBridge::claim_public 10,712 (-4,084) -27.60%
FeeJuice::_increase_public_balance 2,409 (-927) -27.79%
EasyPrivateVoting::add_to_tally_public 2,351 (-1,022) -30.30%
Token::constructor 5,452 (-2,383) -30.41%
NFT::constructor 5,090 (-2,256) -30.71%
Test::consume_mint_public_message 9,253 (-4,108) -30.75%
EasyPrivateVoting::public_dispatch 6,363 (-2,827) -30.76%
NFT::transfer_in_public 3,816 (-1,743) -31.35%
Token::complete_refund 3,237 (-1,513) -31.85%
AppSubscription::public_dispatch 5,406 (-2,634) -32.76%
AppSubscription::constructor 4,047 (-2,024) -33.34%
Token::burn_public 4,820 (-2,493) -34.09%
Lending::get_position 4,961 (-2,635) -34.69%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 6,124 (-3,263) -34.76%
TokenBridge::public_dispatch 20,992 (-11,194) -34.78%
AuthRegistry::is_consumable 1,971 (-1,064) -35.06%
AvmTest::set_storage_map 1,804 (-994) -35.53%
AuthRegistry::_set_authorized 1,884 (-1,064) -36.09%
StatefulTest::public_dispatch 7,974 (-4,536) -36.26%
AuthRegistry::set_authorized 1,857 (-1,064) -36.43%
Token::mint_public 3,326 (-1,910) -36.48%
Token::shield 5,589 (-3,288) -37.04%
AvmTest::public_dispatch 58,672 (-34,899) -37.30%
FeeJuice::public_dispatch 6,043 (-3,820) -38.73%
Lending::_withdraw 7,933 (-5,406) -40.53%
Lending::_repay 5,474 (-3,884) -41.50%
TokenBlacklist::burn_public 5,979 (-4,298) -41.82%
Auth::set_authorized_delay 5,738 (-4,151) -41.98%
CardGame::public_dispatch 16,097 (-11,725) -42.14%
Auth::set_authorized 5,826 (-4,259) -42.23%
Test::public_dispatch 18,925 (-13,845) -42.25%
NFT::public_dispatch 22,982 (-16,879) -42.34%
TokenBlacklist::shield 6,753 (-5,088) -42.97%
TokenBlacklist::constructor 8,192 (-6,553) -44.44%
NFT::mint 3,131 (-2,794) -47.16%
Lending::_borrow 7,871 (-7,455) -48.64%
TokenBlacklist::update_roles 7,426 (-7,144) -49.03%
Token::transfer_public 4,931 (-4,797) -49.31%
AvmTest::add_storage_map 2,122 (-2,081) -49.51%
TokenBlacklist::mint_public 4,418 (-5,164) -53.89%
Token::public_dispatch 29,386 (-37,691) -56.19%
Lending::update_accumulator 5,479 (-7,304) -57.14%
TokenBlacklist::transfer_public 6,406 (-9,156) -58.84%
AuthRegistry::consume 3,067 (-5,173) -62.78%
Auth::public_dispatch 11,029 (-18,786) -63.01%
AuthRegistry::public_dispatch 8,281 (-14,928) -64.32%
Lending::public_dispatch 27,371 (-50,858) -65.01%
TokenBlacklist::public_dispatch 26,193 (-104,637) -79.98%

Copy link
Contributor

github-actions bot commented Oct 3, 2024

Changes to circuit sizes

Generated at commit: 4cdd2812d9fddc9ac724d3dec027c8f2f79da2c4, compared to commit: f4754f7ea9587edbe8367c49539f65d25e251e23

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_tail -96 ✅ -2.02% -20 ✅ -0.22%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
private_kernel_tail 4,648 (-96) -2.02% 9,021 (-20) -0.22%

@sirasistant
Copy link
Contributor Author

Will fix transpiler now

Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

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

Looks good on the Noir/Brillig side of things. Some minor nits, but nothing blocking and they can all be addressed in follow-ups.

avm-transpiler/src/instructions.rs Outdated Show resolved Hide resolved
noir/noir-repo/acvm-repo/brillig_vm/src/lib.rs Outdated Show resolved Hide resolved
noir/noir-repo/acvm-repo/brillig_vm/src/lib.rs Outdated Show resolved Hide resolved
@TomAFrench
Copy link
Member

TomAFrench commented Oct 10, 2024

Is there an ETA on when the AVM team is going to be ready for this PR to be merged? I'm fine with it sitting for a while but I just want to make sure I've got the other serialisation change PRs ready to go at the same time.

@sirasistant
Copy link
Contributor Author

@jeanmon is just testing e2e the impl

@sirasistant sirasistant enabled auto-merge (squash) October 10, 2024 17:51
@fcarreiro fcarreiro changed the title feat!: Brillig with a stack and conditional inlining [WIP] feat!: Brillig with a stack and conditional inlining Oct 10, 2024
@ludamad ludamad disabled auto-merge October 10, 2024 19:19
@ludamad ludamad merged commit 409b7b8 into master Oct 10, 2024
8 checks passed
@ludamad ludamad deleted the arv/stack_implementation branch October 10, 2024 19:19
TomAFrench added a commit that referenced this pull request Oct 10, 2024
* master: (155 commits)
  fix(ci): don't report for now on kind-network-test (#9163)
  chore(ci): disable gossip_network.test.ts (#9165)
  chore: script for deploying the spartan network (#9167)
  feat!: Brillig with a stack and conditional inlining (#8989)
  fix: spartan account pre-funding (#9161)
  chore: reenable sync test (#9160)
  feat: Browser tests for UltraHonk (#9047)
  feat: make index in inbox global (#9110)
  feat: add sequencer address to metrics (#9145)
  feat: add validator address to logs (#9143)
  refactor(avm): type aliasing for VmPublicInputs (#8884)
  feat: drop epoch duration / block times (#9149)
  feat: stable deployments for spartan (#9147)
  fix: e2e-p2p attestation timeout (#9154)
  feat!: unrevert "feat: new per-enqueued-call gas limit" (#9140)
  feat: better tracing/metrics in validator and archiver (#9108)
  chore: revert deletion of the old bbup (#9146)
  chore(docs): rewriting bbup script, refactoring bb readme for clarity (#9073)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  ...
TomAFrench added a commit that referenced this pull request Oct 11, 2024
This PR removes the keccak256 opcode as we never emit this now,
preferring keccakf1600. As we have #8989 making a breaking change to
serialisation, this is a good time to do this to avoid an extra
serialisation change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bench-all CI: Enables this CI job. e2e-all CI: Enables this CI job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants