2021-11-26 15:53:25 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v3/config/params"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/testing/require"
|
2021-11-26 15:53:25 +00:00
|
|
|
)
|
|
|
|
|
2022-01-10 16:47:30 +00:00
|
|
|
func TestDeterministicGenesisStateBellatrix(t *testing.T) {
|
2022-01-26 07:24:47 +00:00
|
|
|
st, k := DeterministicGenesisStateBellatrix(t, params.BeaconConfig().MaxCommitteesPerSlot)
|
2021-11-26 15:53:25 +00:00
|
|
|
require.Equal(t, params.BeaconConfig().MaxCommitteesPerSlot, uint64(len(k)))
|
|
|
|
require.Equal(t, params.BeaconConfig().MaxCommitteesPerSlot, uint64(st.NumValidators()))
|
|
|
|
}
|
|
|
|
|
2022-01-10 16:47:30 +00:00
|
|
|
func TestGenesisBeaconStateBellatrix(t *testing.T) {
|
2021-11-26 15:53:25 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
deposits, _, err := DeterministicDepositsAndKeys(params.BeaconConfig().MaxCommitteesPerSlot)
|
|
|
|
require.NoError(t, err)
|
|
|
|
eth1Data, err := DeterministicEth1Data(len(deposits))
|
|
|
|
require.NoError(t, err)
|
|
|
|
gt := uint64(10000)
|
2022-01-10 16:47:30 +00:00
|
|
|
st, err := genesisBeaconStateBellatrix(ctx, deposits, gt, eth1Data)
|
2021-11-26 15:53:25 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, gt, st.GenesisTime())
|
|
|
|
require.Equal(t, params.BeaconConfig().MaxCommitteesPerSlot, uint64(st.NumValidators()))
|
|
|
|
}
|