func SetupState(initialValidators int, c *config.Config) (*primitives.State, validator.Keystore, error) {
	keystore := validator.NewFakeKeyStore()

	var validators []primitives.InitialValidatorEntry

	for i := 0; i < initialValidators; i++ {
		key := keystore.GetKeyForValidator(uint32(i))
		pub := key.DerivePublicKey()
		hashPub, err := ssz.HashTreeRoot(pub.Serialize())
		if err != nil {
			return nil, nil, err
		}
		proofOfPossession, err := bls.Sign(key, hashPub[:], bls.DomainDeposit)
		if err != nil {
			return nil, nil, err
		}
		validators = append(validators, primitives.InitialValidatorEntry{
			PubKey:                pub.Serialize(),
			ProofOfPossession:     proofOfPossession.Serialize(),
			WithdrawalShard:       1,
			WithdrawalCredentials: chainhash.Hash{},
			DepositSize:           c.MaxDeposit,
		})
	}

	s, err := primitives.InitializeState(c, validators, uint64(time.Now().Unix()), false)
	return s, &keystore, err
}
// SetupState initializes state with a certain number of initial validators
SetupState initializes state with a certain number of initial validators
// SetupState initializes state with a certain number of initial validators
func SetupState(initialValidators int, c *config.Config) (*primitives.State, validator.Keystore, error) {
	keystore := validator.NewFakeKeyStore()
	var validators []primitives.InitialValidatorEntry
	for i := 0; i < initialValidators; i++ {
		key := keystore.GetKeyForValidator(uint32(i))
		pub := key.DerivePublicKey()
		hashPub, err := ssz.HashTreeRoot(pub.Serialize())
		if err != nil {
			return nil, nil, err
		}
		proofOfPossession, err := bls.Sign(key, hashPub[:], bls.DomainDeposit)
		if err != nil {
			return nil, nil, err
		}
		validators = append(validators, primitives.InitialValidatorEntry{
			PubKey:                pub.Serialize(),
			ProofOfPossession:     proofOfPossession.Serialize(),
			WithdrawalShard:       1,
			WithdrawalCredentials: chainhash.Hash{},
			DepositSize:           c.MaxDeposit,
		})
	}
	s, err := primitives.InitializeState(c, validators, uint64(time.Now().Unix()), false)
	return s, &keystore, err
}
func SetupState ( initialValidators int , c * config . Config ) ( * primitives . State , validator . Keystore , error ) { keystore := validator . NewFakeKeyStore ( ) var validators [ ] primitives . InitialValidatorEntry for i := 0 ; i < initialValidators ; i ++ { key := keystore . GetKeyForValidator ( uint32 ( i ) ) pub := key . DerivePublicKey ( ) hashPub , err := ssz . HashTreeRoot ( pub . Serialize ( ) ) if err != nil { return nil , nil , err } proofOfPossession , err := bls . Sign ( key , hashPub [ : ] , bls . DomainDeposit ) if err != nil { return nil , nil , err } validators = append ( validators , primitives . InitialValidatorEntry { PubKey : pub . Serialize ( ) , ProofOfPossession : proofOfPossession . Serialize ( ) , WithdrawalShard : 1 , WithdrawalCredentials : chainhash . Hash { } , DepositSize : c . MaxDeposit , } ) } s , err := primitives . InitializeState ( c , validators , uint64 ( time . Now ( ) . Unix ( ) ) , false ) return s , & keystore , err }
SetupState initializes state with a certain number of initial validators
SetupState initializes state with a certain number of initial validators