mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
d17996f8b0
* Update V3 from V4 * Fix build v3 -> v4 * Update ssz * Update beacon_chain.pb.go * Fix formatter import * Update update-mockgen.sh comment to v4 * Fix conflicts. Pass build and tests * Fix test
33 lines
872 B
Go
33 lines
872 B
Go
package stateutil
|
|
|
|
import (
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
|
|
mathutil "github.com/prysmaticlabs/prysm/v4/math"
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/v4/testing/assert"
|
|
)
|
|
|
|
func TestValidatorConstants(t *testing.T) {
|
|
v := ðpb.Validator{}
|
|
refV := reflect.ValueOf(v).Elem()
|
|
numFields := refV.NumField()
|
|
numOfValFields := 0
|
|
|
|
for i := 0; i < numFields; i++ {
|
|
if strings.Contains(refV.Type().Field(i).Name, "state") ||
|
|
strings.Contains(refV.Type().Field(i).Name, "sizeCache") ||
|
|
strings.Contains(refV.Type().Field(i).Name, "unknownFields") {
|
|
continue
|
|
}
|
|
numOfValFields++
|
|
}
|
|
assert.Equal(t, validatorFieldRoots, numOfValFields)
|
|
assert.Equal(t, uint64(validatorFieldRoots), mathutil.PowerOf2(validatorTreeDepth))
|
|
|
|
_, err := ValidatorRegistryRoot([]*ethpb.Validator{v})
|
|
assert.NoError(t, err)
|
|
}
|