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

eip6110: Queue deposit requests and apply them during epoch processing #3818

Merged
merged 72 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
fd75470
Add pending_deposits queue and queue deposit requests
mkalinin Jun 20, 2024
2a202c8
Refactor pending deposit processing
mkalinin Jun 20, 2024
0b7fef3
Limit number of pending deposits to be processed per epoch
mkalinin Jun 20, 2024
5c3a51a
Process deposit requests after Eth1 bridge deposits are applied
mkalinin Jun 25, 2024
179ee8e
Finalize deposit requests before processing
mkalinin Jun 25, 2024
43e7344
Refactor process_pending_deposits
mkalinin Jun 26, 2024
8f6b1e0
Merge remote-tracking branch 'origin/dev' into deposit-queue
mkalinin Jun 28, 2024
e1a4d8b
added some simple tests
james-prysm Jul 1, 2024
5c0a8d3
Fix off-by-one found by @james-prysm
mkalinin Jul 2, 2024
2af84d8
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 2, 2024
8099f39
merging upstream
james-prysm Jul 2, 2024
750f7a1
adding new test
james-prysm Jul 2, 2024
077edf8
Merge branch 'deposit-queue' of github.com:james-prysm/eth2.0-specs-m…
james-prysm Jul 2, 2024
b31fa63
apply pending deposit tests
james-prysm Jul 2, 2024
b2cd3ce
fixing comment
james-prysm Jul 2, 2024
03071df
preston's feedback
james-prysm Jul 3, 2024
5a2f887
Merge remote-tracking branch 'origin/dev' into deposit-queue
mkalinin Jul 3, 2024
ee4da7b
Refactor postponed deposit processing
mkalinin Jul 5, 2024
6ed15b2
Fix electra fork tests
mkalinin Jul 5, 2024
093590e
Merge remote-tracking branch 'upstream/deposit-queue' into deposit-queue
james-prysm Jul 8, 2024
1a19d82
updating tests based on mikhail changes
james-prysm Jul 9, 2024
85b752b
Fix by @pawanjay176
mkalinin Jul 9, 2024
1e9337e
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 10, 2024
577b028
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 10, 2024
8b191e6
fixing linting
james-prysm Jul 10, 2024
2c8dd39
updating tests
james-prysm Jul 11, 2024
320a692
adding test for chrun
james-prysm Jul 12, 2024
48b9928
adding out of validator range test
james-prysm Jul 12, 2024
bf03d78
fixing linting
james-prysm Jul 12, 2024
ea33eac
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
1feb1fb
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
d62559f
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
6903bab
Update tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_…
james-prysm Jul 26, 2024
4a4cdfc
revert beacon-chain.md changes
james-prysm Jul 26, 2024
077fd44
Merge branch 'deposit-queue' of github.com:james-prysm/eth2.0-specs-m…
james-prysm Jul 26, 2024
e80c39b
mikhail's feedback
james-prysm Jul 29, 2024
6a7bfe9
removed wrong balance
james-prysm Jul 29, 2024
824e374
applying feedback fir add validator test
james-prysm Jul 30, 2024
0a51fe0
updating tests
james-prysm Aug 2, 2024
1afa514
adding test_process_pending_deposits_limit_is_reached
james-prysm Aug 2, 2024
336c6f1
adding some more tests based on test plan
james-prysm Aug 5, 2024
3593a0c
adding 3 more tests
james-prysm Aug 5, 2024
2cf7de9
updating bridge tests
james-prysm Aug 6, 2024
337726c
adding no compounding test
james-prysm Aug 6, 2024
56fe310
adding run_process_pending_deposits to deposit request tests to prope…
james-prysm Aug 6, 2024
c5db6df
adding fork version tests
james-prysm Aug 6, 2024
698367e
Merge pull request #18 from james-prysm/deposit-queue
mkalinin Aug 7, 2024
ada5524
Use the right MaxEB to create validator from deposit
mkalinin Aug 23, 2024
a6864d4
Merge branch 'dev' into deposit-queue
mkalinin Aug 23, 2024
97e6166
Move switch to compounding to process_deposit_request
mkalinin Aug 26, 2024
990de16
Add more deposit tests
mkalinin Aug 26, 2024
c183be4
Update consolidation tests with pending deposit
mkalinin Aug 26, 2024
7afe8e0
Update eip7732 with pending_deposits
mkalinin Aug 26, 2024
ad8f54f
Update pending deposits tests
mkalinin Aug 27, 2024
22bb1de
Fix code spell
mkalinin Aug 27, 2024
0526592
Do state.pending_deposits update in a single line
mkalinin Aug 27, 2024
3ebddad
Merge branch 'dev' into deposit-queue
mkalinin Sep 4, 2024
8c726ff
Fix get_max_effective_balance call
mkalinin Sep 4, 2024
67cc3a5
Rename MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING to MAX_PENDING_DEPOS…
mkalinin Sep 5, 2024
1513492
Merge branch 'dev' into deposit-queue
mkalinin Sep 18, 2024
083402f
Remove switch_to_compounding from deposit flow
mkalinin Sep 18, 2024
5913960
Add notes on add_validator_to_registry, process_deposit modifications
mkalinin Sep 25, 2024
3330265
Apply suggestions from @jtraglia
mkalinin Sep 27, 2024
4ee4105
Merge branch 'dev' into deposit-queue
mkalinin Oct 2, 2024
a04e4c3
Fix fork logic
mkalinin Oct 2, 2024
beb2718
Apply suggestions by @ppopth
mkalinin Oct 3, 2024
358378d
Merge branch 'dev' into deposit-queue
jtraglia Oct 3, 2024
82d2bc0
Fix two tests by replacing old PendingBalanceDeposit
jtraglia Oct 3, 2024
7705984
Fix consolidation test
mkalinin Oct 4, 2024
77d2865
Rename test_apply_pending_deposit to test_process_pending_deposit
jtraglia Oct 4, 2024
3befc42
Rename test_apply_pending_deposit* to test_process_pending_deposit*
jtraglia Oct 4, 2024
ad42273
Use pending_deposits format for both test files
jtraglia Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion presets/mainnet/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# `uint64(2**27)` (= 134,217,728)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 134217728
# `uint64(2**18)` (= 262,144)
Expand Down Expand Up @@ -43,3 +43,8 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 16
# ---------------------------------------------------------------
# 2**3 ( = 8) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 8

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING: 16
7 changes: 6 additions & 1 deletion presets/minimal/electra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_EFFECTIVE_BALANCE_ELECTRA: 2048000000000
# State list lengths
# ---------------------------------------------------------------
# `uint64(2**27)` (= 134,217,728)
PENDING_BALANCE_DEPOSITS_LIMIT: 134217728
PENDING_DEPOSITS_LIMIT: 134217728
# [customized] `uint64(2**6)` (= 64)
PENDING_PARTIAL_WITHDRAWALS_LIMIT: 64
# [customized] `uint64(2**6)` (= 64)
Expand Down Expand Up @@ -43,3 +43,8 @@ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: 2
# ---------------------------------------------------------------
# 2**0 ( = 1) pending withdrawals
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP: 1

# Pending deposits processing
# ---------------------------------------------------------------
# 2**4 ( = 4) pending deposits
MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING: 16
2 changes: 1 addition & 1 deletion specs/_features/eip7732/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class BeaconState(Container):
earliest_exit_epoch: Epoch
consolidation_balance_to_consume: Gwei
earliest_consolidation_epoch: Epoch
pending_balance_deposits: List[PendingBalanceDeposit, PENDING_BALANCE_DEPOSITS_LIMIT]
pending_deposits: List[PendingDeposit, PENDING_DEPOSITS_LIMIT]
pending_partial_withdrawals: List[PendingPartialWithdrawal, PENDING_PARTIAL_WITHDRAWALS_LIMIT]
pending_consolidations: List[PendingConsolidation, PENDING_CONSOLIDATIONS_LIMIT]
# PBS
Expand Down
2 changes: 1 addition & 1 deletion specs/_features/eip7732/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def upgrade_to_eip7732(pre: electra.BeaconState) -> BeaconState:
earliest_exit_epoch=pre.earliest_exit_epoch,
consolidation_balance_to_consume=pre.consolidation_balance_to_consume,
earliest_consolidation_epoch=pre.earliest_consolidation_epoch,
pending_balance_deposits=pre.pending_balance_deposits,
pending_deposits=pre.pending_deposits,
pending_partial_withdrawals=pre.pending_partial_withdrawals,
pending_consolidations=pre.pending_consolidations,
# ePBS
Expand Down
275 changes: 181 additions & 94 deletions specs/electra/beacon-chain.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion specs/electra/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
earliest_exit_epoch=earliest_exit_epoch,
consolidation_balance_to_consume=0,
earliest_consolidation_epoch=compute_activation_exit_epoch(get_current_epoch(pre)),
pending_balance_deposits=[],
pending_deposits=[],
pending_partial_withdrawals=[],
pending_consolidations=[],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ def test_success_top_up_to_withdrawn_validator(spec, state):
yield from run_deposit_processing(spec, state, deposit, validator_index)

if is_post_electra(spec):
pending_balance_deposits_len = len(state.pending_balance_deposits)
pending_balance_deposit = state.pending_balance_deposits[pending_balance_deposits_len - 1]
assert pending_balance_deposit.amount == amount
assert pending_balance_deposit.index == validator_index
pending_deposits_len = len(state.pending_deposits)
pending_deposit = state.pending_deposits[pending_deposits_len - 1]
assert pending_deposit.pubkey == deposit.data.pubkey
assert pending_deposit.withdrawal_credentials == deposit.data.withdrawal_credentials
assert pending_deposit.amount == deposit.data.amount
assert pending_deposit.signature == deposit.data.signature
assert pending_deposit.slot == spec.GENESIS_SLOT
else:
assert state.balances[validator_index] == amount
assert state.validators[validator_index].effective_balance == 0
Expand All @@ -47,7 +50,7 @@ def test_success_top_up_to_withdrawn_validator(spec, state):
if is_post_electra(spec):
has_execution_withdrawal = spec.has_execution_withdrawal_credential(validator)
is_withdrawable = validator.withdrawable_epoch <= current_epoch
has_non_zero_balance = pending_balance_deposit.amount > 0
has_non_zero_balance = pending_deposit.amount > 0
# NOTE: directly compute `is_fully_withdrawable_validator` conditions here
# to work around how the epoch processing changed balance updates
assert has_execution_withdrawal and is_withdrawable and has_non_zero_balance
Expand Down
9 changes: 6 additions & 3 deletions tests/core/pyspec/eth2spec/test/capella/sanity/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,11 @@ def test_top_up_and_partial_withdrawable_validator(spec, state):
yield 'post', state

if is_post_electra(spec):
assert state.pending_balance_deposits[0].amount == amount
assert state.pending_balance_deposits[0].index == validator_index
assert state.pending_deposits[0].pubkey == deposit.data.pubkey
assert state.pending_deposits[0].withdrawal_credentials == deposit.data.withdrawal_credentials
assert state.pending_deposits[0].amount == deposit.data.amount
assert state.pending_deposits[0].signature == deposit.data.signature
assert state.pending_deposits[0].slot == spec.GENESIS_SLOT
else:
# Since withdrawals happen before deposits, it becomes partially withdrawable after state transition.
validator = state.validators[validator_index]
Expand Down Expand Up @@ -405,7 +408,7 @@ def test_top_up_to_fully_withdrawn_validator(spec, state):

balance = state.balances[validator_index]
if is_post_electra(spec):
balance += state.pending_balance_deposits[0].amount
balance += state.pending_deposits[0].amount

assert spec.is_fully_withdrawable_validator(
state.validators[validator_index],
Expand Down
Loading