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: prover escrow and 712-signed quotes #8877

Merged
merged 7 commits into from
Oct 1, 2024
Merged

Conversation

just-mitch
Copy link
Contributor

@just-mitch just-mitch commented Sep 29, 2024

Fix #8573

Introduces an escrow contract that is able to store test tokens from provers.

The implementation allows the rollup contract to stake deposited bonds, and unstake them.

Provers may initiate withdraws which are not executable until 3 epochs after their initiation.

Proposers will use the minBalanceAtTime function to ensure that a prover has sufficient funds at the slot they would "cash in" the quote.

Additionally, the signatures used on the epoch proof quotes have been updated to use EIP 712 style signing and verification as part of the proof claim process.

Other cleanup includes:

  • Consolidating the erc20 token used in tests to TestERC20
  • Fixing a bug in the publisher
  • Enabling the e2e prover coordination test in ci

Future work includes:

  1. Deploying the escrow along with the rollup.
  2. Configuring provers to deposit funds.
  3. Having the rollup actually use the escrow.

@just-mitch just-mitch marked this pull request as ready for review September 29, 2024 16:01
@just-mitch just-mitch changed the title Mt/8573 prover escrow feat: prover escrow and 712-signed quotes Sep 29, 2024
Copy link
Contributor

github-actions bot commented Sep 29, 2024

Changes to public function bytecode sizes

Generated at commit: d802d449e67e89437394d0f8a7a080d2e0294de2, compared to commit: dda528a2f1ca1a52ce08f6175b594f6567fc370e

🧾 Summary (100% most significant diffs)

Program Bytecode size in bytes (+/-) %
AvmTest::pedersen_commit +1,115 ❌ +318.57%
AvmTest::read_storage_map +945 ❌ +52.01%
StatefulTest::get_public_value +935 ❌ +51.15%
AuthRegistry::is_reject_all +940 ❌ +51.14%
PriceFeed::get_price +940 ❌ +50.56%
Benchmarking::broadcast +940 ❌ +50.05%
NFT::is_minter +940 ❌ +49.79%
Token::is_minter +935 ❌ +49.52%
FeeJuice::balance_of_public +940 ❌ +48.96%
StatefulTest::increment_public_value_no_init_check +940 ❌ +48.28%
TokenBlacklist::balance_of_public +940 ❌ +47.72%
Token::balance_of_public +940 ❌ +47.72%
StatefulTest::increment_public_value +940 ❌ +47.19%
AuthRegistry::set_reject_all +811 ❌ +46.91%
NFT::set_minter +945 ❌ +46.69%
Token::set_minter +935 ❌ +46.20%
NFT::_finish_transfer_to_public +816 ❌ +45.61%
Lending::get_asset +945 ❌ +45.48%
PriceFeed::set_price +811 ❌ +44.73%
FeeJuice::check_balance +935 ❌ +42.91%
AvmTest::set_storage_map +1,101 ❌ +39.27%
Lending::_deposit +968 ❌ +39.05%
AvmTest::nested_call_to_add_with_gas +140 ❌ +38.57%
Token::assert_minter_and_mint +945 ❌ +38.45%
AuthRegistry::is_consumable +1,166 ❌ +38.34%
NFT::owner_of +1,176 ❌ +35.81%
AuthRegistry::set_authorized +1,042 ❌ +35.60%
AuthRegistry::_set_authorized +1,042 ❌ +35.27%
FeeJuice::_increase_public_balance +1,171 ❌ +35.04%
TokenBlacklist::_increase_public_balance +1,176 ❌ +34.72%
Token::_increase_public_balance +1,176 ❌ +34.72%
AvmTest::add_storage_map +1,461 ❌ +34.69%
EasyPrivateVoting::add_to_tally_public +1,166 ❌ +34.40%
Spam::public_spam +1,166 ❌ +34.33%
Lending::init +935 ❌ +33.78%
StaticParent::public_get_value_from_child +112 ❌ +31.20%
AvmTest::nested_static_call_to_add +112 ❌ +29.95%
AvmTest::nested_call_to_add +112 ❌ +29.95%
NFT::mint +1,638 ❌ +27.54%
DocsExample::get_shared_immutable_constrained_public_indirect +112 ❌ +27.52%
Benchmarking::increment_balance +1,010 ❌ +27.34%
Token::mint_public +1,407 ❌ +26.77%
Spam::public_dispatch +1,213 ❌ +26.59%
Parent::pub_entry_point_twice +140 ❌ +25.83%
PriceFeed::public_dispatch +1,274 ❌ +25.82%
Uniswap::_assert_token_is_same +112 ❌ +25.23%
AuthRegistry::consume +1,869 ❌ +22.63%
Token::mint_private +940 ❌ +21.43%
CardGame::on_game_joined +1,004 ❌ +21.06%
NFT::transfer_in_public +1,039 ❌ +20.49%
Benchmarking::public_dispatch +1,330 ❌ +19.75%
Parent::pub_entry_point +70 ❌ +19.02%
StaticParent::public_call +70 ❌ +19.02%
Lending::_repay +1,758 ❌ +18.78%
Token::transfer_public +1,732 ❌ +18.73%
Token::burn_public +1,270 ❌ +18.60%
Lending::get_position +1,417 ❌ +18.60%
FeeJuice::public_dispatch +1,815 ❌ +18.38%
AuthRegistry::public_dispatch +4,011 ❌ +17.25%
CardGame::on_card_played +1,018 ❌ +17.23%
AuthWitTest::consume_public +70 ❌ +16.63%
Lending::_borrow +2,333 ❌ +15.72%
EasyPrivateVoting::public_dispatch +1,415 ❌ +15.42%
Token::shield +1,265 ❌ +15.06%
Lending::public_dispatch +11,125 ❌ +14.73%
CardGame::start_game +1,028 ❌ +14.11%
NFT::constructor +1,008 ❌ +13.81%
Parent::public_static_call +70 ❌ +13.33%
StaticParent::public_static_call +70 ❌ +13.33%
Token::constructor +1,008 ❌ +12.94%
StatefulTest::public_dispatch +1,505 ❌ +12.33%
TokenBlacklist::transfer_public +1,890 ❌ +11.80%
StaticParent::public_nested_static_call +126 ❌ +11.72%
TokenBlacklist::mint_public +1,166 ❌ +11.07%
Token::public_dispatch +7,201 ❌ +11.04%
TokenBlacklist::burn_public +1,150 ❌ +10.82%
StaticParent::public_dispatch +728 ❌ +10.52%
Lending::_withdraw +1,320 ❌ +10.35%
NFT::public_dispatch +4,053 ❌ +10.34%
TokenBlacklist::get_roles +431 ❌ +10.33%
TokenBlacklist::shield +1,211 ❌ +9.98%
TokenBlacklist::public_dispatch +12,718 ❌ +9.55%
AvmTest::nested_static_call_to_set_storage +28 ❌ +8.72%
ImportTest::pub_call_public_fn +28 ❌ +8.70%
AvmTest::public_dispatch +7,672 ❌ +8.56%
AvmTest::create_same_nullifier_in_nested_call +28 ❌ +8.51%
Child::set_value_with_two_nested_calls +56 ❌ +8.50%
NFT::finalize_transfer_to_private +466 ❌ +8.34%
AvmTest::create_different_nullifier_in_nested_call +28 ❌ +8.24%
FPC::pay_refund_with_shielded_rebate +98 ❌ +7.83%
Lending::update_accumulator +980 ❌ +7.64%
Lending::repay_public +98 ❌ +7.61%
Child::public_dispatch +364 ❌ +7.40%
TokenBlacklist::mint_private +487 ❌ +7.34%
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%
TokenBlacklist::constructor +998 ❌ +6.12%
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::bulk_testing +1,713 ❌ +5.45%
Uniswap::public_dispatch +1,708 ❌ +5.33%
TokenBlacklist::update_roles +864 ❌ +5.31%
Uniswap::swap_public +728 ❌ +5.08%
ImportTest::public_dispatch +70 ❌ +5.07%
CardGame::on_cards_claimed +369 ❌ +4.94%
Child::set_value_twice_with_nested_first +28 ❌ +4.91%
Child::set_value_twice_with_nested_last +28 ❌ +4.91%
Lending::withdraw_public +42 ❌ +4.52%
Lending::borrow_public +42 ❌ +4.52%
DelegatedOn::public_dispatch +56 ❌ +4.46%
FPC::public_dispatch +469 ❌ +4.29%
Token::complete_refund +140 ❌ +4.17%
Delegator::public_dispatch +84 ❌ +4.15%
Crowdfunding::public_dispatch +336 ❌ +4.12%
Test::public_dispatch +1,274 ❌ +3.88%
CardGame::public_dispatch +1,086 ❌ +3.86%
AvmTest::test_get_contract_instance_raw +14 ❌ +3.84%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 +336 ❌ +3.79%
TestLog::public_dispatch +126 ❌ +3.65%
Router::public_dispatch +140 ❌ +3.64%
TokenBridge::_call_mint_on_token +28 ❌ +3.63%
InclusionProofs::public_dispatch +196 ❌ +3.48%
Auth::public_dispatch +1,120 ❌ +3.45%
AvmTest::assert_calldata_copy +14 ❌ +3.28%
AvmTest::variable_base_msm +14 ❌ +3.17%
TokenBridge::public_dispatch +917 ❌ +2.92%
TokenBridge::exit_to_l1_public +224 ❌ +2.89%
AvmTest::emit_unencrypted_log +84 ❌ +2.87%
StatefulTest::public_constructor +112 ❌ +2.65%
TokenBridge::claim_public +378 ❌ +2.60%
Test::consume_mint_public_message +336 ❌ +2.51%
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%
Auth::set_authorized_delay +266 ❌ +2.33%
Auth::set_authorized +266 ❌ +2.29%
PrivateFPC::public_dispatch +112 ❌ +2.16%
Test::consume_message_from_arbitrary_sender_public +182 ❌ +2.10%
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%
InclusionProofs::constructor +70 ❌ +1.88%
Test::create_l2_to_l1_message_public +42 ❌ +1.80%
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%
Auth::get_scheduled_authorized +42 ❌ +1.60%
EasyPrivateVoting::constructor +70 ❌ +1.59%
Claim::constructor +70 ❌ +1.55%
Auth::get_authorized +42 ❌ +1.54%
Auth::get_authorized_delay +42 ❌ +1.41%
AppSubscription::public_dispatch +112 ❌ +1.40%
Crowdfunding::init +70 ❌ +1.38%
TestLog::emit_unencrypted_events +28 ❌ +1.31%
AvmTest::pedersen_hash_with_index +42 ❌ +1.23%
AvmTest::pedersen_hash +42 ❌ +1.23%
AppSubscription::constructor +70 ❌ +1.16%
Crowdfunding::_publish_donation_receipts +14 ❌ +1.10%
AvmTest::u128_addition_overflow +14 ❌ +1.03%
AvmTest::get_args_hash +14 ❌ +0.86%
AvmTest::keccak_hash +14 ❌ +0.51%

Full diff report 👇
Program Bytecode size in bytes (+/-) %
AvmTest::pedersen_commit 1,465 (+1,115) +318.57%
AvmTest::read_storage_map 2,762 (+945) +52.01%
StatefulTest::get_public_value 2,763 (+935) +51.15%
AuthRegistry::is_reject_all 2,778 (+940) +51.14%
PriceFeed::get_price 2,799 (+940) +50.56%
Benchmarking::broadcast 2,818 (+940) +50.05%
NFT::is_minter 2,828 (+940) +49.79%
Token::is_minter 2,823 (+935) +49.52%
FeeJuice::balance_of_public 2,860 (+940) +48.96%
StatefulTest::increment_public_value_no_init_check 2,887 (+940) +48.28%
TokenBlacklist::balance_of_public 2,910 (+940) +47.72%
Token::balance_of_public 2,910 (+940) +47.72%
StatefulTest::increment_public_value 2,932 (+940) +47.19%
AuthRegistry::set_reject_all 2,540 (+811) +46.91%
NFT::set_minter 2,969 (+945) +46.69%
Token::set_minter 2,959 (+935) +46.20%
NFT::_finish_transfer_to_public 2,605 (+816) +45.61%
Lending::get_asset 3,023 (+945) +45.48%
PriceFeed::set_price 2,624 (+811) +44.73%
FeeJuice::check_balance 3,114 (+935) +42.91%
AvmTest::set_storage_map 3,905 (+1,101) +39.27%
Lending::_deposit 3,447 (+968) +39.05%
AvmTest::nested_call_to_add_with_gas 503 (+140) +38.57%
Token::assert_minter_and_mint 3,403 (+945) +38.45%
AuthRegistry::is_consumable 4,207 (+1,166) +38.34%
NFT::owner_of 4,460 (+1,176) +35.81%
AuthRegistry::set_authorized 3,969 (+1,042) +35.60%
AuthRegistry::_set_authorized 3,996 (+1,042) +35.27%
FeeJuice::_increase_public_balance 4,513 (+1,171) +35.04%
TokenBlacklist::_increase_public_balance 4,563 (+1,176) +34.72%
Token::_increase_public_balance 4,563 (+1,176) +34.72%
AvmTest::add_storage_map 5,673 (+1,461) +34.69%
EasyPrivateVoting::add_to_tally_public 4,556 (+1,166) +34.40%
Spam::public_spam 4,562 (+1,166) +34.33%
Lending::init 3,703 (+935) +33.78%
StaticParent::public_get_value_from_child 471 (+112) +31.20%
AvmTest::nested_static_call_to_add 486 (+112) +29.95%
AvmTest::nested_call_to_add 486 (+112) +29.95%
NFT::mint 7,586 (+1,638) +27.54%
DocsExample::get_shared_immutable_constrained_public_indirect 519 (+112) +27.52%
Benchmarking::increment_balance 4,704 (+1,010) +27.34%
Token::mint_public 6,663 (+1,407) +26.77%
Spam::public_dispatch 5,775 (+1,213) +26.59%
Parent::pub_entry_point_twice 682 (+140) +25.83%
PriceFeed::public_dispatch 6,209 (+1,274) +25.82%
Uniswap::_assert_token_is_same 556 (+112) +25.23%
AuthRegistry::consume 10,127 (+1,869) +22.63%
Token::mint_private 5,327 (+940) +21.43%
CardGame::on_game_joined 5,771 (+1,004) +21.06%
NFT::transfer_in_public 6,110 (+1,039) +20.49%
Benchmarking::public_dispatch 8,064 (+1,330) +19.75%
Parent::pub_entry_point 438 (+70) +19.02%
StaticParent::public_call 438 (+70) +19.02%
Lending::_repay 11,120 (+1,758) +18.78%
Token::transfer_public 10,981 (+1,732) +18.73%
Token::burn_public 8,098 (+1,270) +18.60%
Lending::get_position 9,037 (+1,417) +18.60%
FeeJuice::public_dispatch 11,690 (+1,815) +18.38%
AuthRegistry::public_dispatch 27,262 (+4,011) +17.25%
CardGame::on_card_played 6,926 (+1,018) +17.23%
AuthWitTest::consume_public 491 (+70) +16.63%
Lending::_borrow 17,171 (+2,333) +15.72%
EasyPrivateVoting::public_dispatch 10,592 (+1,415) +15.42%
Token::shield 9,662 (+1,265) +15.06%
Lending::public_dispatch 86,649 (+11,125) +14.73%
CardGame::start_game 8,313 (+1,028) +14.11%
NFT::constructor 8,307 (+1,008) +13.81%
Parent::public_static_call 595 (+70) +13.33%
StaticParent::public_static_call 595 (+70) +13.33%
Token::constructor 8,796 (+1,008) +12.94%
StatefulTest::public_dispatch 13,711 (+1,505) +12.33%
TokenBlacklist::transfer_public 17,903 (+1,890) +11.80%
StaticParent::public_nested_static_call 1,201 (+126) +11.72%
TokenBlacklist::mint_public 11,695 (+1,166) +11.07%
Token::public_dispatch 72,424 (+7,201) +11.04%
TokenBlacklist::burn_public 11,774 (+1,150) +10.82%
StaticParent::public_dispatch 7,649 (+728) +10.52%
Lending::_withdraw 14,074 (+1,320) +10.35%
NFT::public_dispatch 43,264 (+4,053) +10.34%
TokenBlacklist::get_roles 4,605 (+431) +10.33%
TokenBlacklist::shield 13,343 (+1,211) +9.98%
TokenBlacklist::public_dispatch 145,847 (+12,718) +9.55%
AvmTest::nested_static_call_to_set_storage 349 (+28) +8.72%
ImportTest::pub_call_public_fn 350 (+28) +8.70%
AvmTest::public_dispatch 97,334 (+7,672) +8.56%
AvmTest::create_same_nullifier_in_nested_call 357 (+28) +8.51%
Child::set_value_with_two_nested_calls 715 (+56) +8.50%
NFT::finalize_transfer_to_private 6,051 (+466) +8.34%
AvmTest::create_different_nullifier_in_nested_call 368 (+28) +8.24%
FPC::pay_refund_with_shielded_rebate 1,350 (+98) +7.83%
Lending::update_accumulator 13,801 (+980) +7.64%
Lending::repay_public 1,386 (+98) +7.61%
Child::public_dispatch 5,286 (+364) +7.40%
TokenBlacklist::mint_private 7,118 (+487) +7.34%
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%
TokenBlacklist::constructor 17,304 (+998) +6.12%
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::bulk_testing 33,171 (+1,713) +5.45%
Uniswap::public_dispatch 33,727 (+1,708) +5.33%
TokenBlacklist::update_roles 17,148 (+864) +5.31%
Uniswap::swap_public 15,070 (+728) +5.08%
ImportTest::public_dispatch 1,452 (+70) +5.07%
CardGame::on_cards_claimed 7,844 (+369) +4.94%
Child::set_value_twice_with_nested_first 598 (+28) +4.91%
Child::set_value_twice_with_nested_last 598 (+28) +4.91%
Lending::withdraw_public 971 (+42) +4.52%
Lending::borrow_public 971 (+42) +4.52%
DelegatedOn::public_dispatch 1,312 (+56) +4.46%
FPC::public_dispatch 11,400 (+469) +4.29%
Token::complete_refund 3,496 (+140) +4.17%
Delegator::public_dispatch 2,109 (+84) +4.15%
Crowdfunding::public_dispatch 8,499 (+336) +4.12%
Test::public_dispatch 34,124 (+1,274) +3.88%
CardGame::public_dispatch 29,242 (+1,086) +3.86%
AvmTest::test_get_contract_instance_raw 379 (+14) +3.84%
Uniswap::_approve_bridge_and_exit_input_asset_to_L1 9,207 (+336) +3.79%
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%
InclusionProofs::public_dispatch 5,826 (+196) +3.48%
Auth::public_dispatch 33,597 (+1,120) +3.45%
AvmTest::assert_calldata_copy 441 (+14) +3.28%
AvmTest::variable_base_msm 456 (+14) +3.17%
TokenBridge::public_dispatch 32,360 (+917) +2.92%
TokenBridge::exit_to_l1_public 7,985 (+224) +2.89%
AvmTest::emit_unencrypted_log 3,011 (+84) +2.87%
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%
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%
Auth::set_authorized_delay 11,688 (+266) +2.33%
Auth::set_authorized 11,884 (+266) +2.29%
PrivateFPC::public_dispatch 5,306 (+112) +2.16%
Test::consume_message_from_arbitrary_sender_public 8,838 (+182) +2.10%
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%
InclusionProofs::constructor 3,785 (+70) +1.88%
Test::create_l2_to_l1_message_public 2,372 (+42) +1.80%
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%
Auth::get_scheduled_authorized 2,666 (+42) +1.60%
EasyPrivateVoting::constructor 4,460 (+70) +1.59%
Claim::constructor 4,575 (+70) +1.55%
Auth::get_authorized 2,762 (+42) +1.54%
Auth::get_authorized_delay 3,027 (+42) +1.41%
AppSubscription::public_dispatch 8,102 (+112) +1.40%
Crowdfunding::init 5,149 (+70) +1.38%
TestLog::emit_unencrypted_events 2,158 (+28) +1.31%
AvmTest::pedersen_hash_with_index 3,443 (+42) +1.23%
AvmTest::pedersen_hash 3,443 (+42) +1.23%
AppSubscription::constructor 6,091 (+70) +1.16%
Crowdfunding::_publish_donation_receipts 1,290 (+14) +1.10%
AvmTest::u128_addition_overflow 1,371 (+14) +1.03%
AvmTest::get_args_hash 1,646 (+14) +0.86%
AvmTest::keccak_hash 2,733 (+14) +0.51%

@LHerskind LHerskind self-requested a review September 30, 2024 09:09
l1-contracts/src/core/ProofCommitmentEscrow.sol Outdated Show resolved Hide resolved
l1-contracts/src/core/libraries/crypto/EIP712Lib.sol Outdated Show resolved Hide resolved
l1-contracts/src/core/libraries/crypto/EIP712Lib.sol Outdated Show resolved Hide resolved

function hash(EpochProofQuote memory quote) internal pure returns (bytes32) {
return keccak256(
abi.encode(
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned in the other. I think the domain separator is missing here. Consult ERC20Permit for examples of how it can be used.

Copy link
Contributor Author

@just-mitch just-mitch Sep 30, 2024

Choose a reason for hiding this comment

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

The domain separator is injected when the rollup contract computes the digest.

l1-contracts/src/core/ProofCommitmentEscrow.sol Outdated Show resolved Hide resolved

import { type TypedDataDomain, domainSeparator } from 'viem';

export const DOMAIN: TypedDataDomain = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to what was mentioned in the EIP712 lib I want the address and chainid in here

…provers.

The implementation allows the rollup contract to stake deposited bonds, and unstake them.

Provers may initiate withdraws which are not executable until 3 epochs after their initiation.

Proposers will use the minBalanceAtTime function to ensure that a prover has sufficient funds at the slot they would "cash in" the quote.

Additionally, the signatures used on the epoch proof quotes have been updated to use EIP 712 style signing and verification.
Copy link
Contributor

github-actions bot commented Oct 1, 2024

Changes to circuit sizes

Generated at commit: d802d449e67e89437394d0f8a7a080d2e0294de2, compared to commit: 089dbadd9e9ca304004c38e01d3703d923b257ec

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root 0 ➖ 0.00% +1,669,803 ❌ +43.75%
rollup_block_root 0 ➖ 0.00% +1,252,353 ❌ +43.65%
rollup_merge 0 ➖ 0.00% +834,903 ❌ +43.56%
rollup_root 0 ➖ 0.00% +834,902 ❌ +42.76%
rollup_block_merge 0 ➖ 0.00% +834,902 ❌ +42.75%
public_kernel_merge 0 ➖ 0.00% +417,452 ❌ +37.35%
public_kernel_tail 0 ➖ 0.00% +417,452 ❌ +18.30%
rollup_base +2 ❌ +0.00% +417,450 ❌ +12.59%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
parity_root 2,114 (0) 0.00% 5,486,726 (+1,669,803) +43.75%
rollup_block_root 1,966 (0) 0.00% 4,121,156 (+1,252,353) +43.65%
rollup_merge 1,483 (0) 0.00% 2,751,430 (+834,903) +43.56%
rollup_root 18,844 (0) 0.00% 2,787,657 (+834,902) +42.76%
rollup_block_merge 18,860 (0) 0.00% 2,787,689 (+834,902) +42.75%
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,028 (+2) +0.00% 3,734,192 (+417,450) +12.59%

@AztecBot
Copy link
Collaborator

AztecBot commented Oct 1, 2024

Docs Preview

Hey there! 👋 You can check your preview at https://66fc11560c21d75b594dea67--aztec-docs-dev.netlify.app

@just-mitch just-mitch added the e2e-all CI: Enables this CI job. label Oct 1, 2024
Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

Really minor comment, is acceptable but think we need to cleanup natspecs and some of the modifiers since we can simplify it slightly.

@@ -32,6 +32,7 @@ export class EpochProofQuote extends Gossipable {
return new EpochProofQuote(reader.readObject(EpochProofQuotePayload), reader.readObject(Signature));
}

// TODO: https://github.com/AztecProtocol/aztec-packages/issues/8911
Copy link
Contributor

Choose a reason for hiding this comment

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

🫡

@@ -103,9 +97,8 @@ contract ProofCommitmentEscrow is IProofCommitmentEscrow {
* The prover must have sufficient balance
* The prover's balance will be reduced by the bond amount
*/
function stakeBond(uint256 _amount, address _prover) external override onlyRollup {
function stakeBond(address _prover, uint256 _amount) external override onlyRollup {
Copy link
Contributor

Choose a reason for hiding this comment

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

Natspec should have the params etc. But think we are generally missing some of that. So seems like something that could be acceptable for now, and then lets create a big ass "update natspec" issue.

Created #8912

TOKEN = new TestERC20();
ESCROW = new ProofCommitmentEscrow(TOKEN, address(this));
}

function testDeposit() public setupWithApproval(address(42), 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly annoying here, but if the input is always the _prover and it will be the prover value it don't seem useful to provide as input. Also, if always having the same inputs might as well remove them from here.

@just-mitch just-mitch merged commit 2f1d19a into master Oct 1, 2024
95 checks passed
@just-mitch just-mitch deleted the mt/8573-prover-escrow branch October 1, 2024 15:32
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.

Implement prover escrow
4 participants