mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 09:14:28 +00:00
5a66807989
* First take at updating everything to v5 * Patch gRPC gateway to use prysm v5 Fix patch * Update go ssz --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
55 lines
1.9 KiB
Go
55 lines
1.9 KiB
Go
package state_native
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types"
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
)
|
|
|
|
func TestSetNextWithdrawalIndex(t *testing.T) {
|
|
s := BeaconState{
|
|
version: version.Capella,
|
|
nextWithdrawalIndex: 3,
|
|
dirtyFields: make(map[types.FieldIndex]bool),
|
|
}
|
|
require.NoError(t, s.SetNextWithdrawalIndex(5))
|
|
require.Equal(t, uint64(5), s.nextWithdrawalIndex)
|
|
require.Equal(t, true, s.dirtyFields[types.NextWithdrawalIndex])
|
|
}
|
|
|
|
func TestSetNextWithdrawalValidatorIndex(t *testing.T) {
|
|
s := BeaconState{
|
|
version: version.Capella,
|
|
nextWithdrawalValidatorIndex: 3,
|
|
dirtyFields: make(map[types.FieldIndex]bool),
|
|
}
|
|
require.NoError(t, s.SetNextWithdrawalValidatorIndex(5))
|
|
require.Equal(t, primitives.ValidatorIndex(5), s.nextWithdrawalValidatorIndex)
|
|
require.Equal(t, true, s.dirtyFields[types.NextWithdrawalValidatorIndex])
|
|
}
|
|
|
|
func TestSetNextWithdrawalIndex_Deneb(t *testing.T) {
|
|
s := BeaconState{
|
|
version: version.Deneb,
|
|
nextWithdrawalIndex: 3,
|
|
dirtyFields: make(map[types.FieldIndex]bool),
|
|
}
|
|
require.NoError(t, s.SetNextWithdrawalIndex(5))
|
|
require.Equal(t, uint64(5), s.nextWithdrawalIndex)
|
|
require.Equal(t, true, s.dirtyFields[types.NextWithdrawalIndex])
|
|
}
|
|
|
|
func TestSetNextWithdrawalValidatorIndex_Deneb(t *testing.T) {
|
|
s := BeaconState{
|
|
version: version.Deneb,
|
|
nextWithdrawalValidatorIndex: 3,
|
|
dirtyFields: make(map[types.FieldIndex]bool),
|
|
}
|
|
require.NoError(t, s.SetNextWithdrawalValidatorIndex(5))
|
|
require.Equal(t, primitives.ValidatorIndex(5), s.nextWithdrawalValidatorIndex)
|
|
require.Equal(t, true, s.dirtyFields[types.NextWithdrawalValidatorIndex])
|
|
}
|