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: contract class must be registered before deployment #10949

Merged
merged 25 commits into from
Jan 10, 2025

Conversation

dbanks12
Copy link
Collaborator

Resolves #10832

@dbanks12 dbanks12 changed the title feat: contract class must be registered before deployment fix: contract class must be registered before deployment Dec 23, 2024
@dbanks12 dbanks12 marked this pull request as ready for review December 23, 2024 23:56
@dbanks12 dbanks12 requested review from Thunkar and spalladino January 3, 2025 18:20
@dbanks12 dbanks12 changed the title fix: contract class must be registered before deployment feat: contract class must be registered before deployment Jan 3, 2025
Comment on lines 114 to 137
this.wallets = await Promise.all(accountManagers.map(a => a.getWallet()));
this.accounts = await pxe.getRegisteredAccounts();
this.wallets = (await Promise.all(accountManagers.map(a => a.getWallet()))).sort((aWallet, bWallet) => {
const a = aWallet.getAddress().toBigInt();
const b = bWallet.getAddress().toBigInt();
if (a < b) {
return -1;
} else if (a > b) {
return 1;
} else {
return 0;
}
});
this.accounts = (await pxe.getRegisteredAccounts()).sort((aAccount, bAccount) => {
const a = aAccount.address.toBigInt();
const b = bAccount.address.toBigInt();
if (a < b) {
return -1;
} else if (a > b) {
return 1;
} else {
return 0;
}
});
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

pxe.getRegisteredAccounts wasn't returning the accounts in the same order as wallets which was causing test failures because there was an assumption that wallets[0] == accounts[0]

Comment on lines -592 to +613
const batch = new BatchCall(sender, [
(await registerContractClass(sender, SchnorrAccountContractArtifact)).request(),
...instances.map(instance => deployInstance(sender, instance!).request()),
]);

const contractClass = getContractClassFromArtifact(SchnorrAccountContractArtifact);
const alreadyRegistered = await sender.isContractClassPubliclyRegistered(contractClass.id);

const calls: FunctionCall[] = [];
if (!alreadyRegistered) {
calls.push((await registerContractClass(sender, SchnorrAccountContractArtifact)).request());
}
calls.push(...instances.map(instance => deployInstance(sender, instance!).request()));

const batch = new BatchCall(sender, calls);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Don't batch a call to register the class if it is already registered

const opts = { skipClassRegistration: true };
logger.debug(`Trying to deploy contract instance without registering its contract class`);
await expect(StatefulTestContract.deploy(wallet, owner, owner, 42).send(opts).wait()).rejects.toThrow(
/Cannot find the leaf for nullifier/,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need better error messages :-P

@dbanks12 dbanks12 added e2e-prover-full CI: Enables this CI job. e2e-all CI: Enables this CI job. labels Jan 9, 2025
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Changes to public function bytecode sizes

Generated at commit: f1e095085fc92f4b5abe570ed135a9bb3647efab, compared to commit: a66349fa2b60fb397008cd7e0571cc3a3e5fae02

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
NFT::owner_of +426 ❌ +23.36%
NFT::mint +503 ❌ +23.21%
Token::mint_to_public +379 ❌ +16.41%
TokenBlacklist::mint_public +415 ❌ +11.52%
AuthRegistry::public_dispatch +751 ❌ +10.49%
AuthWitTest::public_dispatch +149 ❌ +9.93%
Lending::public_dispatch +2,450 ❌ +9.67%
TokenBlacklist::transfer_public +500 ❌ +9.18%
Lending::get_position +389 ❌ +9.10%
Token::public_dispatch +2,596 ❌ +8.61%
TokenBlacklist::public_dispatch +1,725 ❌ +7.73%
TokenBlacklist::burn_public +379 ❌ +7.55%
TokenBlacklist::shield +392 ❌ +6.82%
StatefulTest::public_dispatch +360 ❌ +6.25%
FPC::public_dispatch +462 ❌ +6.21%
FeeJuice::public_dispatch +271 ❌ +5.85%
NFT::public_dispatch +1,334 ❌ +5.85%
AppSubscription::public_dispatch +215 ❌ +5.34%
Parent::public_dispatch +392 ❌ +5.19%
StaticParent::public_dispatch +288 ❌ +5.12%
DocsExample::public_dispatch +189 ❌ +5.03%
AvmTest::nested_call_to_nothing_recovers +13 ❌ +4.30%
Test::public_dispatch +640 ❌ +3.55%
Benchmarking::public_dispatch +120 ❌ +3.36%
AvmTest::public_dispatch +1,844 ❌ +2.90%
Uniswap::public_dispatch +612 ❌ +2.55%
TokenBridge::public_dispatch +490 ❌ +2.41%
AvmTest::keccak_hash +52 ❌ +2.21%
CardGame::public_dispatch +277 ❌ +1.87%
Test::emit_unencrypted +26 ❌ +1.79%
TestLog::public_dispatch +39 ❌ +1.73%
NFT::finalize_transfer_to_private +91 ❌ +1.71%
NFT::_finalize_transfer_to_private_unsafe +91 ❌ +1.70%
AvmTest::n_storage_writes +26 ❌ +1.60%
Token::finalize_mint_to_private +91 ❌ +1.52%
Token::_finalize_mint_to_private_unsafe +91 ❌ +1.50%
Auth::get_scheduled_authorized +26 ❌ +1.46%
Token::finalize_transfer_to_private +91 ❌ +1.43%
AvmTest::emit_unencrypted_log +39 ❌ +1.42%
Token::_finalize_transfer_to_private_unsafe +91 ❌ +1.42%
Crowdfunding::_publish_donation_receipts +13 ❌ +1.41%
AvmTest::get_args_hash +26 ❌ +1.40%
EasyPrivateVoting::public_dispatch +67 ❌ +1.40%
Auth::get_authorized +26 ❌ +1.38%
AvmTest::external_call_to_divide_by_zero_recovers +39 ❌ +1.36%
Token::complete_refund +91 ❌ +1.33%
CardGame::on_cards_claimed +91 ❌ +1.29%
Lending::get_asset +26 ❌ +1.27%
Test::create_l2_to_l1_message_public +26 ❌ +1.19%
ImportTest::public_dispatch +13 ❌ +1.17%
TestLog::emit_unencrypted_events +13 ❌ +1.15%
Lending::_deposit +26 ❌ +1.10%
Parent::public_nested_static_call +39 ❌ +1.09%
CardGame::on_game_joined +52 ❌ +1.09%
NFT::_store_payload_in_transient_storage_unsafe +13 ❌ +1.08%
Token::_store_payload_in_transient_storage_unsafe +13 ❌ +1.08%
AvmTest::pedersen_commit +13 ❌ +1.02%
AvmTest::sha256_hash +39 ❌ +1.00%
Lending::repay_public +26 ❌ +0.99%
FPC::pull_funds +26 ❌ +0.98%
FPC::constructor +26 ❌ +0.97%
TokenBridge::constructor +26 ❌ +0.95%
CardGame::on_card_played +52 ❌ +0.95%
Lending::deposit_public +26 ❌ +0.94%
Lending::init +26 ❌ +0.94%
AMM::_add_liquidity +78 ❌ +0.93%
Claim::constructor +26 ❌ +0.92%
AvmTest::pedersen_hash_with_index +26 ❌ +0.84%
AvmTest::pedersen_hash +26 ❌ +0.84%
AvmTest::poseidon2_hash +13 ❌ +0.84%
StatefulTest::increment_public_value_no_init_check +13 ❌ +0.83%
AuthRegistry::set_reject_all +13 ❌ +0.83%
Test::consume_message_from_arbitrary_sender_public +65 ❌ +0.83%
AvmTest::read_storage_map +13 ❌ +0.82%
StatefulTest::get_public_value +13 ❌ +0.81%
StatefulTest::increment_public_value +13 ❌ +0.81%
AuthRegistry::is_reject_all +13 ❌ +0.80%
AvmTest::set_storage_map +13 ❌ +0.80%
PriceFeed::get_price +13 ❌ +0.80%
Benchmarking::broadcast +13 ❌ +0.79%
CardGame::start_game +52 ❌ +0.79%
NFT::_finish_transfer_to_public +13 ❌ +0.79%
Token::set_minter +13 ❌ +0.78%
Token::is_minter +13 ❌ +0.78%
NFT::set_minter +13 ❌ +0.78%
NFT::is_minter +13 ❌ +0.78%
PriceFeed::set_price +13 ❌ +0.78%
FeeJuice::balance_of_public +13 ❌ +0.76%
AvmTest::add_storage_map +13 ❌ +0.75%
AMM::_remove_liquidity +52 ❌ +0.75%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 +52 ❌ +0.75%
TokenBlacklist::balance_of_public +13 ❌ +0.73%
Token::balance_of_public +13 ❌ +0.73%
AvmTest::returndata_copy_oracle +13 ❌ +0.73%
Claim::public_dispatch +26 ❌ +0.73%
Test::consume_mint_to_public_message +78 ❌ +0.72%
EasyPrivateVoting::add_to_tally_public +13 ❌ +0.69%
TokenBridge::claim_public +78 ❌ +0.69%
AvmInitializerTest::constructor +13 ❌ +0.68%
AMM::public_dispatch +137 ❌ +0.66%
Auth::get_authorized_delay +13 ❌ +0.65%
Lending::withdraw_public +13 ❌ +0.65%
Lending::borrow_public +13 ❌ +0.65%
FeeJuice::_increase_public_balance +13 ❌ +0.64%
FeeJuice::check_balance +13 ❌ +0.62%
StaticParent::public_nested_static_call +13 ❌ +0.60%
Lending::_withdraw +52 ❌ +0.60%
FPC::pay_refund +13 ❌ +0.60%
TokenBridge::exit_to_l1_public +39 ❌ +0.60%
Benchmarking::increment_balance +13 ❌ +0.58%
Spam::public_spam +13 ❌ +0.58%
TokenBlacklist::_increase_public_balance +13 ❌ +0.56%
Token::_increase_public_balance +13 ❌ +0.56%
Child::public_dispatch +26 ❌ +0.55%
AvmInitializerTest::public_dispatch +13 ❌ +0.49%
TokenBlacklist::get_roles +13 ❌ +0.47%
Lending::_repay +26 ❌ +0.47%
Lending::update_accumulator +26 ❌ +0.47%
PriceFeed::public_dispatch +13 ❌ +0.45%
Spam::public_dispatch +13 ❌ +0.43%
AuthRegistry::consume +13 ❌ +0.43%
AppSubscription::constructor +13 ❌ +0.42%
Uniswap::swap_public +59 ❌ +0.38%
NFT::transfer_in_public +13 ❌ +0.37%
Lending::_borrow +26 ❌ +0.36%
TokenBlacklist::mint_private +13 ❌ +0.35%
NFT::constructor +13 ❌ +0.30%
Token::constructor +13 ❌ +0.30%
Token::transfer_in_public +13 ❌ +0.29%
Crowdfunding::public_dispatch +13 ❌ +0.28%
Auth::set_authorized +13 ❌ +0.26%
Auth::set_authorized_delay +13 ❌ +0.26%
AvmTest::bulk_testing +53 ❌ +0.22%
TokenBlacklist::update_roles +13 ❌ +0.20%
TokenBlacklist::constructor +13 ❌ +0.19%
Auth::public_dispatch -64 ✅ -0.68%
AuthRegistry::is_consumable -26 ✅ -1.47%
AuthRegistry::_set_authorized -26 ✅ -1.48%
AuthRegistry::set_authorized -26 ✅ -1.52%
InclusionProofs::public_dispatch -77 ✅ -1.99%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
NFT::owner_of 2,250 (+426) +23.36%
NFT::mint 2,670 (+503) +23.21%
Token::mint_to_public 2,689 (+379) +16.41%
TokenBlacklist::mint_public 4,016 (+415) +11.52%
AuthRegistry::public_dispatch 7,907 (+751) +10.49%
AuthWitTest::public_dispatch 1,650 (+149) +9.93%
Lending::public_dispatch 27,782 (+2,450) +9.67%
TokenBlacklist::transfer_public 5,949 (+500) +9.18%
Lending::get_position 4,662 (+389) +9.10%
Token::public_dispatch 32,739 (+2,596) +8.61%
TokenBlacklist::public_dispatch 24,039 (+1,725) +7.73%
TokenBlacklist::burn_public 5,401 (+379) +7.55%
TokenBlacklist::shield 6,137 (+392) +6.82%
StatefulTest::public_dispatch 6,124 (+360) +6.25%
FPC::public_dispatch 7,905 (+462) +6.21%
FeeJuice::public_dispatch 4,900 (+271) +5.85%
NFT::public_dispatch 24,129 (+1,334) +5.85%
AppSubscription::public_dispatch 4,243 (+215) +5.34%
Parent::public_dispatch 7,943 (+392) +5.19%
StaticParent::public_dispatch 5,912 (+288) +5.12%
DocsExample::public_dispatch 3,950 (+189) +5.03%
AvmTest::nested_call_to_nothing_recovers 315 (+13) +4.30%
Test::public_dispatch 18,646 (+640) +3.55%
Benchmarking::public_dispatch 3,690 (+120) +3.36%
AvmTest::public_dispatch 65,412 (+1,844) +2.90%
Uniswap::public_dispatch 24,634 (+612) +2.55%
TokenBridge::public_dispatch 20,836 (+490) +2.41%
AvmTest::keccak_hash 2,401 (+52) +2.21%
CardGame::public_dispatch 15,088 (+277) +1.87%
Test::emit_unencrypted 1,479 (+26) +1.79%
TestLog::public_dispatch 2,288 (+39) +1.73%
NFT::finalize_transfer_to_private 5,404 (+91) +1.71%
NFT::_finalize_transfer_to_private_unsafe 5,451 (+91) +1.70%
AvmTest::n_storage_writes 1,649 (+26) +1.60%
Token::finalize_mint_to_private 6,092 (+91) +1.52%
Token::_finalize_mint_to_private_unsafe 6,139 (+91) +1.50%
Auth::get_scheduled_authorized 1,811 (+26) +1.46%
Token::finalize_transfer_to_private 6,444 (+91) +1.43%
AvmTest::emit_unencrypted_log 2,777 (+39) +1.42%
Token::_finalize_transfer_to_private_unsafe 6,491 (+91) +1.42%
Crowdfunding::_publish_donation_receipts 935 (+13) +1.41%
AvmTest::get_args_hash 1,879 (+26) +1.40%
EasyPrivateVoting::public_dispatch 4,863 (+67) +1.40%
Auth::get_authorized 1,906 (+26) +1.38%
AvmTest::external_call_to_divide_by_zero_recovers 2,912 (+39) +1.36%
Token::complete_refund 6,948 (+91) +1.33%
CardGame::on_cards_claimed 7,141 (+91) +1.29%
Lending::get_asset 2,079 (+26) +1.27%
Test::create_l2_to_l1_message_public 2,210 (+26) +1.19%
ImportTest::public_dispatch 1,126 (+13) +1.17%
TestLog::emit_unencrypted_events 1,144 (+13) +1.15%
Lending::_deposit 2,398 (+26) +1.10%
Parent::public_nested_static_call 3,612 (+39) +1.09%
CardGame::on_game_joined 4,844 (+52) +1.09%
NFT::_store_payload_in_transient_storage_unsafe 1,215 (+13) +1.08%
Token::_store_payload_in_transient_storage_unsafe 1,215 (+13) +1.08%
AvmTest::pedersen_commit 1,284 (+13) +1.02%
AvmTest::sha256_hash 3,927 (+39) +1.00%
Lending::repay_public 2,659 (+26) +0.99%
FPC::pull_funds 2,677 (+26) +0.98%
FPC::constructor 2,711 (+26) +0.97%
TokenBridge::constructor 2,750 (+26) +0.95%
CardGame::on_card_played 5,541 (+52) +0.95%
Lending::deposit_public 2,789 (+26) +0.94%
Lending::init 2,789 (+26) +0.94%
AMM::_add_liquidity 8,483 (+78) +0.93%
Claim::constructor 2,846 (+26) +0.92%
AvmTest::pedersen_hash_with_index 3,103 (+26) +0.84%
AvmTest::pedersen_hash 3,103 (+26) +0.84%
AvmTest::poseidon2_hash 1,561 (+13) +0.84%
StatefulTest::increment_public_value_no_init_check 1,577 (+13) +0.83%
AuthRegistry::set_reject_all 1,582 (+13) +0.83%
Test::consume_message_from_arbitrary_sender_public 7,925 (+65) +0.83%
AvmTest::read_storage_map 1,590 (+13) +0.82%
StatefulTest::get_public_value 1,616 (+13) +0.81%
StatefulTest::increment_public_value 1,626 (+13) +0.81%
AuthRegistry::is_reject_all 1,631 (+13) +0.80%
AvmTest::set_storage_map 1,635 (+13) +0.80%
PriceFeed::get_price 1,641 (+13) +0.80%
Benchmarking::broadcast 1,650 (+13) +0.79%
CardGame::start_game 6,613 (+52) +0.79%
NFT::_finish_transfer_to_public 1,666 (+13) +0.79%
Token::set_minter 1,679 (+13) +0.78%
Token::is_minter 1,680 (+13) +0.78%
NFT::set_minter 1,684 (+13) +0.78%
NFT::is_minter 1,685 (+13) +0.78%
PriceFeed::set_price 1,685 (+13) +0.78%
FeeJuice::balance_of_public 1,729 (+13) +0.76%
AvmTest::add_storage_map 1,737 (+13) +0.75%
AMM::_remove_liquidity 6,963 (+52) +0.75%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 6,976 (+52) +0.75%
TokenBlacklist::balance_of_public 1,783 (+13) +0.73%
Token::balance_of_public 1,783 (+13) +0.73%
AvmTest::returndata_copy_oracle 1,793 (+13) +0.73%
Claim::public_dispatch 3,611 (+26) +0.73%
Test::consume_mint_to_public_message 10,886 (+78) +0.72%
EasyPrivateVoting::add_to_tally_public 1,889 (+13) +0.69%
TokenBridge::claim_public 11,406 (+78) +0.69%
AvmInitializerTest::constructor 1,923 (+13) +0.68%
AMM::public_dispatch 20,979 (+137) +0.66%
Auth::get_authorized_delay 2,009 (+13) +0.65%
Lending::withdraw_public 2,011 (+13) +0.65%
Lending::borrow_public 2,011 (+13) +0.65%
FeeJuice::_increase_public_balance 2,055 (+13) +0.64%
FeeJuice::check_balance 2,102 (+13) +0.62%
StaticParent::public_nested_static_call 2,163 (+13) +0.60%
Lending::_withdraw 8,667 (+52) +0.60%
FPC::pay_refund 2,171 (+13) +0.60%
TokenBridge::exit_to_l1_public 6,573 (+39) +0.60%
Benchmarking::increment_balance 2,238 (+13) +0.58%
Spam::public_spam 2,260 (+13) +0.58%
TokenBlacklist::_increase_public_balance 2,314 (+13) +0.56%
Token::_increase_public_balance 2,314 (+13) +0.56%
Child::public_dispatch 4,779 (+26) +0.55%
AvmInitializerTest::public_dispatch 2,681 (+13) +0.49%
TokenBlacklist::get_roles 2,756 (+13) +0.47%
Lending::_repay 5,522 (+26) +0.47%
Lending::update_accumulator 5,573 (+26) +0.47%
PriceFeed::public_dispatch 2,895 (+13) +0.45%
Spam::public_dispatch 3,041 (+13) +0.43%
AuthRegistry::consume 3,062 (+13) +0.43%
AppSubscription::constructor 3,100 (+13) +0.42%
Uniswap::swap_public 15,584 (+59) +0.38%
NFT::transfer_in_public 3,571 (+13) +0.37%
Lending::_borrow 7,269 (+26) +0.36%
TokenBlacklist::mint_private 3,767 (+13) +0.35%
NFT::constructor 4,304 (+13) +0.30%
Token::constructor 4,379 (+13) +0.30%
Token::transfer_in_public 4,451 (+13) +0.29%
Crowdfunding::public_dispatch 4,620 (+13) +0.28%
Auth::set_authorized 4,966 (+13) +0.26%
Auth::set_authorized_delay 5,062 (+13) +0.26%
AvmTest::bulk_testing 23,859 (+53) +0.22%
TokenBlacklist::update_roles 6,572 (+13) +0.20%
TokenBlacklist::constructor 6,839 (+13) +0.19%
Auth::public_dispatch 9,397 (-64) -0.68%
AuthRegistry::is_consumable 1,740 (-26) -1.47%
AuthRegistry::_set_authorized 1,733 (-26) -1.48%
AuthRegistry::set_authorized 1,686 (-26) -1.52%
InclusionProofs::public_dispatch 3,802 (-77) -1.99%

Copy link
Contributor

github-actions bot commented Jan 9, 2025

Changes to circuit sizes

Generated at commit: f1e095085fc92f4b5abe570ed135a9bb3647efab, compared to commit: a66349fa2b60fb397008cd7e0571cc3a3e5fae02

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_base_private +392,647 ❌ +238.79% +410,711 ❌ +22.67%
private_kernel_init +5,333 ❌ +23.57% +6,178 ❌ +14.57%
rollup_base_public +443,187 ❌ +109.10% +439,041 ❌ +13.26%
private_kernel_inner +7,714 ❌ +20.00% +8,218 ❌ +10.16%
private_kernel_tail_to_public +2,112 ❌ +14.85% +2,564 ❌ +6.35%
rollup_block_root_single_tx +135,233 ❌ +23.22% +174,196 ❌ +5.32%
rollup_block_root +135,246 ❌ +23.16% +174,212 ❌ +4.14%
private_kernel_reset_0_0_64_0_0_0_0_0_0 +588 ❌ +4.69% +603 ❌ +1.66%
private_kernel_reset_64_0_0_0_0_0_0_0_0 +588 ❌ +4.69% +603 ❌ +1.66%
private_kernel_tail +148 ❌ +2.98% +164 ❌ +0.60%
rollup_block_merge +7,118 ❌ +22.69% +7,625 ❌ +0.39%
private_kernel_reset_32_4_32_4_4_4_64_64_32 +3,499 ❌ +7.94% +372 ❌ +0.27%
private_kernel_reset_0_0_0_0_64_0_0_0_0 +205 ❌ +1.35% +252 ❌ +0.26%
private_kernel_reset_0_64_0_0_0_0_0_0_0 +588 ❌ +2.00% +603 ❌ +0.23%
private_kernel_reset_0_0_0_64_0_0_0_0_0 +588 ❌ +1.91% +603 ❌ +0.22%
private_kernel_reset_32_16_32_4_4_4_64_64_32 +3,499 ❌ +7.34% +372 ❌ +0.21%
private_kernel_reset_32_4_32_16_4_4_64_64_32 +3,499 ❌ +7.31% +372 ❌ +0.21%
private_kernel_reset_32_16_32_16_4_4_64_64_32 +3,499 ❌ +6.80% +372 ❌ +0.17%
private_kernel_reset_32_4_32_4_4_4_64_64_4 +3,331 ❌ +8.32% +162 ❌ +0.12%
private_kernel_reset_32_4_32_4_4_4_4_64_32 +3,319 ❌ +7.98% +146 ❌ +0.12%
private_kernel_reset_32_4_32_4_4_4_64_4_32 +3,319 ❌ +7.86% +146 ❌ +0.11%
private_kernel_reset_32_16_32_4_4_4_64_64_4 +3,331 ❌ +7.64% +162 ❌ +0.09%
private_kernel_reset_32_4_32_16_4_4_64_64_4 +3,331 ❌ +7.60% +162 ❌ +0.09%
private_kernel_reset_32_16_32_4_4_4_4_64_32 +3,319 ❌ +7.34% +146 ❌ +0.09%
private_kernel_reset_32_4_32_16_4_4_4_64_32 +3,319 ❌ +7.30% +146 ❌ +0.09%
private_kernel_reset_32_16_32_4_4_4_64_4_32 +3,319 ❌ +7.25% +146 ❌ +0.08%
private_kernel_reset_32_4_32_16_4_4_64_4_32 +3,319 ❌ +7.21% +146 ❌ +0.08%
private_kernel_reset_32_16_32_16_4_4_64_64_4 +3,331 ❌ +7.02% +162 ❌ +0.07%
private_kernel_reset_32_16_32_16_4_4_4_64_32 +3,319 ❌ +6.77% +146 ❌ +0.07%
private_kernel_reset_32_16_32_16_4_4_64_4_32 +3,319 ❌ +6.69% +146 ❌ +0.07%
parity_base +18 ❌ +0.51% +20 ❌ +0.07%
rollup_root +7,118 ❌ +22.70% +7,625 ❌ +0.05%
rollup_merge +13 ❌ +0.72% +15 ❌ +0.00%
parity_root +18 ❌ +0.42% +20 ❌ +0.00%
rollup_block_root_empty +4 ❌ +0.19% +4 ❌ +0.00%
private_kernel_reset_32_16_32_16_4_4_64_4_4 +3,151 ❌ +6.91% -63 ✅ -0.03%
private_kernel_reset_32_16_32_16_4_4_4_64_4 +3,151 ❌ +7.00% -63 ✅ -0.03%
private_kernel_reset_32_4_32_16_4_4_64_4_4 +3,151 ❌ +7.50% -63 ✅ -0.04%
private_kernel_reset_32_16_32_4_4_4_64_4_4 +3,151 ❌ +7.55% -63 ✅ -0.04%
private_kernel_reset_32_16_32_16_4_4_4_4_32 +3,139 ❌ +6.65% -78 ✅ -0.04%
private_kernel_reset_32_4_32_16_4_4_4_64_4 +3,151 ❌ +7.61% -63 ✅ -0.04%
private_kernel_reset_32_16_32_4_4_4_4_64_4 +3,151 ❌ +7.66% -63 ✅ -0.04%
private_kernel_reset_32_4_32_16_4_4_4_4_32 +3,139 ❌ +7.20% -78 ✅ -0.05%
private_kernel_reset_32_16_32_4_4_4_4_4_32 +3,139 ❌ +7.24% -78 ✅ -0.05%
private_kernel_reset_32_4_32_4_4_4_64_4_4 +3,151 ❌ +8.25% -63 ✅ -0.05%
private_kernel_reset_32_4_32_4_4_4_4_64_4 +3,151 ❌ +8.39% -63 ✅ -0.06%
private_kernel_reset_16_16_16_16_16_16_16_16_16 +3,196 ❌ +6.86% -127 ✅ -0.06%
private_kernel_reset_32_32_32_32_32_32_32_32_32 +3,400 ❌ +5.31% -216 ✅ -0.06%
private_kernel_reset_32_4_32_4_4_4_4_4_32 +3,139 ❌ +7.90% -78 ✅ -0.07%
private_kernel_reset_32_16_32_16_4_4_4_4_4 +2,971 ❌ +6.89% -288 ✅ -0.15%
private_kernel_reset_32_4_32_16_4_4_4_4_4 +2,971 ❌ +7.51% -288 ✅ -0.19%
private_kernel_reset_32_16_32_4_4_4_4_4_4 +2,971 ❌ +7.56% -288 ✅ -0.19%
private_kernel_reset +3,332 ❌ +3.53% -1,610 ✅ -0.25%
private_kernel_reset_32_4_32_4_4_4_4_4_4 +2,971 ❌ +8.32% -288 ✅ -0.27%
private_kernel_reset_4_4_4_4_4_4_4_4_4 +2,971 ❌ +8.83% -288 ✅ -0.27%
private_kernel_reset_0_0_0_0_0_64_0_0_0 +1,009 ❌ +3.50% -4,251 ✅ -6.63%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_base_private 557,082 (+392,647) +238.79% 2,222,732 (+410,711) +22.67%
private_kernel_init 27,955 (+5,333) +23.57% 48,587 (+6,178) +14.57%
rollup_base_public 849,413 (+443,187) +109.10% 3,749,002 (+439,041) +13.26%
private_kernel_inner 46,278 (+7,714) +20.00% 89,087 (+8,218) +10.16%
private_kernel_tail_to_public 16,334 (+2,112) +14.85% 42,933 (+2,564) +6.35%
rollup_block_root_single_tx 717,700 (+135,233) +23.22% 3,449,456 (+174,196) +5.32%
rollup_block_root 719,213 (+135,246) +23.16% 4,379,529 (+174,212) +4.14%
private_kernel_reset_0_0_64_0_0_0_0_0_0 13,113 (+588) +4.69% 36,895 (+603) +1.66%
private_kernel_reset_64_0_0_0_0_0_0_0_0 13,113 (+588) +4.69% 36,895 (+603) +1.66%
private_kernel_tail 5,121 (+148) +2.98% 27,274 (+164) +0.60%
rollup_block_merge 38,484 (+7,118) +22.69% 1,962,784 (+7,625) +0.39%
private_kernel_reset_32_4_32_4_4_4_64_64_32 47,571 (+3,499) +7.94% 136,827 (+372) +0.27%
private_kernel_reset_0_0_0_0_64_0_0_0_0 15,343 (+205) +1.35% 97,089 (+252) +0.26%
private_kernel_reset_0_64_0_0_0_0_0_0_0 30,009 (+588) +2.00% 262,749 (+603) +0.23%
private_kernel_reset_0_0_0_64_0_0_0_0_0 31,355 (+588) +1.91% 274,495 (+603) +0.22%
private_kernel_reset_32_16_32_4_4_4_64_64_32 51,159 (+3,499) +7.34% 179,613 (+372) +0.21%
private_kernel_reset_32_4_32_16_4_4_64_64_32 51,395 (+3,499) +7.31% 181,775 (+372) +0.21%
private_kernel_reset_32_16_32_16_4_4_64_64_32 54,983 (+3,499) +6.80% 224,561 (+372) +0.17%
private_kernel_reset_32_4_32_4_4_4_64_64_4 43,362 (+3,331) +8.32% 130,804 (+162) +0.12%
private_kernel_reset_32_4_32_4_4_4_4_64_32 44,933 (+3,319) +7.98% 120,493 (+146) +0.12%
private_kernel_reset_32_4_32_4_4_4_64_4_32 45,534 (+3,319) +7.86% 130,036 (+146) +0.11%
private_kernel_reset_32_16_32_4_4_4_64_64_4 46,950 (+3,331) +7.64% 173,590 (+162) +0.09%
private_kernel_reset_32_4_32_16_4_4_64_64_4 47,186 (+3,331) +7.60% 175,752 (+162) +0.09%
private_kernel_reset_32_16_32_4_4_4_4_64_32 48,521 (+3,319) +7.34% 163,279 (+146) +0.09%
private_kernel_reset_32_4_32_16_4_4_4_64_32 48,757 (+3,319) +7.30% 165,441 (+146) +0.09%
private_kernel_reset_32_16_32_4_4_4_64_4_32 49,122 (+3,319) +7.25% 172,822 (+146) +0.08%
private_kernel_reset_32_4_32_16_4_4_64_4_32 49,358 (+3,319) +7.21% 174,984 (+146) +0.08%
private_kernel_reset_32_16_32_16_4_4_64_64_4 50,774 (+3,331) +7.02% 218,538 (+162) +0.07%
private_kernel_reset_32_16_32_16_4_4_4_64_32 52,345 (+3,319) +6.77% 208,227 (+146) +0.07%
private_kernel_reset_32_16_32_16_4_4_64_4_32 52,946 (+3,319) +6.69% 217,770 (+146) +0.07%
parity_base 3,557 (+18) +0.51% 29,954 (+20) +0.07%
rollup_root 38,468 (+7,118) +22.70% 14,601,783 (+7,625) +0.05%
rollup_merge 1,821 (+13) +0.72% 1,800,379 (+15) +0.00%
parity_root 4,290 (+18) +0.42% 3,487,877 (+20) +0.00%
rollup_block_root_empty 2,058 (+4) +0.19% 880,479 (+4) +0.00%
private_kernel_reset_32_16_32_16_4_4_64_4_4 48,737 (+3,151) +6.91% 211,747 (-63) -0.03%
private_kernel_reset_32_16_32_16_4_4_4_64_4 48,136 (+3,151) +7.00% 202,204 (-63) -0.03%
private_kernel_reset_32_4_32_16_4_4_64_4_4 45,149 (+3,151) +7.50% 168,961 (-63) -0.04%
private_kernel_reset_32_16_32_4_4_4_64_4_4 44,913 (+3,151) +7.55% 166,799 (-63) -0.04%
private_kernel_reset_32_16_32_16_4_4_4_4_32 50,308 (+3,139) +6.65% 201,437 (-78) -0.04%
private_kernel_reset_32_4_32_16_4_4_4_64_4 44,548 (+3,151) +7.61% 159,418 (-63) -0.04%
private_kernel_reset_32_16_32_4_4_4_4_64_4 44,312 (+3,151) +7.66% 157,256 (-63) -0.04%
private_kernel_reset_32_4_32_16_4_4_4_4_32 46,720 (+3,139) +7.20% 158,651 (-78) -0.05%
private_kernel_reset_32_16_32_4_4_4_4_4_32 46,484 (+3,139) +7.24% 156,489 (-78) -0.05%
private_kernel_reset_32_4_32_4_4_4_64_4_4 41,325 (+3,151) +8.25% 124,013 (-63) -0.05%
private_kernel_reset_32_4_32_4_4_4_4_64_4 40,724 (+3,151) +8.39% 114,470 (-63) -0.06%
private_kernel_reset_16_16_16_16_16_16_16_16_16 49,811 (+3,196) +6.86% 214,450 (-127) -0.06%
private_kernel_reset_32_32_32_32_32_32_32_32_32 67,396 (+3,400) +5.31% 360,369 (-216) -0.06%
private_kernel_reset_32_4_32_4_4_4_4_4_32 42,896 (+3,139) +7.90% 113,703 (-78) -0.07%
private_kernel_reset_32_16_32_16_4_4_4_4_4 46,099 (+2,971) +6.89% 195,413 (-288) -0.15%
private_kernel_reset_32_4_32_16_4_4_4_4_4 42,511 (+2,971) +7.51% 152,627 (-288) -0.19%
private_kernel_reset_32_16_32_4_4_4_4_4_4 42,275 (+2,971) +7.56% 150,465 (-288) -0.19%
private_kernel_reset 97,779 (+3,332) +3.53% 645,994 (-1,610) -0.25%
private_kernel_reset_32_4_32_4_4_4_4_4_4 38,687 (+2,971) +8.32% 107,679 (-288) -0.27%
private_kernel_reset_4_4_4_4_4_4_4_4_4 36,615 (+2,971) +8.83% 105,005 (-288) -0.27%
private_kernel_reset_0_0_0_0_0_64_0_0_0 29,820 (+1,009) +3.50% 59,893 (-4,251) -6.63%

Comment on lines 116 to 133
this.keys = accountKeys;
const accountManagers = accountKeys.map(ak => getSchnorrAccount(pxe, ak[0], ak[1], SALT));
this.wallets = await Promise.all(accountManagers.map(a => a.getWallet()));
this.accounts = await pxe.getRegisteredAccounts();

// This Map and loop ensure that this.accounts has the same order as this.wallets and this.keys
const registeredAccounts: Map<string, CompleteAddress> = new Map(
(await pxe.getRegisteredAccounts()).map(acc => [acc.address.toString(), acc]),
);
for (let i = 0; i < this.wallets.length; i++) {
const wallet = this.wallets[i];
const walletAddr = wallet.getAddress().toString();
assert(
registeredAccounts.has(walletAddr),
`Test account ${walletAddr} not registered, but it should have been`,
);
this.accounts.push(registeredAccounts.get(walletAddr)!);
}
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to do something like this instead of what I had done here dcb4cb4 because it is later assumed that this.wallets and this.accounts are in the same order as this.keys. @spalladino there are many places throughout our tests where we do this

this.wallets = await Promise.all(accountManagers.map(a => a.getWallet()));
this.accounts = await pxe.getRegisteredAccounts();

Even if all tests pass, I wouldn't be surprised if we run into issues/flakes down the line because of ordering mismatches in other tests. So, my questions are:

  1. Why did this just start happening now? I guess before this PR, pxe.getRegisteredAccounts() was always matching the order of the account keys as returned from addAccounts. It's not clear to me why pxe.getRegisteredAccounts() order would no longer match after my changeset.
  2. Should something change in the PXE/elsewhere to make sure that these orders match? Or should I just create a test helper function for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved it into a helper for now

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't think of a reason why this is happening now. But I think the easiest thing is to not get the registered accounts from the pxe but from the account managers themselves, so we ensure the order is the same. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll try that!

@dbanks12 dbanks12 merged commit 7176a70 into master Jan 10, 2025
77 checks passed
@dbanks12 dbanks12 deleted the db/enforce-class-registered branch January 10, 2025 20:17
dbanks12 added a commit that referenced this pull request Jan 10, 2025
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. e2e-prover-full CI: Enables this CI job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contract deployment should check membership of contract class ID
2 participants