diff --git a/beacon-chain/core/blocks/withdrawals.go b/beacon-chain/core/blocks/withdrawals.go index f52378243b3..b7806503c9d 100644 --- a/beacon-chain/core/blocks/withdrawals.go +++ b/beacon-chain/core/blocks/withdrawals.go @@ -193,7 +193,7 @@ func ProcessWithdrawals(st state.BeaconState, executionData interfaces.Execution } if st.Version() >= version.Electra { - if err := st.DequeuePartialWithdrawals(processedPartialWithdrawalsCount); err != nil { + if err := st.DequeuePendingPartialWithdrawals(processedPartialWithdrawalsCount); err != nil { return nil, fmt.Errorf("unable to dequeue partial withdrawals from state: %w", err) } } diff --git a/beacon-chain/state/interfaces.go b/beacon-chain/state/interfaces.go index 7422c8d6de2..15b5544be80 100644 --- a/beacon-chain/state/interfaces.go +++ b/beacon-chain/state/interfaces.go @@ -316,7 +316,7 @@ type WriteOnlySyncCommittee interface { type WriteOnlyWithdrawals interface { AppendPendingPartialWithdrawal(ppw *ethpb.PendingPartialWithdrawal) error - DequeuePartialWithdrawals(num uint64) error + DequeuePendingPartialWithdrawals(num uint64) error SetNextWithdrawalIndex(i uint64) error SetNextWithdrawalValidatorIndex(i primitives.ValidatorIndex) error } diff --git a/beacon-chain/state/state-native/setters_withdrawal.go b/beacon-chain/state/state-native/setters_withdrawal.go index 36b97a82676..37cfe600606 100644 --- a/beacon-chain/state/state-native/setters_withdrawal.go +++ b/beacon-chain/state/state-native/setters_withdrawal.go @@ -64,10 +64,10 @@ func (b *BeaconState) AppendPendingPartialWithdrawal(ppw *eth.PendingPartialWith return nil } -// DequeuePartialWithdrawals removes the partial withdrawals from the beginning of the partial withdrawals list. -func (b *BeaconState) DequeuePartialWithdrawals(n uint64) error { +// DequeuePendingPartialWithdrawals removes the partial withdrawals from the beginning of the partial withdrawals list. +func (b *BeaconState) DequeuePendingPartialWithdrawals(n uint64) error { if b.version < version.Electra { - return errNotSupported("DequeuePartialWithdrawals", b.version) + return errNotSupported("DequeuePendingPartialWithdrawals", b.version) } if n > uint64(len(b.pendingPartialWithdrawals)) { diff --git a/beacon-chain/state/state-native/setters_withdrawal_test.go b/beacon-chain/state/state-native/setters_withdrawal_test.go index d7627d39754..b2e2e5b119c 100644 --- a/beacon-chain/state/state-native/setters_withdrawal_test.go +++ b/beacon-chain/state/state-native/setters_withdrawal_test.go @@ -68,7 +68,7 @@ func TestDequeuePendingWithdrawals(t *testing.T) { num, err := s.NumPendingPartialWithdrawals() require.NoError(t, err) require.Equal(t, uint64(3), num) - require.NoError(t, s.DequeuePartialWithdrawals(2)) + require.NoError(t, s.DequeuePendingPartialWithdrawals(2)) num, err = s.NumPendingPartialWithdrawals() require.NoError(t, err) require.Equal(t, uint64(1), num) @@ -77,13 +77,13 @@ func TestDequeuePendingWithdrawals(t *testing.T) { num, err = s.NumPendingPartialWithdrawals() require.NoError(t, err) require.Equal(t, uint64(1), num) - require.ErrorContains(t, "cannot dequeue more withdrawals than are in the queue", s.DequeuePartialWithdrawals(2)) + require.ErrorContains(t, "cannot dequeue more withdrawals than are in the queue", s.DequeuePendingPartialWithdrawals(2)) // Removing all pending partial withdrawals should be OK. num, err = s.NumPendingPartialWithdrawals() require.NoError(t, err) require.Equal(t, uint64(1), num) - require.NoError(t, s.DequeuePartialWithdrawals(1)) + require.NoError(t, s.DequeuePendingPartialWithdrawals(1)) num, err = s.Copy().NumPendingPartialWithdrawals() require.NoError(t, err) require.Equal(t, uint64(0), num) @@ -91,7 +91,7 @@ func TestDequeuePendingWithdrawals(t *testing.T) { s, err = InitializeFromProtoDeneb(ð.BeaconStateDeneb{}) require.NoError(t, err) - require.ErrorContains(t, "is not supported", s.DequeuePartialWithdrawals(0)) + require.ErrorContains(t, "is not supported", s.DequeuePendingPartialWithdrawals(0)) } func TestAppendPendingWithdrawals(t *testing.T) {