Skip to content

fix(bb.js): use globalThis instead of self#10786

Closed
ludamad wants to merge 1 commit intomasterfrom
om/globalThis-in-bb
Closed

fix(bb.js): use globalThis instead of self#10786
ludamad wants to merge 1 commit intomasterfrom
om/globalThis-in-bb

Conversation

@ludamad
Copy link
Collaborator

@ludamad ludamad commented Dec 17, 2024

Shadowing #10747

@github-actions
Copy link
Contributor

Changes to public function bytecode sizes

Generated at commit: e1c2bc532dbca9640a823b03db4dc8349e52157e, compared to commit: bab9f852c08f29f022bf526aacb8350732fcf4ac

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
StaticChild::public_dispatch +104 ❌ +5.13%
AvmTest::read_storage_list +13 ❌ +4.58%
AvmTest::elliptic_curve_add +26 ❌ +4.48%
InclusionProofs::public_dispatch +156 ❌ +4.10%
Child::set_value_with_two_nested_calls +39 ❌ +4.02%
AvmTest::public_dispatch +2,496 ❌ +4.01%
AvmTest::elliptic_curve_add_and_double +26 ❌ +3.65%
Test::public_dispatch +676 ❌ +3.63%
AvmTest::returndata_copy_oracle +65 ❌ +3.63%
Test::consume_mint_to_public_message +390 ❌ +3.59%
TokenBridge::claim_public +403 ❌ +3.54%
Child::public_dispatch +169 ❌ +3.54%
ImportTest::public_dispatch +39 ❌ +3.46%
TokenBridge::public_dispatch +715 ❌ +3.44%
Test::consume_message_from_arbitrary_sender_public +260 ❌ +3.29%
Uniswap::swap_public +507 ❌ +3.26%
TokenBridge::exit_to_l1_public +208 ❌ +3.18%
NFT::public_dispatch +702 ❌ +2.91%
Auth::set_authorized +143 ❌ +2.88%
TestLog::public_dispatch +65 ❌ +2.84%
Token::public_dispatch +923 ❌ +2.84%
Auth::set_authorized_delay +143 ❌ +2.82%
StatefulTest::public_dispatch +169 ❌ +2.76%
EasyPrivateVoting::public_dispatch +130 ❌ +2.67%
AvmTest::sha256_hash +104 ❌ +2.66%
AvmTest::external_call_to_divide_by_zero +13 ❌ +2.65%
AvmTest::nested_call_to_nothing +13 ❌ +2.65%
AvmTest::external_call_to_assertion_failure +13 ❌ +2.65%
StaticParent::public_dispatch +156 ❌ +2.64%
AuthRegistry::public_dispatch +208 ❌ +2.63%
InclusionProofs::constructor +65 ❌ +2.63%
Parent::pub_entry_point_twice +26 ❌ +2.60%
AvmTest::nested_static_call_to_set_storage +13 ❌ +2.58%
ImportTest::pub_call_public_fn +13 ❌ +2.57%
Uniswap::constructor +65 ❌ +2.56%
AvmTest::create_same_nullifier_in_nested_call +13 ❌ +2.55%
EasyPrivateVoting::constructor +65 ❌ +2.52%
Auth::constructor +65 ❌ +2.52%
AvmTest::create_different_nullifier_in_nested_call +13 ❌ +2.50%
AvmTest::assert_calldata_copy +13 ❌ +2.45%
NFT::finalize_transfer_to_private +130 ❌ +2.42%
NFT::_finalize_transfer_to_private_unsafe +130 ❌ +2.40%
FeeJuice::public_dispatch +117 ❌ +2.39%
Token::complete_refund +130 ❌ +2.37%
Token::finalize_mint_to_private +143 ❌ +2.36%
Auth::public_dispatch +221 ❌ +2.35%
Token::_finalize_mint_to_private_unsafe +143 ❌ +2.34%
TokenBlacklist::public_dispatch +559 ❌ +2.33%
Router::public_dispatch +52 ❌ +2.31%
DocsExample::public_dispatch +91 ❌ +2.30%
Parent::public_dispatch +182 ❌ +2.29%
TokenBlacklist::constructor +156 ❌ +2.28%
AvmTest::nested_call_to_add_with_gas +13 ❌ +2.28%
AMM::_swap_tokens_for_exact_tokens +104 ❌ +2.25%
Crowdfunding::public_dispatch +104 ❌ +2.25%
PriceFeed::public_dispatch +65 ❌ +2.25%
StaticParent::public_get_value_from_child +13 ❌ +2.24%
Token::finalize_transfer_to_private +143 ❌ +2.23%
Token::_finalize_transfer_to_private_unsafe +143 ❌ +2.21%
AvmTest::nested_call_to_add +13 ❌ +2.18%
AvmTest::nested_static_call_to_add +13 ❌ +2.18%
AvmTest::nested_call_to_assert_same +13 ❌ +2.18%
NFT::transfer_in_public +78 ❌ +2.18%
Uniswap::public_dispatch +533 ❌ +2.17%
AppSubscription::public_dispatch +91 ❌ +2.14%
Child::set_value_twice_with_nested_last +13 ❌ +2.11%
AppSubscription::constructor +65 ❌ +2.10%
AuthWitTest::consume_public +13 ❌ +2.01%
DocsExample::get_public_immutable_constrained_public_indirect +13 ❌ +1.91%
AvmTest::emit_unencrypted_log +52 ❌ +1.87%
AMM::public_dispatch +377 ❌ +1.79%
Lending::public_dispatch +494 ❌ +1.78%
StatefulTest::public_constructor +52 ❌ +1.77%
Token::transfer_in_public +78 ❌ +1.75%
Uniswap::_assert_token_is_same +13 ❌ +1.75%
FPC::public_dispatch +130 ❌ +1.73%
TokenBlacklist::shield +104 ❌ +1.69%
AMM::_remove_liquidity +117 ❌ +1.68%
AvmTest::u128_from_integer_overflow +13 ❌ +1.60%
TokenBlacklist::update_roles +104 ❌ +1.58%
AuthWitTest::public_dispatch +26 ❌ +1.58%
CardGame::public_dispatch +234 ❌ +1.55%
TokenBlacklist::transfer_public +91 ❌ +1.53%
AMM::_add_liquidity +130 ❌ +1.52%
NFT::constructor +65 ❌ +1.51%
Token::constructor +65 ❌ +1.48%
Claim::public_dispatch +52 ❌ +1.44%
TokenBlacklist::get_roles +39 ❌ +1.42%
Benchmarking::public_dispatch +52 ❌ +1.41%
AMM::constructor +39 ❌ +1.40%
Crowdfunding::init +39 ❌ +1.39%
Crowdfunding::_publish_donation_receipts +13 ❌ +1.39%
AvmTest::get_args_hash +26 ❌ +1.38%
TokenBlacklist::mint_private +52 ❌ +1.38%
AuthRegistry::consume +39 ❌ +1.27%
AMM::_swap_exact_tokens_for_tokens +52 ❌ +1.27%
Token::burn_public +52 ❌ +1.23%
TokenBlacklist::burn_public +65 ❌ +1.20%
AvmTest::bulk_testing +286 ❌ +1.20%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 +78 ❌ +1.12%
AvmTest::keccak_hash +26 ❌ +1.09%
AvmTest::pedersen_commit +13 ❌ +1.01%
AvmTest::u128_addition_overflow +13 ❌ +0.98%
TokenBlacklist::mint_public +39 ❌ +0.97%
FPC::constructor +26 ❌ +0.96%
TokenBridge::constructor +26 ❌ +0.95%
Claim::constructor +26 ❌ +0.91%
Lending::_withdraw +78 ❌ +0.90%
Lending::_borrow +65 ❌ +0.89%
Test::emit_unencrypted +13 ❌ +0.88%
Spam::public_dispatch +26 ❌ +0.85%
AvmTest::n_storage_writes +13 ❌ +0.79%
CardGame::on_cards_claimed +52 ❌ +0.73%
Auth::get_scheduled_authorized +13 ❌ +0.72%
Auth::get_authorized +13 ❌ +0.68%
AvmInitializerTest::constructor +13 ❌ +0.68%
Auth::get_authorized_delay +13 ❌ +0.65%
Lending::withdraw_public +13 ❌ +0.65%
Lending::borrow_public +13 ❌ +0.65%
FPC::prepare_fee +13 ❌ +0.61%
StaticParent::public_nested_static_call +13 ❌ +0.60%
FPC::pay_refund +13 ❌ +0.60%
CardGame::start_game +39 ❌ +0.59%
Test::create_l2_to_l1_message_public +13 ❌ +0.59%
Benchmarking::increment_balance +13 ❌ +0.58%
Lending::_deposit +13 ❌ +0.54%
CardGame::on_game_joined +26 ❌ +0.54%
Lending::repay_public +13 ❌ +0.49%
AvmInitializerTest::public_dispatch +13 ❌ +0.48%
CardGame::on_card_played +26 ❌ +0.47%
Lending::deposit_public +13 ❌ +0.47%
AvmTest::pedersen_hash +13 ❌ +0.42%
AvmTest::pedersen_hash_with_index +13 ❌ +0.42%
Parent::public_nested_static_call +13 ❌ +0.36%
Lending::_repay +13 ❌ +0.24%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
StaticChild::public_dispatch 2,131 (+104) +5.13%
AvmTest::read_storage_list 297 (+13) +4.58%
AvmTest::elliptic_curve_add 606 (+26) +4.48%
InclusionProofs::public_dispatch 3,958 (+156) +4.10%
Child::set_value_with_two_nested_calls 1,008 (+39) +4.02%
AvmTest::public_dispatch 64,732 (+2,496) +4.01%
AvmTest::elliptic_curve_add_and_double 739 (+26) +3.65%
Test::public_dispatch 19,286 (+676) +3.63%
AvmTest::returndata_copy_oracle 1,858 (+65) +3.63%
Test::consume_mint_to_public_message 11,240 (+390) +3.59%
TokenBridge::claim_public 11,773 (+403) +3.54%
Child::public_dispatch 4,948 (+169) +3.54%
ImportTest::public_dispatch 1,165 (+39) +3.46%
TokenBridge::public_dispatch 21,515 (+715) +3.44%
Test::consume_message_from_arbitrary_sender_public 8,161 (+260) +3.29%
Uniswap::swap_public 16,067 (+507) +3.26%
TokenBridge::exit_to_l1_public 6,757 (+208) +3.18%
NFT::public_dispatch 24,807 (+702) +2.91%
Auth::set_authorized 5,109 (+143) +2.88%
TestLog::public_dispatch 2,353 (+65) +2.84%
Token::public_dispatch 33,426 (+923) +2.84%
Auth::set_authorized_delay 5,205 (+143) +2.82%
StatefulTest::public_dispatch 6,293 (+169) +2.76%
EasyPrivateVoting::public_dispatch 4,993 (+130) +2.67%
AvmTest::sha256_hash 4,019 (+104) +2.66%
AvmTest::external_call_to_divide_by_zero 503 (+13) +2.65%
AvmTest::nested_call_to_nothing 503 (+13) +2.65%
AvmTest::external_call_to_assertion_failure 503 (+13) +2.65%
StaticParent::public_dispatch 6,068 (+156) +2.64%
AuthRegistry::public_dispatch 8,115 (+208) +2.63%
InclusionProofs::constructor 2,536 (+65) +2.63%
Parent::pub_entry_point_twice 1,027 (+26) +2.60%
AvmTest::nested_static_call_to_set_storage 517 (+13) +2.58%
ImportTest::pub_call_public_fn 518 (+13) +2.57%
Uniswap::constructor 2,605 (+65) +2.56%
AvmTest::create_same_nullifier_in_nested_call 523 (+13) +2.55%
EasyPrivateVoting::constructor 2,642 (+65) +2.52%
Auth::constructor 2,646 (+65) +2.52%
AvmTest::create_different_nullifier_in_nested_call 533 (+13) +2.50%
AvmTest::assert_calldata_copy 544 (+13) +2.45%
NFT::finalize_transfer_to_private 5,510 (+130) +2.42%
NFT::_finalize_transfer_to_private_unsafe 5,557 (+130) +2.40%
FeeJuice::public_dispatch 5,017 (+117) +2.39%
Token::complete_refund 5,616 (+130) +2.37%
Token::finalize_mint_to_private 6,211 (+143) +2.36%
Auth::public_dispatch 9,618 (+221) +2.35%
Token::_finalize_mint_to_private_unsafe 6,258 (+143) +2.34%
TokenBlacklist::public_dispatch 24,598 (+559) +2.33%
Router::public_dispatch 2,306 (+52) +2.31%
DocsExample::public_dispatch 4,041 (+91) +2.30%
Parent::public_dispatch 8,125 (+182) +2.29%
TokenBlacklist::constructor 6,995 (+156) +2.28%
AvmTest::nested_call_to_add_with_gas 583 (+13) +2.28%
AMM::_swap_tokens_for_exact_tokens 4,720 (+104) +2.25%
Crowdfunding::public_dispatch 4,724 (+104) +2.25%
PriceFeed::public_dispatch 2,960 (+65) +2.25%
StaticParent::public_get_value_from_child 594 (+13) +2.24%
Token::finalize_transfer_to_private 6,563 (+143) +2.23%
Token::_finalize_transfer_to_private_unsafe 6,610 (+143) +2.21%
AvmTest::nested_call_to_add 608 (+13) +2.18%
AvmTest::nested_static_call_to_add 608 (+13) +2.18%
AvmTest::nested_call_to_assert_same 608 (+13) +2.18%
NFT::transfer_in_public 3,649 (+78) +2.18%
Uniswap::public_dispatch 25,143 (+533) +2.17%
AppSubscription::public_dispatch 4,334 (+91) +2.14%
Child::set_value_twice_with_nested_last 628 (+13) +2.11%
AppSubscription::constructor 3,165 (+65) +2.10%
AuthWitTest::consume_public 661 (+13) +2.01%
DocsExample::get_public_immutable_constrained_public_indirect 695 (+13) +1.91%
AvmTest::emit_unencrypted_log 2,829 (+52) +1.87%
AMM::public_dispatch 21,436 (+377) +1.79%
Lending::public_dispatch 28,323 (+494) +1.78%
StatefulTest::public_constructor 2,993 (+52) +1.77%
Token::transfer_in_public 4,529 (+78) +1.75%
Uniswap::_assert_token_is_same 756 (+13) +1.75%
FPC::public_dispatch 7,631 (+130) +1.73%
TokenBlacklist::shield 6,241 (+104) +1.69%
AMM::_remove_liquidity 7,080 (+117) +1.68%
AvmTest::u128_from_integer_overflow 826 (+13) +1.60%
TokenBlacklist::update_roles 6,676 (+104) +1.58%
AuthWitTest::public_dispatch 1,676 (+26) +1.58%
CardGame::public_dispatch 15,323 (+234) +1.55%
TokenBlacklist::transfer_public 6,040 (+91) +1.53%
AMM::_add_liquidity 8,693 (+130) +1.52%
NFT::constructor 4,369 (+65) +1.51%
Token::constructor 4,444 (+65) +1.48%
Claim::public_dispatch 3,663 (+52) +1.44%
TokenBlacklist::get_roles 2,795 (+39) +1.42%
Benchmarking::public_dispatch 3,742 (+52) +1.41%
AMM::constructor 2,824 (+39) +1.40%
Crowdfunding::init 2,839 (+39) +1.39%
Crowdfunding::_publish_donation_receipts 948 (+13) +1.39%
AvmTest::get_args_hash 1,905 (+26) +1.38%
TokenBlacklist::mint_private 3,819 (+52) +1.38%
AuthRegistry::consume 3,101 (+39) +1.27%
AMM::_swap_exact_tokens_for_tokens 4,150 (+52) +1.27%
Token::burn_public 4,285 (+52) +1.23%
TokenBlacklist::burn_public 5,466 (+65) +1.20%
AvmTest::bulk_testing 24,121 (+286) +1.20%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 7,054 (+78) +1.12%
AvmTest::keccak_hash 2,415 (+26) +1.09%
AvmTest::pedersen_commit 1,297 (+13) +1.01%
AvmTest::u128_addition_overflow 1,342 (+13) +0.98%
TokenBlacklist::mint_public 4,055 (+39) +0.97%
FPC::constructor 2,737 (+26) +0.96%
TokenBridge::constructor 2,776 (+26) +0.95%
Claim::constructor 2,872 (+26) +0.91%
Lending::_withdraw 8,745 (+78) +0.90%
Lending::_borrow 7,334 (+65) +0.89%
Test::emit_unencrypted 1,492 (+13) +0.88%
Spam::public_dispatch 3,067 (+26) +0.85%
AvmTest::n_storage_writes 1,662 (+13) +0.79%
CardGame::on_cards_claimed 7,181 (+52) +0.73%
Auth::get_scheduled_authorized 1,824 (+13) +0.72%
Auth::get_authorized 1,919 (+13) +0.68%
AvmInitializerTest::constructor 1,936 (+13) +0.68%
Auth::get_authorized_delay 2,022 (+13) +0.65%
Lending::withdraw_public 2,024 (+13) +0.65%
Lending::borrow_public 2,024 (+13) +0.65%
FPC::prepare_fee 2,129 (+13) +0.61%
StaticParent::public_nested_static_call 2,176 (+13) +0.60%
FPC::pay_refund 2,184 (+13) +0.60%
CardGame::start_game 6,653 (+39) +0.59%
Test::create_l2_to_l1_message_public 2,223 (+13) +0.59%
Benchmarking::increment_balance 2,251 (+13) +0.58%
Lending::_deposit 2,411 (+13) +0.54%
CardGame::on_game_joined 4,858 (+26) +0.54%
Lending::repay_public 2,672 (+13) +0.49%
AvmInitializerTest::public_dispatch 2,694 (+13) +0.48%
CardGame::on_card_played 5,555 (+26) +0.47%
Lending::deposit_public 2,802 (+13) +0.47%
AvmTest::pedersen_hash 3,116 (+13) +0.42%
AvmTest::pedersen_hash_with_index 3,116 (+13) +0.42%
Parent::public_nested_static_call 3,625 (+13) +0.36%
Lending::_repay 5,535 (+13) +0.24%

@github-actions
Copy link
Contributor

Changes to circuit sizes

Generated at commit: e1c2bc532dbca9640a823b03db4dc8349e52157e, compared to commit: bab9f852c08f29f022bf526aacb8350732fcf4ac

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge +1,133 ❌ +63.26% +7,594 ❌ +0.42%
rollup_block_merge -4,971 ✅ -15.34% -65,320 ✅ -3.31%
rollup_root -4,971 ✅ -15.35% -65,320 ✅ -3.31%
rollup_block_root_empty -864 ✅ -87.27% -864 ✅ -22.81%
rollup_base_public -1,285,053 ✅ -33.37% -4,042,731 ✅ -31.95%
rollup_base_private -1,299,779 ✅ -35.91% -4,063,803 ✅ -36.09%
rollup_block_root -678,432 ✅ -99.43% -1,665,426 ✅ -37.81%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_merge 2,924 (+1,133) +63.26% 1,826,571 (+7,594) +0.42%
rollup_block_merge 27,435 (-4,971) -15.34% 1,909,538 (-65,320) -3.31%
rollup_root 27,419 (-4,971) -15.35% 1,909,524 (-65,320) -3.31%
rollup_block_root_empty 126 (-864) -87.27% 2,923 (-864) -22.81%
rollup_base_public 2,566,193 (-1,285,053) -33.37% 8,612,003 (-4,042,731) -31.95%
rollup_base_private 2,319,822 (-1,299,779) -35.91% 7,197,700 (-4,063,803) -36.09%
rollup_block_root 3,894 (-678,432) -99.43% 2,739,060 (-1,665,426) -37.81%

@ludamad ludamad closed this Dec 17, 2024
@ludamad ludamad deleted the om/globalThis-in-bb branch December 3, 2025 16:21
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.

2 participants