2021-03-18 21:00:00 +00:00
|
|
|
package genesis_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/genesis"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/config/params"
|
2021-03-18 21:00:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGenesisState(t *testing.T) {
|
|
|
|
tests := []struct {
|
2022-05-06 21:42:27 +00:00
|
|
|
name string
|
2021-03-18 21:00:00 +00:00
|
|
|
}{
|
|
|
|
{
|
2022-05-06 21:42:27 +00:00
|
|
|
name: params.MainnetName,
|
2021-03-18 21:00:00 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
2022-05-06 21:42:27 +00:00
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
st, err := genesis.State(tt.name)
|
2021-03-18 21:00:00 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if st == nil {
|
|
|
|
t.Fatal("nil state")
|
|
|
|
}
|
|
|
|
if st.NumValidators() <= 0 {
|
|
|
|
t.Error("No validators present in state")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|