Fix Bug On Startup Using Genesis.json (#1258)

* fix bug

* making requested changes

* new changes

* changing initialize state

* remove genesis.json and references

* remove log

* readme

* readme

* remove reference
This commit is contained in:
Nishant Das
2019-01-09 11:03:57 +08:00
committed by GitHub
parent 24b87d52ed
commit bb7b0a324b
21 changed files with 185 additions and 192 deletions

View File

@@ -77,7 +77,7 @@ bazel build //validator:validator
## Running The Beacon Chain
To start the system, we need to seed the beacon chain state with an initial validator set for local development. We created a reference [genesis.json](https://github.com/prysmaticlabs/prysm/blob/master/genesis.json) in the prysm base directory for this! You'll also need a special data directory where all the beacon chain data will be persisted to.
To start the system, you will need a special data directory where all the beacon chain data will be persisted to.
Then, you can run the node as follows:
@@ -85,7 +85,6 @@ With the binary executable:
```
./beacon-chain \
--genesis-json /path/to/genesis.json \
--datadir /path/to/your/datadir \
--rpc-port 4000 \
--simulator \
@@ -97,7 +96,6 @@ With bazel:
```
bazel run //beacon-chain --\
--genesis-json /path/to/genesis.json \
--datadir /path/to/your/datadir \
--rpc-port 4000 \
--simulator \
@@ -121,9 +119,16 @@ Once your beacon node is up, you'll need to attach a validator client as a separ
To get started, you'll need to use a public key from the initial validator set of the beacon node. Here are a few you can try out:
```
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
bc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a
5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2
f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2
69c322e3248a5dfc29d73c5b0553b0185a35cd5bb6386747517ef7e53b15e287
f343681465b9efe82c933c3e8748c70cb8aa06539c361de20f72eac04e766393
dbb8d0f4c497851a5043c6363657698cb1387682cac2f786c731f8936109d795
d0591206d9e81e07f4defc5327957173572bcd1bca7838caa7be39b0c12b1873
ee2a4bc7db81da2b7164e56b3649b1e2a09c58c455b15dabddd9146c7582cebc
d33e25809fcaa2b6900567812852539da8559dc8b76a7ce3fc5ddd77e8d19a69
b2e7b7a21d986ae84d62a7de4a916f006c4e42a596358b93bad65492d174c4ff
```
Run as follows:
@@ -134,7 +139,7 @@ With the binary executable:
./validator \
--beacon-rpc-provider http://localhost:4000 \
--datadir /path/to/uniquevalidatordatadir \
--pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
--pubkey f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2
```
With Bazel:
@@ -143,7 +148,7 @@ With Bazel:
bazel run //validator --\
--beacon-rpc-provider http://localhost:4000 \
--datadir /path/to/uniquevalidatordatadir \
--pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
--pubkey f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2
```
@@ -154,8 +159,7 @@ if you want to run multiple validator clients, **each one needs to have its own
## Running Via Docker
```
docker run -p 4000:4000 -v /path/to/genesis.json:/genesis.json gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--genesis-json /genesis.json \
docker run -p 4000:4000 -v gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--rpc-port 4000 \
--simulator \
--demo-config \
@@ -167,7 +171,7 @@ Then, to run a validator client, use:
```
docker run gcr.io/prysmaticlabs/prysm/validator:latest \
--beacon-rpc-provider http://{YOUR_LOCAL_IP}:4000 \
--pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
--pubkey f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2
```
@@ -183,7 +187,6 @@ The best way to run under Windows is to clone the repository and then run the no
```
go run ./beacon-chain main.go \
--genesis-json /path/to/genesis.json \
--datadir /path/to/your/datadir \
--rpc-port 4000 \
--simulator \
@@ -197,7 +200,7 @@ After the beacon chain is up and running, run the validator client as a separate
go run ./validator/main.go \
--beacon-rpc-provider http://localhost:4000 \
--datadir /path/to/uniquevalidatordatadir \
--pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
--pubkey f2ee15ea639b73fa3db9b34a245bdfa015c260c598b211bf05a1ecc4b3e3b4f2
```
# Testing

View File

@@ -98,7 +98,7 @@ func setupBeaconChain(t *testing.T, faultyPoWClient bool, beaconDB *db.BeaconDB)
if err != nil {
t.Fatalf("unable to set up web3 service: %v", err)
}
if err := beaconDB.InitializeState(nil); err != nil {
if err := beaconDB.InitializeState(); err != nil {
t.Fatalf("failed to initialize state: %v", err)
}

View File

@@ -160,3 +160,46 @@ func EncodeDepositData(
depositData = append(depositData, timestamp...)
return depositData, nil
}
// DecodeDepositInput unmarshalls a depositData byte slice into
// a proto *pb.DepositInput by using the Simple Serialize (SSZ)
// algorithm.
// TODO(#1253): Do not assume we will receive serialized proto objects - instead,
// replace completely by a common struct which can be simple serialized.
func DecodeDepositInput(depositData []byte) (*pb.DepositInput, error) {
// Last 16 bytes of deposit data are 8 bytes for value
// and 8 bytes for timestamp. Everything before that is a
// Simple Serialized deposit input value.
if len(depositData) < 16 {
return nil, fmt.Errorf(
"deposit data slice too small: len(depositData) = %d",
len(depositData),
)
}
depositInput := new(pb.DepositInput)
depositInputBytes := depositData[:len(depositData)-16]
rBuf := bytes.NewReader(depositInputBytes)
if err := ssz.Decode(rBuf, depositInput); err != nil {
return nil, fmt.Errorf("ssz decode failed: %v", err)
}
return depositInput, nil
}
// DecodeDepositAmountAndTimeStamp extracts the deposit amount and timestamp
// from the given deposit data.
func DecodeDepositAmountAndTimeStamp(depositData []byte) (uint64, int64, error) {
// Last 16 bytes of deposit data are 8 bytes for value
// and 8 bytes for timestamp. Everything before that is a
// Simple Serialized deposit input value.
if len(depositData) < 16 {
return 0, 0, fmt.Errorf(
"deposit data slice too small: len(depositData) = %d",
len(depositData),
)
}
length := len(depositData)
amount := binary.BigEndian.Uint64(depositData[length-16 : length-8])
timestamp := binary.BigEndian.Uint64(depositData[length-8:])
return amount, int64(timestamp), nil
}

View File

@@ -12,7 +12,6 @@ import (
"github.com/prysmaticlabs/prysm/shared/hashutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/slices"
"github.com/prysmaticlabs/prysm/shared/ssz"
"github.com/prysmaticlabs/prysm/shared/trie"
)
@@ -585,30 +584,6 @@ func ProcessValidatorDeposits(
return beaconState, nil
}
// DecodeDepositInput unmarshales a depositData byte slice into
// a proto *pb.DepositInput by using the Simple Serialize (SSZ)
// algorithm.
// TODO(#1253): Do not assume we will receive serialized proto objects - instead,
// replace completely by a common struct which can be simple serialized.
func DecodeDepositInput(depositData []byte) (*pb.DepositInput, error) {
// Last 16 bytes of deposit data are 8 bytes for value
// and 8 bytes for timestamp. Everything before that is a
// Simple Serialized deposit input value.
if len(depositData) < 16 {
return nil, fmt.Errorf(
"deposit data slice too small: len(depositData) = %d",
len(depositData),
)
}
depositInput := new(pb.DepositInput)
depositInputBytes := depositData[:len(depositData)-16]
rBuf := bytes.NewReader(depositInputBytes)
if err := ssz.Decode(rBuf, depositInput); err != nil {
return nil, fmt.Errorf("ssz decode failed: %v", err)
}
return depositInput, nil
}
func verifyDeposit(beaconState *pb.BeaconState, deposit *pb.Deposit) error {
depositData := deposit.DepositData
// Verify Merkle proof of deposit and PoW receipt trie root.

View File

@@ -186,3 +186,77 @@ func TestDomainVersion(t *testing.T) {
t.Errorf("Incorrect domain version %d", DomainVersion(forkData, 11, 3))
}
}
func TestDecodeDepositAmountAndTimeStamp(t *testing.T) {
tests := []struct {
depositData *pb.DepositInput
amount uint64
timestamp int64
}{
{
depositData: &pb.DepositInput{
Pubkey: []byte("testing"),
RandaoCommitmentHash32: []byte("randao"),
PocCommitment: []byte("commitment"),
WithdrawalCredentialsHash32: []byte("withdraw"),
},
amount: 8749343850,
timestamp: 458739850,
},
{
depositData: &pb.DepositInput{
Pubkey: []byte("testing"),
PocCommitment: []byte("commitment"),
WithdrawalCredentialsHash32: []byte("withdraw"),
},
amount: 657660,
timestamp: 67750,
},
{
depositData: &pb.DepositInput{
Pubkey: []byte("testing"),
RandaoCommitmentHash32: []byte("randao"),
WithdrawalCredentialsHash32: []byte("withdraw"),
},
amount: 5445540,
timestamp: 34340,
}, {
depositData: &pb.DepositInput{
RandaoCommitmentHash32: []byte("randao"),
PocCommitment: []byte("commitment"),
WithdrawalCredentialsHash32: []byte("withdraw"),
},
amount: 4545,
timestamp: 4343,
}, {
depositData: &pb.DepositInput{
Pubkey: []byte("testing"),
RandaoCommitmentHash32: []byte("randao"),
PocCommitment: []byte("commitment"),
},
amount: 76706966,
timestamp: 34394393,
},
}
for _, tt := range tests {
data, err := EncodeDepositData(tt.depositData, tt.amount, tt.timestamp)
if err != nil {
t.Fatalf("Could not encode data %v", err)
}
decAmount, decTimestamp, err := DecodeDepositAmountAndTimeStamp(data)
if err != nil {
t.Fatalf("Could not decode data %v", err)
}
if tt.amount != decAmount {
t.Errorf("Decoded amount not equal to given amount, %d : %d", decAmount, tt.amount)
}
if tt.timestamp != decTimestamp {
t.Errorf("Decoded timestamp not equal to given timestamp, %d : %d", decTimestamp, tt.timestamp)
}
}
}

View File

@@ -48,6 +48,33 @@ func InitialBeaconState(
latestBlockRoots[i] = params.BeaconConfig().ZeroHash[:]
}
validatorRegistry := make([]*pb.ValidatorRecord, len(initialValidatorDeposits))
latestBalances := make([]uint64, len(initialValidatorDeposits))
for i, d := range initialValidatorDeposits {
amount, _, err := b.DecodeDepositAmountAndTimeStamp(d.DepositData)
if err != nil {
return nil, fmt.Errorf("could not decode deposit amount and timestamp %v", err)
}
depositInput, err := b.DecodeDepositInput(d.DepositData)
if err != nil {
return nil, fmt.Errorf("could decode deposit input %v", err)
}
validator := &pb.ValidatorRecord{
Pubkey: depositInput.Pubkey,
RandaoCommitmentHash32: depositInput.RandaoCommitmentHash32,
WithdrawalCredentialsHash32: depositInput.WithdrawalCredentialsHash32,
PocCommitmentHash32: depositInput.PocCommitment,
Balance: amount,
ExitSlot: params.BeaconConfig().FarFutureSlot,
}
validatorRegistry[i] = validator
}
latestPenalizedExitBalances := make([]uint64, params.BeaconConfig().LatestPenalizedExitLength)
state := &pb.BeaconState{
@@ -61,8 +88,8 @@ func InitialBeaconState(
},
// Validator registry fields.
ValidatorRegistry: []*pb.ValidatorRecord{},
ValidatorBalances: []uint64{},
ValidatorRegistry: validatorRegistry,
ValidatorBalances: latestBalances,
ValidatorRegistryLastChangeSlot: params.BeaconConfig().GenesisSlot,
ValidatorRegistryExitCount: 0,
ValidatorRegistryDeltaChainTipHash32: params.BeaconConfig().ZeroHash[:],
@@ -123,10 +150,10 @@ func InitialBeaconState(
return nil, fmt.Errorf("could not process validator deposit: %v", err)
}
}
for validatorIndex := range state.ValidatorRegistry {
if v.EffectiveBalance(state, uint32(validatorIndex)) ==
for i := 0; i < len(state.ValidatorRegistry); i++ {
if v.EffectiveBalance(state, uint32(i)) ==
params.BeaconConfig().MaxDepositInGwei {
state, err = v.ActivateValidator(state, uint32(validatorIndex), true)
state, err = v.ActivateValidator(state, uint32(i), true)
if err != nil {
return nil, fmt.Errorf("could not activate validator: %v", err)
}

View File

@@ -182,7 +182,8 @@ func TestInitialBeaconState_Ok(t *testing.T) {
for i := 0; i < len(state.ShardAndCommitteesAtSlots); i++ {
if len(state.ShardAndCommitteesAtSlots[i].ArrayShardAndCommittee[0].Committee) !=
int(params.BeaconConfig().TargetCommitteeSize) {
t.Error("ShardAndCommittees was not correctly initialized")
t.Errorf("ShardAndCommittees was not correctly initialized %d",
len(state.ShardAndCommitteesAtSlots[i].ArrayShardAndCommittee[0].Committee))
}
}
}

View File

@@ -27,10 +27,11 @@ func InitialValidatorRegistry() []*pb.ValidatorRecord {
randaoReveal := hashutil.Hash(randaoPreCommit[:])
validators := make([]*pb.ValidatorRecord, config.DepositsForChainStart)
for i := uint64(0); i < config.DepositsForChainStart; i++ {
pubkey := hashutil.Hash([]byte{byte(i)})
validators[i] = &pb.ValidatorRecord{
ExitSlot: params.BeaconConfig().FarFutureSlot,
Balance: config.MaxDeposit * config.Gwei,
Pubkey: []byte{},
Pubkey: pubkey[:],
RandaoCommitmentHash32: randaoReveal[:],
}
}

View File

@@ -18,6 +18,7 @@ go_library(
"//beacon-chain/core/attestations:go_default_library",
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/state:go_default_library",
"//beacon-chain/core/validators:go_default_library",
"//beacon-chain/utils:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/bytes:go_default_library",

View File

@@ -88,7 +88,7 @@ func TestUpdateChainHeadNoBlock(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
err := db.InitializeState(nil)
err := db.InitializeState()
if err != nil {
t.Fatalf("failed to initialize state: %v", err)
}
@@ -107,7 +107,7 @@ func TestUpdateChainHead(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
err := db.InitializeState(nil)
err := db.InitializeState()
if err != nil {
t.Fatalf("failed to initialize state: %v", err)
}
@@ -171,7 +171,7 @@ func TestChainProgress(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
err := db.InitializeState(nil)
err := db.InitializeState()
if err != nil {
t.Fatalf("failed to initialize state: %v", err)
}

View File

@@ -8,6 +8,7 @@ import (
"github.com/gogo/protobuf/proto"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
"github.com/prysmaticlabs/prysm/beacon-chain/core/validators"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/hashutil"
"github.com/prysmaticlabs/prysm/shared/params"
@@ -15,7 +16,9 @@ import (
// InitializeState creates an initial genesis state for the beacon
// node using a set of genesis validators.
func (db *BeaconDB) InitializeState(genesisValidatorRegistry []*pb.ValidatorRecord) error {
func (db *BeaconDB) InitializeState() error {
// TODO(#1267): Remove initial validators once testnet startup procedure is finalized.
genesisValidatorRegistry := validators.InitialValidatorRegistry()
deposits := make([]*pb.Deposit, len(genesisValidatorRegistry))
for i := 0; i < len(deposits); i++ {
depositInput := &pb.DepositInput{

View File

@@ -11,7 +11,7 @@ func TestInitializeState(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
if err := db.InitializeState(nil); err != nil {
if err := db.InitializeState(); err != nil {
t.Fatalf("Failed to initialize state: %v", err)
}
b, err := db.GetChainHead()
@@ -57,7 +57,7 @@ func TestGenesisTime(t *testing.T) {
t.Fatal("expected GenesisTime to fail")
}
err = db.InitializeState(nil)
err = db.InitializeState()
if err != nil {
t.Fatalf("failed to initialize state: %v", err)
}

View File

@@ -63,7 +63,7 @@ func TestCleanBlockVoteCache(t *testing.T) {
var err error
// Pre-fill block vote cache in DB
if err = beaconDB.InitializeState(nil); err != nil {
if err = beaconDB.InitializeState(); err != nil {
t.Fatalf("failed to initialize DB: %v", err)
}
oldBlock := &pb.BeaconBlock{Slot: 1}

View File

@@ -24,7 +24,6 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/simulator"
rbcsync "github.com/prysmaticlabs/prysm/beacon-chain/sync"
"github.com/prysmaticlabs/prysm/beacon-chain/utils"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared"
"github.com/prysmaticlabs/prysm/shared/cmd"
"github.com/prysmaticlabs/prysm/shared/debug"
@@ -157,10 +156,6 @@ func (b *BeaconNode) Close() {
func (b *BeaconNode) startDB(ctx *cli.Context) error {
baseDir := ctx.GlobalString(cmd.DataDirFlag.Name)
var genesisJSON string
if ctx.GlobalIsSet(utils.GenesisJSON.Name) {
genesisJSON = ctx.GlobalString(utils.GenesisJSON.Name)
}
db, err := db.NewDB(path.Join(baseDir, beaconChainDBName))
if err != nil {
@@ -175,15 +170,7 @@ func (b *BeaconNode) startDB(ctx *cli.Context) error {
}
// Ensure that state has been initialized.
if beaconState == nil {
var genesisValidatorRegistry []*pb.ValidatorRecord
if genesisJSON != "" {
log.Infof("Initializing Crystallized State from %s", genesisJSON)
genesisValidatorRegistry, err = utils.InitialValidatorRegistryFromJSON(genesisJSON)
if err != nil {
return err
}
}
if err := db.InitializeState(genesisValidatorRegistry); err != nil {
if err := db.InitializeState(); err != nil {
return err
}
}

View File

@@ -47,7 +47,7 @@ func setupSimulator(t *testing.T, beaconDB *db.BeaconDB) (*Simulator, *mockP2P)
ctx := context.Background()
p2pService := &mockP2P{}
err := beaconDB.InitializeState(nil)
err := beaconDB.InitializeState()
if err != nil {
t.Fatalf("Failed to initialize state: %v", err)
}

View File

@@ -118,7 +118,7 @@ func TestProcessBlock(t *testing.T) {
169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99},
}
}
if err := db.InitializeState(validators); err != nil {
if err := db.InitializeState(); err != nil {
t.Fatalf("Failed to initialize state: %v", err)
}
@@ -196,7 +196,7 @@ func TestProcessMultipleBlocks(t *testing.T) {
169, 136, 56, 111, 200, 75, 166, 188, 149, 72, 64, 8, 246, 54, 47, 147, 22, 14, 243, 229, 99},
}
}
if err := db.InitializeState(validators); err != nil {
if err := db.InitializeState(); err != nil {
t.Fatal(err)
}

View File

@@ -6,17 +6,14 @@ go_library(
"block_vote_cache.go",
"clock.go",
"flags.go",
"genesis_json.go",
"shuffle.go",
],
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/utils",
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//proto/beacon/p2p/v1:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
"@com_github_gogo_protobuf//jsonpb:go_default_library",
"@com_github_urfave_cli//:go_default_library",
],
)
@@ -26,13 +23,10 @@ go_test(
srcs = [
"block_vote_cache_test.go",
"clock_test.go",
"genesis_json_test.go",
"shuffle_test.go",
],
data = ["//:genesis.json"],
embed = [":go_default_library"],
deps = [
"//proto/beacon/p2p/v1:go_default_library",
"//shared/params:go_default_library",
"@com_github_ethereum_go_ethereum//common:go_default_library",
],

View File

@@ -1,27 +0,0 @@
package utils
import (
"fmt"
"os"
"github.com/gogo/protobuf/jsonpb"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
// InitialValidatorRegistryFromJSON retrieves the validator set that is stored in
// genesis.json.
func InitialValidatorRegistryFromJSON(genesisJSONPath string) ([]*pb.ValidatorRecord, error) {
// genesisJSONPath is a user input for the path of genesis.json.
// Ex: /path/to/my/genesis.json.
f, err := os.Open(genesisJSONPath) // #nosec
if err != nil {
return nil, err
}
beaconState := &pb.BeaconState{}
if err := jsonpb.Unmarshal(f, beaconState); err != nil {
return nil, fmt.Errorf("error converting JSON to proto: %v", err)
}
return beaconState.ValidatorRegistry, nil
}

View File

@@ -1,52 +0,0 @@
package utils
import (
"fmt"
"os"
"reflect"
"testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/params"
)
func TestInitGenesisJsonFailure(t *testing.T) {
fname := "/genesis.json"
pwd, _ := os.Getwd()
fnamePath := pwd + fname
_, err := InitialValidatorRegistryFromJSON(fnamePath)
if err == nil {
t.Fatalf("genesis.json should have failed %v", err)
}
}
func TestInitGenesisJson(t *testing.T) {
// Support running this test via bazel or go test.
var fNamePath string
if os.Getenv("RUNFILES_DIR") != "" {
fNamePath = fmt.Sprintf("%s/%s/%s",
os.Getenv("RUNFILES_DIR"),
os.Getenv("TEST_WORKSPACE"),
"/genesis.json",
)
} else {
fNamePath = "../../genesis.json"
}
params.UseDemoBeaconConfig()
state := &pb.BeaconState{
ValidatorRegistry: []*pb.ValidatorRecord{
{Pubkey: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), Balance: 32000000000},
},
}
validators, err := InitialValidatorRegistryFromJSON(fNamePath)
if err != nil {
t.Fatalf("Reading validatory registry from genesis.json failed %v", err)
}
if !reflect.DeepEqual(state.ValidatorRegistry[0], validators[0]) {
t.Error("Validator registry mismatched")
}
}

View File

@@ -23,7 +23,6 @@ bazel run //beacon-chain --\
--pubkey aaace816cdab194b4bc6c0de3575ccf917a9b9ecfead263720968e0e1b45739c \
--web3provider ws://127.0.0.1:8546 \
--datadir /path/to/your/datadir \
--genesis-json /path/to/your/genesis.json \
--rpc-port 4000 \
```

View File

@@ -1,36 +0,0 @@
{
"validatorRegistry": [
{
"pubkey": "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB",
"balance": "32000000000"
},
{
"pubkey": "QkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJC",
"balance": "32000000000"
},
{
"pubkey": "Q0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ND",
"balance": "32000000000"
},
{
"pubkey": "RERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERE",
"balance": "32000000000"
},
{
"pubkey": "RUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVF",
"balance": "32000000000"
},
{
"pubkey": "RkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZG",
"balance": "32000000000"
},
{
"pubkey": "R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dH",
"balance": "32000000000"
},
{
"pubkey": "SEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhISEhI",
"balance": "32000000000"
}
]
}