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: Add support for unlimited width in ACIR #8960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guipublic
Copy link
Contributor

Handle ACIR AssertZero opcodes of any width, by creating intermediate quad gates using w4_omega.
'fixes' noir-lang/noir#6085, but we still need to have Noir using the unlimited width.

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Changes to public function bytecode sizes

Generated at commit: 1b4833315edd071a15170528f31cdbacd8034fef, compared to commit: 797d0ca4abb396b6325a8159ca3be248c16c6b97

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AvmTest::pedersen_commit +1,115 ❌ +318.57%
Auth::get_scheduled_authorized +773 ❌ +40.83%
AvmTest::nested_call_to_add_with_gas +140 ❌ +38.57%
Auth::get_authorized +768 ❌ +38.52%
Auth::get_authorized_delay +808 ❌ +36.41%
StaticParent::public_get_value_from_child +112 ❌ +31.20%
AvmTest::nested_call_to_add +112 ❌ +29.95%
AvmTest::nested_static_call_to_add +112 ❌ +29.95%
DocsExample::get_shared_immutable_constrained_public_indirect +112 ❌ +27.52%
Parent::pub_entry_point_twice +140 ❌ +25.83%
TokenBlacklist::get_roles +863 ❌ +25.74%
Uniswap::_assert_token_is_same +112 ❌ +25.23%
Parent::pub_entry_point +70 ❌ +19.02%
StaticParent::public_call +70 ❌ +19.02%
Auth::set_authorized_delay +1,770 ❌ +17.85%
Auth::set_authorized +1,770 ❌ +17.50%
AuthWitTest::consume_public +70 ❌ +16.63%
TokenBlacklist::constructor +2,214 ❌ +15.04%
TokenBlacklist::mint_private +863 ❌ +14.71%
TokenBlacklist::update_roles +2,068 ❌ +14.16%
Parent::public_static_call +70 ❌ +13.33%
StaticParent::public_static_call +70 ❌ +13.33%
Auth::public_dispatch +3,781 ❌ +12.68%
StaticParent::public_nested_static_call +126 ❌ +11.72%
TokenBlacklist::burn_public +1,120 ❌ +11.43%
StaticParent::public_dispatch +728 ❌ +10.52%
TokenBlacklist::mint_public +1,002 ❌ +10.43%
TokenBlacklist::shield +1,115 ❌ +9.81%
AvmTest::nested_static_call_to_set_storage +28 ❌ +8.72%
ImportTest::pub_call_public_fn +28 ❌ +8.70%
TokenBlacklist::public_dispatch +11,137 ❌ +8.56%
AvmTest::create_same_nullifier_in_nested_call +28 ❌ +8.51%
Child::set_value_with_two_nested_calls +56 ❌ +8.50%
TokenBlacklist::transfer_public +1,254 ❌ +8.31%
AvmTest::create_different_nullifier_in_nested_call +28 ❌ +8.24%
FPC::pay_refund_with_shielded_rebate +98 ❌ +7.83%
Lending::repay_public +98 ❌ +7.61%
Child::public_dispatch +364 ❌ +7.40%
Parent::public_dispatch +714 ❌ +7.04%
Lending::deposit_public +98 ❌ +6.72%
AvmTest::test_get_contract_instance +56 ❌ +6.66%
AuthWitTest::public_dispatch +112 ❌ +6.39%
FPC::pay_refund +84 ❌ +6.10%
StaticChild::public_dispatch +224 ❌ +6.09%
DocsExample::public_dispatch +336 ❌ +5.81%
FPC::prepare_fee +56 ❌ +5.59%
AvmTest::public_dispatch +4,895 ❌ +5.46%
Uniswap::public_dispatch +1,694 ❌ +5.29%
Uniswap::swap_public +728 ❌ +5.08%
ImportTest::public_dispatch +70 ❌ +5.07%
NFT::transfer_in_public +252 ❌ +4.97%
Child::set_value_twice_with_nested_last +28 ❌ +4.91%
Child::set_value_twice_with_nested_first +28 ❌ +4.91%
Lending::borrow_public +42 ❌ +4.52%
Lending::withdraw_public +42 ❌ +4.52%
DelegatedOn::public_dispatch +56 ❌ +4.46%
Token::complete_refund +140 ❌ +4.17%
Delegator::public_dispatch +84 ❌ +4.15%
Crowdfunding::public_dispatch +336 ❌ +4.12%
FPC::public_dispatch +448 ❌ +4.10%
Test::public_dispatch +1,274 ❌ +3.88%
AvmTest::test_get_contract_instance_raw +14 ❌ +3.84%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 +336 ❌ +3.79%
Token::burn_public +252 ❌ +3.69%
StatefulTest::public_dispatch +448 ❌ +3.67%
Token::shield +308 ❌ +3.67%
TestLog::public_dispatch +126 ❌ +3.65%
Router::public_dispatch +140 ❌ +3.64%
TokenBridge::_call_mint_on_token +28 ❌ +3.63%
EasyPrivateVoting::public_dispatch +322 ❌ +3.51%
InclusionProofs::public_dispatch +196 ❌ +3.48%
AvmTest::assert_calldata_copy +14 ❌ +3.28%
NFT::constructor +238 ❌ +3.26%
AvmTest::variable_base_msm +14 ❌ +3.17%
Token::public_dispatch +2,002 ❌ +3.07%
Token::constructor +238 ❌ +3.06%
TokenBridge::public_dispatch +952 ❌ +3.03%
NFT::public_dispatch +1,162 ❌ +2.96%
TokenBridge::exit_to_l1_public +224 ❌ +2.89%
AvmTest::emit_unencrypted_log +84 ❌ +2.87%
Token::transfer_public +252 ❌ +2.72%
StatefulTest::public_constructor +112 ❌ +2.65%
TokenBridge::claim_public +378 ❌ +2.60%
Test::consume_mint_public_message +336 ❌ +2.51%
Lending::public_dispatch +1,846 ❌ +2.44%
Parent::public_nested_static_call +98 ❌ +2.44%
Router::_check_block_number +28 ❌ +2.37%
AvmTest::sha256_hash +84 ❌ +2.36%
Router::_check_timestamp +28 ❌ +2.34%
Lending::_withdraw +294 ❌ +2.31%
PrivateFPC::public_dispatch +112 ❌ +2.16%
Test::consume_message_from_arbitrary_sender_public +182 ❌ +2.10%
PriceFeed::public_dispatch +98 ❌ +1.99%
AvmInitializerTest::constructor +56 ❌ +1.98%
Claim::public_dispatch +112 ❌ +1.98%
AvmTest::u128_from_integer_overflow +14 ❌ +1.94%
AvmInitializerTest::public_dispatch +70 ❌ +1.93%
Lending::_borrow +280 ❌ +1.89%
InclusionProofs::constructor +70 ❌ +1.88%
FeeJuice::public_dispatch +182 ❌ +1.84%
Test::create_l2_to_l1_message_public +42 ❌ +1.80%
NFT::finalize_transfer_to_private +98 ❌ +1.75%
PrivateFPC::constructor +70 ❌ +1.73%
Test::emit_unencrypted +28 ❌ +1.73%
FPC::constructor +70 ❌ +1.70%
Uniswap::constructor +70 ❌ +1.70%
Auth::constructor +70 ❌ +1.69%
TokenBridge::constructor +70 ❌ +1.67%
Benchmarking::public_dispatch +112 ❌ +1.66%
AuthRegistry::public_dispatch +378 ❌ +1.63%
EasyPrivateVoting::constructor +70 ❌ +1.59%
CardGame::public_dispatch +442 ❌ +1.57%
Claim::constructor +70 ❌ +1.55%
AppSubscription::public_dispatch +112 ❌ +1.40%
Crowdfunding::init +70 ❌ +1.38%
TestLog::emit_unencrypted_events +28 ❌ +1.31%
CardGame::on_cards_claimed +98 ❌ +1.31%
AvmTest::bulk_testing +406 ❌ +1.29%
Token::mint_private +56 ❌ +1.28%
AvmTest::pedersen_hash +42 ❌ +1.23%
AvmTest::pedersen_hash_with_index +42 ❌ +1.23%
Lending::_repay +112 ❌ +1.20%
CardGame::on_card_played +70 ❌ +1.18%
CardGame::on_game_joined +56 ❌ +1.17%
AppSubscription::constructor +70 ❌ +1.16%
Lending::_deposit +28 ❌ +1.13%
Crowdfunding::_publish_donation_receipts +14 ❌ +1.10%
AvmTest::u128_addition_overflow +14 ❌ +1.03%
AuthRegistry::consume +84 ❌ +1.02%
CardGame::start_game +70 ❌ +0.96%
Spam::public_dispatch +42 ❌ +0.92%
AvmTest::get_args_hash +14 ❌ +0.86%
Benchmarking::increment_balance +28 ❌ +0.76%
AvmTest::keccak_hash +14 ❌ +0.51%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AvmTest::pedersen_commit 1,465 (+1,115) +318.57%
Auth::get_scheduled_authorized 2,666 (+773) +40.83%
AvmTest::nested_call_to_add_with_gas 503 (+140) +38.57%
Auth::get_authorized 2,762 (+768) +38.52%
Auth::get_authorized_delay 3,027 (+808) +36.41%
StaticParent::public_get_value_from_child 471 (+112) +31.20%
AvmTest::nested_call_to_add 486 (+112) +29.95%
AvmTest::nested_static_call_to_add 486 (+112) +29.95%
DocsExample::get_shared_immutable_constrained_public_indirect 519 (+112) +27.52%
Parent::pub_entry_point_twice 682 (+140) +25.83%
TokenBlacklist::get_roles 4,216 (+863) +25.74%
Uniswap::_assert_token_is_same 556 (+112) +25.23%
Parent::pub_entry_point 438 (+70) +19.02%
StaticParent::public_call 438 (+70) +19.02%
Auth::set_authorized_delay 11,688 (+1,770) +17.85%
Auth::set_authorized 11,884 (+1,770) +17.50%
AuthWitTest::consume_public 491 (+70) +16.63%
TokenBlacklist::constructor 16,936 (+2,214) +15.04%
TokenBlacklist::mint_private 6,729 (+863) +14.71%
TokenBlacklist::update_roles 16,676 (+2,068) +14.16%
Parent::public_static_call 595 (+70) +13.33%
StaticParent::public_static_call 595 (+70) +13.33%
Auth::public_dispatch 33,597 (+3,781) +12.68%
StaticParent::public_nested_static_call 1,201 (+126) +11.72%
TokenBlacklist::burn_public 10,918 (+1,120) +11.43%
StaticParent::public_dispatch 7,649 (+728) +10.52%
TokenBlacklist::mint_public 10,613 (+1,002) +10.43%
TokenBlacklist::shield 12,482 (+1,115) +9.81%
AvmTest::nested_static_call_to_set_storage 349 (+28) +8.72%
ImportTest::pub_call_public_fn 350 (+28) +8.70%
TokenBlacklist::public_dispatch 141,193 (+11,137) +8.56%
AvmTest::create_same_nullifier_in_nested_call 357 (+28) +8.51%
Child::set_value_with_two_nested_calls 715 (+56) +8.50%
TokenBlacklist::transfer_public 16,349 (+1,254) +8.31%
AvmTest::create_different_nullifier_in_nested_call 368 (+28) +8.24%
FPC::pay_refund_with_shielded_rebate 1,350 (+98) +7.83%
Lending::repay_public 1,386 (+98) +7.61%
Child::public_dispatch 5,286 (+364) +7.40%
Parent::public_dispatch 10,859 (+714) +7.04%
Lending::deposit_public 1,556 (+98) +6.72%
AvmTest::test_get_contract_instance 897 (+56) +6.66%
AuthWitTest::public_dispatch 1,866 (+112) +6.39%
FPC::pay_refund 1,461 (+84) +6.10%
StaticChild::public_dispatch 3,903 (+224) +6.09%
DocsExample::public_dispatch 6,118 (+336) +5.81%
FPC::prepare_fee 1,058 (+56) +5.59%
AvmTest::public_dispatch 94,557 (+4,895) +5.46%
Uniswap::public_dispatch 33,713 (+1,694) +5.29%
Uniswap::swap_public 15,070 (+728) +5.08%
ImportTest::public_dispatch 1,452 (+70) +5.07%
NFT::transfer_in_public 5,323 (+252) +4.97%
Child::set_value_twice_with_nested_last 598 (+28) +4.91%
Child::set_value_twice_with_nested_first 598 (+28) +4.91%
Lending::borrow_public 971 (+42) +4.52%
Lending::withdraw_public 971 (+42) +4.52%
DelegatedOn::public_dispatch 1,312 (+56) +4.46%
Token::complete_refund 3,496 (+140) +4.17%
Delegator::public_dispatch 2,109 (+84) +4.15%
Crowdfunding::public_dispatch 8,499 (+336) +4.12%
FPC::public_dispatch 11,379 (+448) +4.10%
Test::public_dispatch 34,124 (+1,274) +3.88%
AvmTest::test_get_contract_instance_raw 379 (+14) +3.84%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 9,207 (+336) +3.79%
Token::burn_public 7,080 (+252) +3.69%
StatefulTest::public_dispatch 12,654 (+448) +3.67%
Token::shield 8,705 (+308) +3.67%
TestLog::public_dispatch 3,581 (+126) +3.65%
Router::public_dispatch 3,987 (+140) +3.64%
TokenBridge::_call_mint_on_token 799 (+28) +3.63%
EasyPrivateVoting::public_dispatch 9,499 (+322) +3.51%
InclusionProofs::public_dispatch 5,826 (+196) +3.48%
AvmTest::assert_calldata_copy 441 (+14) +3.28%
NFT::constructor 7,537 (+238) +3.26%
AvmTest::variable_base_msm 456 (+14) +3.17%
Token::public_dispatch 67,225 (+2,002) +3.07%
Token::constructor 8,026 (+238) +3.06%
TokenBridge::public_dispatch 32,395 (+952) +3.03%
NFT::public_dispatch 40,373 (+1,162) +2.96%
TokenBridge::exit_to_l1_public 7,985 (+224) +2.89%
AvmTest::emit_unencrypted_log 3,011 (+84) +2.87%
Token::transfer_public 9,501 (+252) +2.72%
StatefulTest::public_constructor 4,337 (+112) +2.65%
TokenBridge::claim_public 14,935 (+378) +2.60%
Test::consume_mint_public_message 13,747 (+336) +2.51%
Lending::public_dispatch 77,370 (+1,846) +2.44%
Parent::public_nested_static_call 4,122 (+98) +2.44%
Router::_check_block_number 1,208 (+28) +2.37%
AvmTest::sha256_hash 3,649 (+84) +2.36%
Router::_check_timestamp 1,225 (+28) +2.34%
Lending::_withdraw 13,048 (+294) +2.31%
PrivateFPC::public_dispatch 5,306 (+112) +2.16%
Test::consume_message_from_arbitrary_sender_public 8,838 (+182) +2.10%
PriceFeed::public_dispatch 5,033 (+98) +1.99%
AvmInitializerTest::constructor 2,880 (+56) +1.98%
Claim::public_dispatch 5,767 (+112) +1.98%
AvmTest::u128_from_integer_overflow 737 (+14) +1.94%
AvmInitializerTest::public_dispatch 3,706 (+70) +1.93%
Lending::_borrow 15,118 (+280) +1.89%
InclusionProofs::constructor 3,785 (+70) +1.88%
FeeJuice::public_dispatch 10,057 (+182) +1.84%
Test::create_l2_to_l1_message_public 2,372 (+42) +1.80%
NFT::finalize_transfer_to_private 5,683 (+98) +1.75%
PrivateFPC::constructor 4,114 (+70) +1.73%
Test::emit_unencrypted 1,651 (+28) +1.73%
FPC::constructor 4,183 (+70) +1.70%
Uniswap::constructor 4,183 (+70) +1.70%
Auth::constructor 4,205 (+70) +1.69%
TokenBridge::constructor 4,252 (+70) +1.67%
Benchmarking::public_dispatch 6,846 (+112) +1.66%
AuthRegistry::public_dispatch 23,629 (+378) +1.63%
EasyPrivateVoting::constructor 4,460 (+70) +1.59%
CardGame::public_dispatch 28,598 (+442) +1.57%
Claim::constructor 4,575 (+70) +1.55%
AppSubscription::public_dispatch 8,102 (+112) +1.40%
Crowdfunding::init 5,149 (+70) +1.38%
TestLog::emit_unencrypted_events 2,158 (+28) +1.31%
CardGame::on_cards_claimed 7,573 (+98) +1.31%
AvmTest::bulk_testing 31,864 (+406) +1.29%
Token::mint_private 4,443 (+56) +1.28%
AvmTest::pedersen_hash 3,443 (+42) +1.23%
AvmTest::pedersen_hash_with_index 3,443 (+42) +1.23%
Lending::_repay 9,474 (+112) +1.20%
CardGame::on_card_played 5,978 (+70) +1.18%
CardGame::on_game_joined 4,823 (+56) +1.17%
AppSubscription::constructor 6,091 (+70) +1.16%
Lending::_deposit 2,507 (+28) +1.13%
Crowdfunding::_publish_donation_receipts 1,290 (+14) +1.10%
AvmTest::u128_addition_overflow 1,371 (+14) +1.03%
AuthRegistry::consume 8,342 (+84) +1.02%
CardGame::start_game 7,355 (+70) +0.96%
Spam::public_dispatch 4,604 (+42) +0.92%
AvmTest::get_args_hash 1,646 (+14) +0.86%
Benchmarking::increment_balance 3,722 (+28) +0.76%
AvmTest::keccak_hash 2,733 (+14) +0.51%

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Changes to circuit sizes

Generated at commit: 1b4833315edd071a15170528f31cdbacd8034fef, compared to commit: 797d0ca4abb396b6325a8159ca3be248c16c6b97

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root -3 ✅ -0.14% +1,669,838 ❌ +43.75%
rollup_block_root 0 ➖ 0.00% +1,252,377 ❌ +43.66%
rollup_merge 0 ➖ 0.00% +834,927 ❌ +43.57%
rollup_root 0 ➖ 0.00% +834,914 ❌ +42.76%
rollup_block_merge 0 ➖ 0.00% +834,914 ❌ +42.76%
public_kernel_merge 0 ➖ 0.00% +417,452 ❌ +37.35%
public_kernel_tail 0 ➖ 0.00% +417,452 ❌ +18.30%
rollup_base 0 ➖ 0.00% +418,926 ❌ +12.64%
parity_base 0 ➖ 0.00% +36 ❌ +0.07%
private_kernel_reset -65 ✅ -0.07% -112 ✅ -0.02%
private_kernel_inner -65 ✅ -0.15% -112 ✅ -0.20%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root 2,114 (-3) -0.14% 5,486,726 (+1,669,838) +43.75%
rollup_block_root 1,966 (0) 0.00% 4,121,156 (+1,252,377) +43.66%
rollup_merge 1,483 (0) 0.00% 2,751,430 (+834,927) +43.57%
rollup_root 18,844 (0) 0.00% 2,787,657 (+834,914) +42.76%
rollup_block_merge 18,860 (0) 0.00% 2,787,689 (+834,914) +42.76%
public_kernel_merge 53,488 (0) 0.00% 1,535,245 (+417,452) +37.35%
public_kernel_tail 259,172 (0) 0.00% 2,699,168 (+417,452) +18.30%
rollup_base 423,026 (0) 0.00% 3,734,192 (+418,926) +12.64%
parity_base 2,089 (0) 0.00% 53,444 (+36) +0.07%
private_kernel_reset 91,870 (-65) -0.07% 471,894 (-112) -0.02%
private_kernel_inner 43,886 (-65) -0.15% 56,719 (-112) -0.20%

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.

1 participant