Rollback state to handle side chain with skip blocks (#2147)

* Add initial test

* chkpt

* add failing test

* add span to historical state lookup

* use db.HighestBlockSlot()

* fix comment

* update comment

* i wrote a test like a good programmer.

* add test back

* add assertion and unskip test, something new failing tho

* trying to fix test

* remove -1, not sure if i need it yet

* Revert "remove -1, not sure if i need it yet"

This reverts commit 2cfcbb8108.

* save historical state on every save state

* fix hsitorical states

* set historical state in initialize state

* change to a bool

* fix error with empty retrieval of states

* Add missing import

* fix test

* lock in receive block

* remove state generator

* Revert "lock in receive block"

This reverts commit 151b10829d.

* Fix Initial Sync Not Processing Canonical Block to Produce Canonical State (#2152)

* fix init sync

* fatal if highest observed root does not match

* proto fields

* Update beacon-chain/sync/initial-sync/service.go

* confirm canonical state root

* fix most tests

* failing test

* fix PR tests

* lint

* no simbackend changes

* logf revert

* add todo

* fix off by one

* fix test with deleted property

* merge #2157

* passing tests :)
This commit is contained in:
Preston Van Loon
2019-04-04 22:39:51 -05:00
committed by GitHub
parent 687f797dd8
commit 83130358a9
20 changed files with 554 additions and 470 deletions

View File

@@ -11,7 +11,6 @@ go_library(
visibility = ["//beacon-chain:__subpackages__"],
deps = [
"//beacon-chain/attestation:go_default_library",
"//beacon-chain/blockchain/stategenerator:go_default_library",
"//beacon-chain/core/blocks:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/state:go_default_library",

View File

@@ -41,7 +41,7 @@ type BlockProcessor interface {
func (c *ChainService) ReceiveBlock(ctx context.Context, block *pb.BeaconBlock) (*pb.BeaconState, error) {
ctx, span := trace.StartSpan(ctx, "beacon-chain.blockchain.ReceiveBlock")
defer span.End()
beaconState, err := c.beaconDB.State(ctx)
beaconState, err := c.beaconDB.HistoricalStateFromSlot(ctx, block.Slot-1)
if err != nil {
return nil, fmt.Errorf("could not retrieve beacon state: %v", err)
}
@@ -226,6 +226,11 @@ func (c *ChainService) runStateTransition(
log.WithField(
"slotsSinceGenesis", newState.Slot-params.BeaconConfig().GenesisSlot,
).Info("Block transition successfully processed")
// Save Historical States.
if err := c.beaconDB.SaveHistoricalState(beaconState); err != nil {
return nil, fmt.Errorf("could not save historical state: %v", err)
}
}
if helpers.IsEpochEnd(newState.Slot) {
@@ -241,10 +246,6 @@ func (c *ChainService) runStateTransition(
if err := c.updateFFGCheckPts(ctx, newState); err != nil {
return newState, fmt.Errorf("could not update FFG checkpts: %v", err)
}
// Save Historical States.
if err := c.beaconDB.SaveHistoricalState(newState); err != nil {
return newState, fmt.Errorf("could not save historical state: %v", err)
}
log.WithField(
"SlotsSinceGenesis", newState.Slot-params.BeaconConfig().GenesisSlot,
).Info("Epoch transition successfully processed")

View File

@@ -88,6 +88,10 @@ func TestReceiveBlock_ProcessCorrectly(t *testing.T) {
if err != nil {
t.Fatalf("Could not tree hash state: %v", err)
}
if err := db.SaveFinalizedState(beaconState); err != nil {
t.Fatal(err)
}
parentHash, genesisBlock := setupGenesisBlock(t, chainService, beaconState)
if err := chainService.beaconDB.UpdateChainHead(ctx, genesisBlock, beaconState); err != nil {
t.Fatal(err)
@@ -148,6 +152,10 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) {
if err := chainService.beaconDB.SaveJustifiedState(beaconState); err != nil {
t.Fatal(err)
}
if err := db.SaveFinalizedState(beaconState); err != nil {
t.Fatal(err)
}
stateRoot, err := hashutil.HashProto(beaconState)
if err != nil {
t.Fatalf("Could not tree hash state: %v", err)
@@ -182,6 +190,9 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) {
}
depositRoot := depositTrie.Root()
beaconState.LatestEth1Data.DepositRootHash32 = depositRoot[:]
if err := db.SaveHistoricalState(beaconState); err != nil {
t.Fatal(err)
}
block := &pb.BeaconBlock{
Slot: currentSlot + 1,
@@ -221,6 +232,9 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) {
if err := chainService.beaconDB.SaveState(ctx, beaconState); err != nil {
t.Fatal(err)
}
if err := db.SaveHistoricalState(beaconState); err != nil {
t.Fatal(err)
}
computedState, err := chainService.ReceiveBlock(context.Background(), block)
if err != nil {
t.Fatal(err)
@@ -243,6 +257,162 @@ func TestReceiveBlock_RemovesPendingDeposits(t *testing.T) {
testutil.AssertLogsContain(t, hook, "Executing state transition")
}
// Scenario graph: http://bit.ly/2K1k2KZ
//
//digraph G {
// rankdir=LR;
// node [shape="none"];
//
// subgraph blocks {
// rankdir=LR;
// node [shape="box"];
// a->b;
// b->c;
// c->e;
// c->f;
// f->g;
// e->h;
// }
//
// { rank=same; 1; a;}
// { rank=same; 2; b;}
// { rank=same; 3; c;}
// { rank=same; 5; e;}
// { rank=same; 6; f;}
// { rank=same; 7; g;}
// { rank=same; 8; h;}
//
// 1->2->3->4->5->6->7->8->9[arrowhead=none];
//}
func TestReceiveBlock_OnChainSplit(t *testing.T) {
// The scenario to test is that we think that the canonical head is block H
// and then we receive block G. We don't have block F, so we request it. Then
// we process F, the G. The expected behavior is that we load the historical
// state from slot 3 where the common ancestor block C is present.
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)
ctx := context.Background()
chainService := setupBeaconChain(t, db, nil)
deposits, privKeys := setupInitialDeposits(t, 100)
eth1Data := &pb.Eth1Data{
DepositRootHash32: []byte{},
BlockHash32: []byte{},
}
beaconState, err := state.GenesisBeaconState(deposits, 0, eth1Data)
if err != nil {
t.Fatalf("Can't generate genesis state: %v", err)
}
stateRoot, err := hashutil.HashProto(beaconState)
if err != nil {
t.Fatalf("Could not tree hash state: %v", err)
}
parentHash, genesisBlock := setupGenesisBlock(t, chainService, beaconState)
if err := db.UpdateChainHead(ctx, genesisBlock, beaconState); err != nil {
t.Fatal(err)
}
if err := db.SaveFinalizedState(beaconState); err != nil {
t.Fatal(err)
}
genesisSlot := params.BeaconConfig().GenesisSlot
// Top chain slots (see graph)
blockSlots := []uint64{1, 2, 3, 5, 8}
for _, slot := range blockSlots {
block := &pb.BeaconBlock{
Slot: genesisSlot + slot,
StateRootHash32: stateRoot[:],
ParentRootHash32: parentHash[:],
RandaoReveal: createRandaoReveal(t, beaconState, privKeys),
Body: &pb.BeaconBlockBody{},
}
computedState, err := chainService.ReceiveBlock(ctx, block)
if err != nil {
t.Fatal(err)
}
stateRoot, err = hashutil.HashProto(computedState)
if err != nil {
t.Fatal(err)
}
if err = db.SaveBlock(block); err != nil {
t.Fatal(err)
}
if err = db.UpdateChainHead(ctx, block, computedState); err != nil {
t.Fatal(err)
}
parentHash, err = hashutil.HashBeaconBlock(block)
if err != nil {
t.Fatal(err)
}
}
// Common ancestor is block at slot 3
commonAncestor, err := db.BlockBySlot(genesisSlot + 3)
if err != nil {
t.Fatal(err)
}
parentHash, err = hashutil.HashBeaconBlock(commonAncestor)
if err != nil {
t.Fatal(err)
}
beaconState, err = db.HistoricalStateFromSlot(ctx, commonAncestor.Slot)
if err != nil {
t.Fatal(err)
}
stateRoot, err = hashutil.HashProto(beaconState)
if err != nil {
t.Fatal(err)
}
// Then we receive the block `f` from slot 6
blockF := &pb.BeaconBlock{
Slot: genesisSlot + 6,
ParentRootHash32: parentHash[:],
StateRootHash32: stateRoot[:],
RandaoReveal: createRandaoReveal(t, beaconState, privKeys),
Body: &pb.BeaconBlockBody{},
}
computedState, err := chainService.ReceiveBlock(ctx, blockF)
if err != nil {
t.Fatal(err)
}
stateRoot, err = hashutil.HashProto(computedState)
if err != nil {
t.Fatal(err)
}
if err := db.SaveBlock(blockF); err != nil {
t.Fatal(err)
}
parentHash, err = hashutil.HashBeaconBlock(blockF)
if err != nil {
t.Fatal(err)
}
// Then we apply block `g` from slot 7
blockG := &pb.BeaconBlock{
Slot: genesisSlot + 7,
ParentRootHash32: parentHash[:],
StateRootHash32: stateRoot[:],
RandaoReveal: createRandaoReveal(t, computedState, privKeys),
Body: &pb.BeaconBlockBody{},
}
computedState, err = chainService.ReceiveBlock(ctx, blockG)
if err != nil {
t.Fatal(err)
}
if computedState.Slot != blockG.Slot {
t.Errorf("Unexpect state slot %d, wanted %d", computedState.Slot, blockG.Slot)
}
}
func TestIsBlockReadyForProcessing_ValidBlock(t *testing.T) {
db := internal.SetupDB(t)
defer internal.TeardownDB(t, db)

View File

@@ -6,7 +6,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain/stategenerator"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/db"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
@@ -58,12 +57,12 @@ func (c *ChainService) updateFFGCheckPts(ctx context.Context, state *pb.BeaconSt
return err
}
}
// Generate the new justified state with using new justified block and save it.
newJustifiedState, err := stategenerator.GenerateStateFromBlock(ctx, c.beaconDB, lastJustifiedSlot)
// Fetch justified state from historical states db.
newJustifiedState, err := c.beaconDB.HistoricalStateFromSlot(ctx, newJustifiedBlock.Slot)
if err != nil {
return err
}
if err := c.beaconDB.SaveJustifiedBlock(newJustifiedBlock); err != nil {
return err
}
@@ -98,8 +97,9 @@ func (c *ChainService) updateFFGCheckPts(ctx context.Context, state *pb.BeaconSt
}
}
// Generate the new finalized state with using new finalized block and save it.
newFinalizedState, err := stategenerator.GenerateStateFromBlock(ctx, c.beaconDB, lastFinalizedSlot)
// Generate the new finalized state with using new finalized block and
// save it.
newFinalizedState, err := c.beaconDB.HistoricalStateFromSlot(ctx, lastFinalizedSlot)
if err != nil {
return err
}
@@ -148,7 +148,7 @@ func (c *ChainService) ApplyForkChoiceRule(
block.Slot-params.BeaconConfig().GenesisSlot, head.Slot-params.BeaconConfig().GenesisSlot)
// Only regenerate head state if there was a reorg.
newState, err = stategenerator.GenerateStateFromBlock(ctx, c.beaconDB, head.Slot)
newState, err = c.beaconDB.HistoricalStateFromSlot(ctx, head.Slot)
if err != nil {
return fmt.Errorf("could not gen state: %v", err)
}

View File

@@ -1236,6 +1236,9 @@ func TestUpdateFFGCheckPts_NewJustifiedSkipSlot(t *testing.T) {
if err := chainSvc.beaconDB.SaveBlock(block); err != nil {
t.Fatal(err)
}
if err := chainSvc.beaconDB.SaveState(ctx, &pb.BeaconState{Slot: genesisSlot + lastAvailableSlot}); err != nil {
t.Fatal(err)
}
if err := chainSvc.beaconDB.UpdateChainHead(ctx, block, gState); err != nil {
t.Fatal(err)
}
@@ -1253,7 +1256,7 @@ func TestUpdateFFGCheckPts_NewJustifiedSkipSlot(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if newJustifiedState.Slot-genesisSlot != offset {
if newJustifiedState.Slot-genesisSlot != lastAvailableSlot {
t.Errorf("Wanted justification state slot: %d, got: %d",
offset, newJustifiedState.Slot-genesisSlot)
}

View File

@@ -25,7 +25,7 @@ var log = logrus.WithField("prefix", "stategenerator")
func GenerateStateFromBlock(ctx context.Context, db *db.BeaconDB, slot uint64) (*pb.BeaconState, error) {
ctx, span := trace.StartSpan(ctx, "beacon-chain.blockchain.stategenerator.GenerateStateFromBlock")
defer span.End()
fState, err := db.HistoricalStateFromSlot(slot)
fState, err := db.HistoricalStateFromSlot(ctx, slot)
if err != nil {
return nil, err
}

View File

@@ -343,6 +343,28 @@ func TestFinalizedBlock_CanSaveRetrieve(t *testing.T) {
}
}
func TestHasBlock_returnsTrue(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
block := &pb.BeaconBlock{
Slot: uint64(44),
}
root, err := hashutil.HashBeaconBlock(block)
if err != nil {
t.Fatal(err)
}
if err := db.SaveBlock(block); err != nil {
t.Fatal(err)
}
if !db.HasBlock(root) {
t.Fatal("db.HasBlock returned false for block just saved")
}
}
func TestHighestBlockSlot_UpdatedOnSaveBlock(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)

View File

@@ -46,6 +46,10 @@ func (db *BeaconDB) InitializeState(genesisTime uint64, deposits []*pb.Deposit,
db.currentState = beaconState
if err := db.SaveHistoricalState(beaconState); err != nil {
return err
}
return db.update(func(tx *bolt.Tx) error {
blockBkt := tx.Bucket(blockBucket)
validatorBkt := tx.Bucket(validatorBucket)
@@ -139,6 +143,10 @@ func (db *BeaconDB) SaveState(ctx context.Context, beaconState *pb.BeaconState)
db.currentState = currentState
cloneSpan.End()
if err := db.SaveHistoricalState(beaconState); err != nil {
return err
}
return db.update(func(tx *bolt.Tx) error {
chainInfo := tx.Bucket(chainInfoBucket)
@@ -186,9 +194,9 @@ func (db *BeaconDB) SaveJustifiedState(beaconState *pb.BeaconState) error {
// SaveFinalizedState saves the last finalized state in the db.
func (db *BeaconDB) SaveFinalizedState(beaconState *pb.BeaconState) error {
finalizedSlot := beaconState.FinalizedEpoch * params.BeaconConfig().SlotsPerEpoch
// Delete historical states if we are saving a new finalized state.
if err := db.deleteHistoricalStates(finalizedSlot); err != nil {
if err := db.deleteHistoricalStates(beaconState.Slot); err != nil {
return err
}
return db.update(func(tx *bolt.Tx) error {
@@ -203,15 +211,8 @@ func (db *BeaconDB) SaveFinalizedState(beaconState *pb.BeaconState) error {
// SaveHistoricalState saves the last finalized state in the db.
func (db *BeaconDB) SaveHistoricalState(beaconState *pb.BeaconState) error {
slotSinceGenesis := beaconState.Slot - params.BeaconConfig().GenesisSlot
// Do not save state, if slot diff is not
// a power of 2.
if slotSinceGenesis%params.BeaconConfig().SlotsPerEpoch != 0 {
return nil
}
slotBinary := encodeSlotNumber(slotSinceGenesis)
slotBinary := encodeSlotNumber(beaconState.Slot)
stateHash, err := hashutil.HashProto(beaconState)
if err != nil {
return err
@@ -240,9 +241,8 @@ func (db *BeaconDB) SaveCurrentAndFinalizedState(ctx context.Context, beaconStat
return err
}
finalizedSlot := beaconState.FinalizedEpoch * params.BeaconConfig().SlotsPerEpoch
// Delete historical states if we are saving a new finalized state.
if err := db.deleteHistoricalStates(finalizedSlot); err != nil {
if err := db.deleteHistoricalStates(beaconState.Slot); err != nil {
return err
}
return db.update(func(tx *bolt.Tx) error {
@@ -295,20 +295,15 @@ func (db *BeaconDB) FinalizedState() (*pb.BeaconState, error) {
}
// HistoricalStateFromSlot retrieves the closest historical state to a slot.
func (db *BeaconDB) HistoricalStateFromSlot(slot uint64) (*pb.BeaconState, error) {
state, err := db.FinalizedState()
if err != nil {
return nil, fmt.Errorf("unable to retrieve finalized state %v", err)
}
slotSinceGenesis := slot - params.BeaconConfig().GenesisSlot
if slotSinceGenesis%params.BeaconConfig().SlotsPerEpoch != 0 {
return state, nil
}
func (db *BeaconDB) HistoricalStateFromSlot(ctx context.Context, slot uint64) (*pb.BeaconState, error) {
_, span := trace.StartSpan(ctx, "BeaconDB.HistoricalStateFromSlot")
defer span.End()
span.AddAttributes(trace.Int64Attribute("slotSinceGenesis", int64(slot)))
var beaconState *pb.BeaconState
err = db.view(func(tx *bolt.Tx) error {
err := db.view(func(tx *bolt.Tx) error {
var err error
var highestStateSlot uint64
var stateExists bool
histStateKey := make([]byte, 32)
chainInfo := tx.Bucket(chainInfoBucket)
@@ -317,20 +312,28 @@ func (db *BeaconDB) HistoricalStateFromSlot(slot uint64) (*pb.BeaconState, error
for k, v := hsCursor.First(); k != nil; k, v = hsCursor.Next() {
slotNumber := decodeToSlotNumber(k)
if slotNumber == slotSinceGenesis {
if slotNumber == slot {
stateExists = true
highestStateSlot = slotNumber
histStateKey = v
break
}
}
// If no state exists send the finalized state to be unencoded.
if highestStateSlot == 0 {
encState := chainInfo.Get(finalizedStateLookupKey)
if encState == nil {
return errors.New("no finalized state saved")
// If no state exists send the closest state.
if !stateExists {
for k, v := hsCursor.First(); k != nil; k, v = hsCursor.Next() {
slotNumber := decodeToSlotNumber(k)
// find the state with slot closest to the requested slot
if slotNumber > highestStateSlot && slotNumber <= slot {
stateExists = true
highestStateSlot = slotNumber
histStateKey = v
}
}
if !stateExists {
return errors.New("no historical states saved in db")
}
beaconState, err = createState(encState)
return err
}
// retrieve the stored historical state.
@@ -371,11 +374,10 @@ func (db *BeaconDB) deleteHistoricalStates(slot uint64) error {
histState := tx.Bucket(histStateBucket)
chainInfo := tx.Bucket(chainInfoBucket)
hsCursor := histState.Cursor()
slotSinceGenesis := slot - params.BeaconConfig().GenesisSlot
for k, v := hsCursor.First(); k != nil; k, v = hsCursor.Next() {
keySlotNumber := decodeToSlotNumber(k)
if keySlotNumber <= slotSinceGenesis {
if keySlotNumber < slot {
if err := histState.Delete(k); err != nil {
return err
}

View File

@@ -286,6 +286,7 @@ func TestFinalizedState_CanSaveRetrieve(t *testing.T) {
func TestHistoricalState_CanSaveRetrieve(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
ctx := context.Background()
tests := []struct {
state *pb.BeaconState
@@ -330,7 +331,7 @@ func TestHistoricalState_CanSaveRetrieve(t *testing.T) {
t.Fatalf("could not save historical state: %v", err)
}
retState, err := db.HistoricalStateFromSlot(tt.state.Slot)
retState, err := db.HistoricalStateFromSlot(ctx, tt.state.Slot)
if err != nil {
t.Fatalf("Unable to retrieve state %v", err)
}
@@ -344,6 +345,7 @@ func TestHistoricalState_CanSaveRetrieve(t *testing.T) {
func TestHistoricalState_Pruning(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
ctx := context.Background()
epochSize := params.BeaconConfig().SlotsPerEpoch
slotGen := func(slot uint64) uint64 {
@@ -351,86 +353,60 @@ func TestHistoricalState_Pruning(t *testing.T) {
}
tests := []struct {
finalizedState *pb.BeaconState
histState1 *pb.BeaconState
histState2 *pb.BeaconState
histState1 *pb.BeaconState
histState2 *pb.BeaconState
}{
{
finalizedState: &pb.BeaconState{
Slot: slotGen(2 * epochSize),
FinalizedEpoch: 2,
},
histState1: &pb.BeaconState{
Slot: slotGen(1 * epochSize),
FinalizedEpoch: 1,
Slot: slotGen(0 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(4 * epochSize),
FinalizedEpoch: 2,
Slot: slotGen(1 * epochSize),
},
},
{
finalizedState: &pb.BeaconState{
Slot: slotGen(4 * epochSize),
FinalizedEpoch: 4,
},
histState1: &pb.BeaconState{
Slot: slotGen(2 * epochSize),
FinalizedEpoch: 2,
Slot: slotGen(1 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(5 * epochSize),
FinalizedEpoch: 4,
Slot: slotGen(4 * epochSize),
},
},
{
finalizedState: &pb.BeaconState{
Slot: slotGen(12 * epochSize),
FinalizedEpoch: 12,
},
histState1: &pb.BeaconState{
Slot: slotGen(6 * epochSize),
FinalizedEpoch: 6,
Slot: slotGen(2 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(14 * epochSize),
FinalizedEpoch: 14,
Slot: slotGen(5 * epochSize),
},
},
{
finalizedState: &pb.BeaconState{
Slot: slotGen(100 * epochSize),
FinalizedEpoch: 100,
},
histState1: &pb.BeaconState{
Slot: slotGen(12 * epochSize),
FinalizedEpoch: 12,
Slot: slotGen(6 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(103 * epochSize),
FinalizedEpoch: 103,
Slot: slotGen(14 * epochSize),
},
},
{
finalizedState: &pb.BeaconState{
Slot: slotGen(500 * epochSize),
FinalizedEpoch: 500,
},
histState1: &pb.BeaconState{
Slot: slotGen(100 * epochSize),
FinalizedEpoch: 100,
Slot: slotGen(12 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(600 * epochSize),
FinalizedEpoch: 600,
Slot: slotGen(103 * epochSize),
},
},
{
histState1: &pb.BeaconState{
Slot: slotGen(100 * epochSize),
},
histState2: &pb.BeaconState{
Slot: slotGen(600 * epochSize),
},
},
}
for _, tt := range tests {
if err := db.SaveFinalizedState(tt.finalizedState); err != nil {
t.Fatalf("could not save finalized state: %v", err)
}
if err := db.SaveHistoricalState(tt.histState1); err != nil {
t.Fatalf("could not save historical state: %v", err)
}
@@ -438,20 +414,26 @@ func TestHistoricalState_Pruning(t *testing.T) {
t.Fatalf("could not save historical state: %v", err)
}
if err := db.deleteHistoricalStates(tt.finalizedState.Slot); err != nil {
// Delete up to and including historical state 1.
if err := db.deleteHistoricalStates(tt.histState1.Slot + 1); err != nil {
t.Fatalf("Could not delete historical states %v", err)
}
retState, err := db.HistoricalStateFromSlot(tt.histState1.Slot)
// Save a dummy genesis state so that db doesnt return an error.
if err := db.SaveHistoricalState(&pb.BeaconState{Slot: slotGen(0), FinalizedEpoch: 1}); err != nil {
t.Fatalf("could not save historical state: %v", err)
}
retState, err := db.HistoricalStateFromSlot(ctx, tt.histState1.Slot)
if err != nil {
t.Fatalf("Unable to retrieve state %v", err)
}
if proto.Equal(tt.histState1, retState) {
t.Errorf("Saved and retrieved states are equal when they aren't supposed to be for slot %d", retState.Slot)
t.Errorf("Saved and retrieved states are equal when they supposed to be different %d", tt.histState1.Slot-params.BeaconConfig().GenesisSlot)
}
retState, err = db.HistoricalStateFromSlot(tt.histState2.Slot)
retState, err = db.HistoricalStateFromSlot(ctx, tt.histState2.Slot)
if err != nil {
t.Fatalf("Unable to retrieve state %v", err)
}

View File

@@ -23,6 +23,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/db"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/event"
"github.com/prysmaticlabs/prysm/shared/hashutil"
"github.com/prysmaticlabs/prysm/shared/p2p"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/sirupsen/logrus"
@@ -85,30 +86,29 @@ type syncService interface {
// InitialSync defines the main class in this package.
// See the package comments for a general description of the service's functions.
type InitialSync struct {
ctx context.Context
cancel context.CancelFunc
p2p p2pAPI
syncService syncService
chainService chainService
db *db.BeaconDB
powchain powChainService
blockAnnounceBuf chan p2p.Message
batchedBlockBuf chan p2p.Message
blockBuf chan p2p.Message
stateBuf chan p2p.Message
currentSlot uint64
highestObservedSlot uint64
beaconStateSlot uint64
syncPollingInterval time.Duration
inMemoryBlocks map[uint64]*pb.BeaconBlock
syncedFeed *event.Feed
stateReceived bool
latestSyncedBlock *pb.BeaconBlock
lastRequestedSlot uint64
finalizedStateRoot [32]byte
mutex *sync.Mutex
nodeIsSynced bool
highestObservedCanonicalState *pb.BeaconState
ctx context.Context
cancel context.CancelFunc
p2p p2pAPI
syncService syncService
chainService chainService
db *db.BeaconDB
powchain powChainService
blockAnnounceBuf chan p2p.Message
batchedBlockBuf chan p2p.Message
blockBuf chan p2p.Message
stateBuf chan p2p.Message
currentSlot uint64
highestObservedSlot uint64
highestObservedRoot [32]byte
beaconStateSlot uint64
syncPollingInterval time.Duration
inMemoryBlocks map[uint64]*pb.BeaconBlock
syncedFeed *event.Feed
stateReceived bool
lastRequestedSlot uint64
finalizedStateRoot [32]byte
mutex *sync.Mutex
nodeIsSynced bool
}
// NewInitialSyncService constructs a new InitialSyncService.
@@ -170,6 +170,11 @@ func (s *InitialSync) InitializeObservedSlot(slot uint64) {
s.highestObservedSlot = slot
}
// InitializeObservedStateRoot sets the highest observed state root.
func (s *InitialSync) InitializeObservedStateRoot(root [32]byte) {
s.highestObservedRoot = root
}
// InitializeFinalizedStateRoot sets the state root of the last finalized state.
func (s *InitialSync) InitializeFinalizedStateRoot(root [32]byte) {
s.finalizedStateRoot = root
@@ -180,26 +185,47 @@ func (s *InitialSync) NodeIsSynced() (bool, uint64) {
return s.nodeIsSynced, s.currentSlot
}
func (s *InitialSync) exitInitialSync(ctx context.Context) error {
func (s *InitialSync) exitInitialSync(ctx context.Context, block *pb.BeaconBlock) error {
if s.nodeIsSynced {
return nil
}
state := s.highestObservedCanonicalState
var err error
if err := s.db.SaveBlock(s.latestSyncedBlock); err != nil {
return fmt.Errorf("could not save block: %v", err)
state, err := s.db.State(ctx)
if err != nil {
return err
}
if err := s.db.UpdateChainHead(ctx, s.latestSyncedBlock, state); err != nil {
return fmt.Errorf("could not update chain head: %v", err)
if err := s.chainService.VerifyBlockValidity(ctx, block, state); err != nil {
return err
}
if err := s.db.SaveHistoricalState(state); err != nil {
return fmt.Errorf("could not save state: %v", err)
if err := s.db.SaveBlock(block); err != nil {
return err
}
state, err = s.chainService.ApplyBlockStateTransition(ctx, block, state)
if err != nil {
return err
}
if err := s.chainService.CleanupBlockOperations(ctx, block); err != nil {
return err
}
if err := s.db.UpdateChainHead(ctx, block, state); err != nil {
return err
}
canonicalState, err := s.db.State(ctx)
if err != nil {
return fmt.Errorf("could not get state: %v", err)
}
stateRoot, err := hashutil.HashProto(canonicalState)
if err != nil {
return fmt.Errorf("could not hash state: %v", err)
}
if stateRoot != s.highestObservedRoot {
// TODO(#2155): Instead of a fatal call, drop the peer and restart the initial sync service.
log.Fatalf(
"Canonical state root %#x does not match highest observed root from peer %#x",
stateRoot,
s.highestObservedRoot,
)
}
log.Infof("Canonical state slot: %d", canonicalState.Slot-params.BeaconConfig().GenesisSlot)
log.Info("Exiting initial sync and starting normal sync")
s.syncService.ResumeSync()

View File

@@ -152,17 +152,9 @@ func TestSavingBlock_InSync(t *testing.T) {
BlockHash32: []byte{},
},
}
jState := &pb.BeaconState{
JustifiedEpoch: params.BeaconConfig().GenesisEpoch + 2,
LatestBlock: &pb.BeaconBlock{
Slot: params.BeaconConfig().GenesisSlot + 2*params.BeaconConfig().SlotsPerEpoch,
},
}
stateResponse := &pb.BeaconStateResponse{
FinalizedState: fState,
JustifiedState: jState,
CanonicalState: jState,
}
incorrectState := &pb.BeaconState{
@@ -178,8 +170,6 @@ func TestSavingBlock_InSync(t *testing.T) {
incorrectStateResponse := &pb.BeaconStateResponse{
FinalizedState: incorrectState,
JustifiedState: incorrectState,
CanonicalState: incorrectState,
}
stateRoot, err := hashutil.HashProto(fState)
@@ -276,6 +266,16 @@ func TestProcessingBatchedBlocks_OK(t *testing.T) {
ss.processBatchedBlocks(msg)
state, err := db.State(context.Background())
if err != nil {
t.Fatal(err)
}
stateRoot, err := hashutil.HashProto(state)
if err != nil {
t.Fatal(err)
}
ss.highestObservedRoot = stateRoot
if ss.currentSlot != expectedSlot {
t.Errorf("Expected slot %d equal to current slot %d", expectedSlot, ss.currentSlot)
}
@@ -301,9 +301,6 @@ func TestProcessingBlocks_SkippedSlots(t *testing.T) {
batchSize := 20
expectedSlot := params.BeaconConfig().GenesisSlot + uint64(batchSize)
ss.highestObservedSlot = expectedSlot
ss.highestObservedCanonicalState = &pb.BeaconState{
Slot: expectedSlot,
}
blk, err := ss.db.BlockBySlot(params.BeaconConfig().GenesisSlot)
if err != nil {
t.Fatalf("Unable to get genesis block %v", err)
@@ -313,6 +310,15 @@ func TestProcessingBlocks_SkippedSlots(t *testing.T) {
t.Fatalf("Unable to hash block %v", err)
}
parentHash := h[:]
state, err := db.State(context.Background())
if err != nil {
t.Fatal(err)
}
stateRoot, err := hashutil.HashProto(state)
if err != nil {
t.Fatal(err)
}
ss.highestObservedRoot = stateRoot
for i := 1; i <= batchSize; i++ {
// skip slots
@@ -337,7 +343,15 @@ func TestProcessingBlocks_SkippedSlots(t *testing.T) {
t.Fatalf("Could not hash block %v", err)
}
parentHash = hash[:]
ss.latestSyncedBlock = block
state, err := db.State(context.Background())
if err != nil {
t.Fatal(err)
}
stateRoot, err := hashutil.HashProto(state)
if err != nil {
t.Fatal(err)
}
ss.highestObservedRoot = stateRoot
}
if ss.currentSlot != expectedSlot {

View File

@@ -34,7 +34,7 @@ func (s *InitialSync) processBlock(ctx context.Context, block *pb.BeaconBlock) {
if block.Slot == s.highestObservedSlot {
s.currentSlot = s.highestObservedSlot
if err := s.exitInitialSync(s.ctx); err != nil {
if err := s.exitInitialSync(s.ctx, block); err != nil {
log.Errorf("Could not exit initial sync: %v", err)
return
}
@@ -143,7 +143,6 @@ func (s *InitialSync) validateAndSaveNextBlock(ctx context.Context, block *pb.Be
}
log.Infof("Saving block with root %#x and slot %d for initial sync", root, block.Slot-params.BeaconConfig().GenesisSlot)
s.currentSlot = block.Slot
s.latestSyncedBlock = block
s.mutex.Lock()
defer s.mutex.Unlock()

View File

@@ -15,8 +15,6 @@ func (s *InitialSync) processState(msg p2p.Message) {
defer span.End()
data := msg.Data.(*pb.BeaconStateResponse)
finalizedState := data.FinalizedState
justifiedState := data.JustifiedState
canonicalState := data.CanonicalState
recState.Inc()
if err := s.db.SaveFinalizedState(finalizedState); err != nil {
@@ -39,22 +37,12 @@ func (s *InitialSync) processState(msg p2p.Message) {
return
}
if err := s.db.SaveJustifiedState(justifiedState); err != nil {
if err := s.db.SaveJustifiedState(finalizedState); err != nil {
log.Errorf("Could not set beacon state for initial sync %v", err)
return
}
if err := s.db.SaveHistoricalState(justifiedState); err != nil {
log.Errorf("Could not save new historical state: %v", err)
return
}
if err := s.db.SaveJustifiedBlock(justifiedState.LatestBlock); err != nil {
log.Errorf("Could not save finalized block %v", err)
return
}
if err := s.db.SaveBlock(justifiedState.LatestBlock); err != nil {
if err := s.db.SaveJustifiedBlock(finalizedState.LatestBlock); err != nil {
log.Errorf("Could not save finalized block %v", err)
return
}
@@ -71,17 +59,8 @@ func (s *InitialSync) processState(msg p2p.Message) {
s.db.PrunePendingDeposits(ctx, blkNum)
if err := s.db.SaveBlock(canonicalState.LatestBlock); err != nil {
log.Errorf("Could not save block %v", err)
return
}
if err := s.db.UpdateChainHead(ctx, finalizedState.LatestBlock, finalizedState); err != nil {
log.Errorf("Could not update chain head %v", err)
return
}
if err := s.db.SaveHistoricalState(canonicalState); err != nil {
log.Errorf("Could not save new historical state: %v", err)
log.Errorf("Could not update chain head: %v", err)
return
}
@@ -89,12 +68,9 @@ func (s *InitialSync) processState(msg p2p.Message) {
// beacon state to begin our sync from.
s.currentSlot = finalizedState.Slot
s.stateReceived = true
s.highestObservedCanonicalState = canonicalState
s.highestObservedSlot = canonicalState.Slot
log.Debugf(
"Successfully saved beacon state with the last finalized slot: %d, canonical slot: %d",
"Successfully saved beacon state with the last finalized slot: %d",
finalizedState.Slot-params.BeaconConfig().GenesisSlot,
canonicalState.Slot-params.BeaconConfig().GenesisSlot,
)
s.requestBatchedBlocks(s.currentSlot+1, s.highestObservedSlot)
s.lastRequestedSlot = s.highestObservedSlot

View File

@@ -50,7 +50,7 @@ type Querier struct {
db *db.BeaconDB
chainService chainService
currentHeadSlot uint64
currentHeadHash []byte
currentStateRoot []byte
currentFinalizedStateRoot [32]byte
responseBuf chan p2p.Message
chainStartBuf chan time.Time
@@ -161,9 +161,12 @@ func (q *Querier) run() {
q.RequestLatestHead()
case msg := <-q.responseBuf:
response := msg.Data.(*pb.ChainHeadResponse)
queryLog.Infof("Latest chain head is at slot: %d and hash %#x", response.Slot-params.BeaconConfig().GenesisSlot, response.Hash)
q.currentHeadSlot = response.Slot
q.currentHeadHash = response.Hash
queryLog.Infof(
"Latest chain head is at slot: %d and state root: %#x",
response.CanonicalSlot-params.BeaconConfig().GenesisSlot, response.CanonicalStateRootHash32,
)
q.currentHeadSlot = response.CanonicalSlot
q.currentStateRoot = response.CanonicalStateRootHash32
q.currentFinalizedStateRoot = bytesutil.ToBytes32(response.FinalizedStateRootHash32S)
ticker.Stop()

View File

@@ -146,8 +146,8 @@ func TestQuerier_ChainReqResponse(t *testing.T) {
}()
response := &pb.ChainHeadResponse{
Slot: 0,
Hash: []byte{'a', 'b'},
CanonicalSlot: 0,
CanonicalStateRootHash32: []byte{'a', 'b'},
}
msg := p2p.Message{
@@ -157,8 +157,8 @@ func TestQuerier_ChainReqResponse(t *testing.T) {
sq.responseBuf <- msg
expMsg := fmt.Sprintf(
"Latest chain head is at slot: %d and hash %#x",
response.Slot-params.BeaconConfig().GenesisSlot, response.Hash,
"Latest chain head is at slot: %d and state root: %#x",
response.CanonicalSlot-params.BeaconConfig().GenesisSlot, response.CanonicalStateRootHash32,
)
<-exitRoutine

View File

@@ -348,20 +348,8 @@ func (rs *RegularSync) handleStateRequest(msg p2p.Message) error {
"beaconState", fmt.Sprintf("%#x", root),
).Debug("Sending finalized, justified, and canonical states to peer")
defer sentState.Inc()
jState, err := rs.db.JustifiedState()
if err != nil {
log.Errorf("Unable to retrieve justified state, %v", err)
return err
}
canonicalState, err := rs.db.State(ctx)
if err != nil {
log.Errorf("Unable to retrieve canonical beacon state, %v", err)
return err
}
resp := &pb.BeaconStateResponse{
FinalizedState: fState,
JustifiedState: jState,
CanonicalState: canonicalState,
}
if err := rs.p2p.Send(ctx, resp, msg.Peer); err != nil {
log.Error(err)
@@ -384,10 +372,15 @@ func (rs *RegularSync) handleChainHeadRequest(msg p2p.Message) error {
log.Errorf("Could not retrieve chain head %v", err)
return err
}
blockRoot, err := hashutil.HashBeaconBlock(block)
currentState, err := rs.db.State(ctx)
if err != nil {
log.Errorf("Could not tree hash block %v", err)
log.Errorf("Could not retrieve current state %v", err)
return err
}
stateRoot, err := hashutil.HashProto(currentState)
if err != nil {
log.Errorf("Could not tree hash state %v", err)
return err
}
@@ -404,8 +397,8 @@ func (rs *RegularSync) handleChainHeadRequest(msg p2p.Message) error {
}
req := &pb.ChainHeadResponse{
Slot: block.Slot,
Hash: blockRoot[:],
CanonicalSlot: block.Slot,
CanonicalStateRootHash32: stateRoot[:],
FinalizedStateRootHash32S: finalizedRoot[:],
}
ctx, ChainHead := trace.StartSpan(ctx, "sendChainHead")

View File

@@ -6,6 +6,7 @@ import (
"github.com/prysmaticlabs/prysm/beacon-chain/db"
"github.com/prysmaticlabs/prysm/beacon-chain/operations"
initialsync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/sirupsen/logrus"
)
@@ -109,6 +110,7 @@ func (ss *Service) run() {
// Sets the highest observed slot from querier.
ss.InitialSync.InitializeObservedSlot(ss.Querier.currentHeadSlot)
ss.InitialSync.InitializeObservedStateRoot(bytesutil.ToBytes32(ss.Querier.currentStateRoot))
// Sets the state root of the highest observed slot.
ss.InitialSync.InitializeFinalizedStateRoot(ss.Querier.currentFinalizedStateRoot)
ss.InitialSync.Start()

View File

@@ -121,8 +121,8 @@ func setupSimBackendAndDB(t *testing.T) (*backend.SimulatedBackend, *db.BeaconDB
return bd, beacondb, privKeys
}
func setUpSyncedService(numOfBlocks int, simP2P *simulatedP2P, t *testing.T) (*Service, *db.BeaconDB) {
bd, beacondb, privKeys := setupSimBackendAndDB(t)
func setUpSyncedService(numOfBlocks int, simP2P *simulatedP2P, t *testing.T) (*Service, *db.BeaconDB, [32]byte) {
bd, beacondb, _ := setupSimBackendAndDB(t)
defer bd.Shutdown()
defer db.TeardownDB(bd.DB())
ctx := context.Background()
@@ -153,20 +153,47 @@ func setUpSyncedService(numOfBlocks int, simP2P *simulatedP2P, t *testing.T) (*S
mockChain.sFeed.Send(time.Now())
}
for i := 1; i <= numOfBlocks; i++ {
if err := bd.GenerateBlockAndAdvanceChain(&backend.SimulatedObjects{}, privKeys); err != nil {
t.Fatalf("Unable to generate block in simulated backend %v", err)
}
blocks := bd.InMemoryBlocks()
if err := beacondb.SaveBlock(blocks[i]); err != nil {
t.Fatalf("Unable to save block %v", err)
}
if err := beacondb.UpdateChainHead(ctx, blocks[i], bd.State()); err != nil {
t.Fatalf("Unable to update chain head %v", err)
}
state, err := beacondb.State(ctx)
if err != nil {
t.Fatal(err)
}
inMemoryBlocks := bd.InMemoryBlocks()
genesisBlock := inMemoryBlocks[0]
stateRoot, err := hashutil.HashProto(state)
if err != nil {
t.Fatal(err)
}
parentRoot, err := hashutil.HashBeaconBlock(genesisBlock)
if err != nil {
t.Fatal(err)
}
return ss, beacondb
for i := 1; i <= numOfBlocks; i++ {
block := &pb.BeaconBlock{
Slot: params.BeaconConfig().GenesisSlot + uint64(i),
ParentRootHash32: parentRoot[:],
StateRootHash32: stateRoot[:],
}
state, err = mockChain.ApplyBlockStateTransition(ctx, block, state)
if err != nil {
t.Fatal(err)
}
stateRoot, err = hashutil.HashProto(state)
if err != nil {
t.Fatal(err)
}
parentRoot, err = hashutil.HashBeaconBlock(block)
if err := mockChain.CleanupBlockOperations(ctx, block); err != nil {
t.Fatal(err)
}
if err := beacondb.SaveBlock(block); err != nil {
t.Fatal(err)
}
if err := beacondb.UpdateChainHead(ctx, block, state); err != nil {
t.Fatal(err)
}
}
return ss, beacondb, stateRoot
}
func setUpUnSyncedService(simP2P *simulatedP2P, stateRoot [32]byte, t *testing.T) (*Service, *db.BeaconDB) {
@@ -199,8 +226,8 @@ func setUpUnSyncedService(simP2P *simulatedP2P, stateRoot [32]byte, t *testing.T
for ss.Querier.currentHeadSlot == 0 {
simP2P.Send(simP2P.ctx, &pb.ChainHeadResponse{
Slot: params.BeaconConfig().GenesisSlot + 12,
Hash: stateRoot[:],
CanonicalSlot: params.BeaconConfig().GenesisSlot + 12,
CanonicalStateRootHash32: stateRoot[:],
}, "")
}
@@ -219,27 +246,16 @@ func TestSyncing_AFullySyncedNode(t *testing.T) {
// Sets up a synced service which has its head at the current
// numOfBlocks from genesis. The blocks are generated through
// simulated backend.
ss, syncedDB := setUpSyncedService(numOfBlocks, newP2P, t)
ss, syncedDB, stateRoot := setUpSyncedService(numOfBlocks, newP2P, t)
defer ss.Stop()
defer db.TeardownDB(syncedDB)
bState, err := syncedDB.State(ctx)
if err != nil {
t.Fatalf("Could not retrieve state %v", err)
}
h, err := hashutil.HashProto(bState)
if err != nil {
t.Fatalf("unable to marshal the beacon state: %v", err)
}
// Sets up a sync service which has its current head at genesis.
us, unSyncedDB := setUpUnSyncedService(newP2P, h, t)
us, unSyncedDB := setUpUnSyncedService(newP2P, stateRoot, t)
defer us.Stop()
defer db.TeardownDB(unSyncedDB)
// Sets up another sync service which has its current head at genesis.
us2, unSyncedDB2 := setUpUnSyncedService(newP2P, h, t)
us2, unSyncedDB2 := setUpUnSyncedService(newP2P, stateRoot, t)
defer us2.Stop()
defer db.TeardownDB(unSyncedDB2)
@@ -247,15 +263,9 @@ func TestSyncing_AFullySyncedNode(t *testing.T) {
if err != nil {
t.Fatal(err)
}
justified, err := syncedDB.JustifiedState()
if err != nil {
t.Fatal(err)
}
newP2P.Send(newP2P.ctx, &pb.BeaconStateResponse{
FinalizedState: finalized,
JustifiedState: justified,
CanonicalState: bState,
}, "")
timeout := time.After(10 * time.Second)
@@ -268,7 +278,7 @@ loop:
break loop
case <-tick:
_, slot1 := us.InitialSync.NodeIsSynced()
_, slot2 := us.InitialSync.NodeIsSynced()
_, slot2 := us2.InitialSync.NodeIsSynced()
if slot1 == uint64(numOfBlocks)+params.BeaconConfig().GenesisSlot ||
slot2 == uint64(numOfBlocks)+params.BeaconConfig().GenesisSlot {
break loop

View File

@@ -487,8 +487,8 @@ func (m *ChainHeadRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ChainHeadRequest proto.InternalMessageInfo
type ChainHeadResponse struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Slot uint64 `protobuf:"varint,2,opt,name=slot,proto3" json:"slot,omitempty"`
CanonicalSlot uint64 `protobuf:"varint,1,opt,name=canonical_slot,json=canonicalSlot,proto3" json:"canonical_slot,omitempty"`
CanonicalStateRootHash32 []byte `protobuf:"bytes,2,opt,name=canonical_state_root_hash32,json=canonicalStateRootHash32,proto3" json:"canonical_state_root_hash32,omitempty"`
FinalizedStateRootHash32S []byte `protobuf:"bytes,3,opt,name=finalized_state_root_hash32s,json=finalizedStateRootHash32s,proto3" json:"finalized_state_root_hash32s,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -528,20 +528,20 @@ func (m *ChainHeadResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_ChainHeadResponse proto.InternalMessageInfo
func (m *ChainHeadResponse) GetHash() []byte {
func (m *ChainHeadResponse) GetCanonicalSlot() uint64 {
if m != nil {
return m.Hash
}
return nil
}
func (m *ChainHeadResponse) GetSlot() uint64 {
if m != nil {
return m.Slot
return m.CanonicalSlot
}
return 0
}
func (m *ChainHeadResponse) GetCanonicalStateRootHash32() []byte {
if m != nil {
return m.CanonicalStateRootHash32
}
return nil
}
func (m *ChainHeadResponse) GetFinalizedStateRootHash32S() []byte {
if m != nil {
return m.FinalizedStateRootHash32S
@@ -645,8 +645,6 @@ func (m *BeaconStateRequest) GetFinalizedStateRootHash32S() []byte {
type BeaconStateResponse struct {
FinalizedState *BeaconState `protobuf:"bytes,1,opt,name=finalized_state,json=finalizedState,proto3" json:"finalized_state,omitempty"`
JustifiedState *BeaconState `protobuf:"bytes,2,opt,name=justified_state,json=justifiedState,proto3" json:"justified_state,omitempty"`
CanonicalState *BeaconState `protobuf:"bytes,3,opt,name=canonical_state,json=canonicalState,proto3" json:"canonical_state,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -692,20 +690,6 @@ func (m *BeaconStateResponse) GetFinalizedState() *BeaconState {
return nil
}
func (m *BeaconStateResponse) GetJustifiedState() *BeaconState {
if m != nil {
return m.JustifiedState
}
return nil
}
func (m *BeaconStateResponse) GetCanonicalState() *BeaconState {
if m != nil {
return m.CanonicalState
}
return nil
}
type AttestationAnnounce struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -1485,63 +1469,63 @@ func init() {
func init() { proto.RegisterFile("proto/beacon/p2p/v1/messages.proto", fileDescriptor_a1d590cda035b632) }
var fileDescriptor_a1d590cda035b632 = []byte{
// 893 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xdf, 0x72, 0xdb, 0x44,
0x14, 0xc6, 0x51, 0x9c, 0xd4, 0xe9, 0xb1, 0xe3, 0xba, 0x1b, 0x68, 0x9c, 0x4c, 0xeb, 0x24, 0x2a,
0x1d, 0x02, 0x33, 0x75, 0xa6, 0xe9, 0x55, 0xaf, 0x18, 0xc9, 0xd1, 0xe0, 0xb6, 0x41, 0x2e, 0x92,
0x0d, 0xc3, 0xd5, 0xb2, 0xb6, 0xb7, 0xb5, 0xc0, 0xd9, 0x15, 0xde, 0xb5, 0x27, 0x61, 0xb8, 0xe5,
0x19, 0x78, 0x02, 0xde, 0x85, 0x4b, 0x1e, 0x81, 0xc9, 0x8b, 0xc0, 0x68, 0xb5, 0x52, 0xe4, 0x3f,
0x51, 0x9c, 0x99, 0xde, 0x49, 0xe7, 0x7c, 0xdf, 0xef, 0x9c, 0x6f, 0xb3, 0xca, 0x18, 0xcc, 0x70,
0xcc, 0x25, 0x3f, 0xee, 0x51, 0xd2, 0xe7, 0xec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 0xc8, 0x64, 0x75, 0x3a, 0x4e, 0x54, 0x7f, 0xdd, 0x76, 0xaf, 0x71,
0xe5, 0x68, 0x8f, 0x6c, 0x27, 0xa1, 0x6d, 0xcd, 0x5b, 0x52, 0x58, 0xc5, 0x2e, 0xff, 0x7d, 0x55,
0x37, 0xfe, 0xb9, 0xaa, 0x1b, 0xff, 0x5e, 0xd5, 0x8d, 0xde, 0x3d, 0xf5, 0x83, 0xf1, 0xe5, 0xff,
0x01, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x87, 0xb8, 0xa8, 0x8f, 0x0a, 0x00, 0x00,
// 884 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xd1, 0x72, 0xda, 0x46,
0x14, 0x86, 0xab, 0xd8, 0x0e, 0xce, 0x01, 0x13, 0xb2, 0x6e, 0x63, 0xec, 0x26, 0xd8, 0x56, 0xea,
0xa9, 0xdb, 0x99, 0xe0, 0x89, 0x73, 0x95, 0x8b, 0x4e, 0x47, 0xc2, 0x9a, 0x92, 0xc4, 0x15, 0xa9,
0x80, 0x76, 0x7a, 0xb5, 0x5d, 0xc4, 0xd6, 0x30, 0xc5, 0xbb, 0x5b, 0x76, 0x61, 0xec, 0xde, 0xf7,
0x19, 0xfa, 0x04, 0x7d, 0x89, 0x3e, 0x41, 0x2f, 0xfb, 0x08, 0x1d, 0x3f, 0x49, 0x47, 0xab, 0x15,
0x16, 0x20, 0xcb, 0x5c, 0xf4, 0x0e, 0x9d, 0xf3, 0xff, 0xff, 0x9e, 0x6f, 0x39, 0x62, 0x00, 0x5b,
0x8c, 0xb9, 0xe2, 0x27, 0x3d, 0x4a, 0x42, 0xce, 0x4e, 0xc4, 0xa9, 0x38, 0x99, 0xbe, 0x3a, 0xb9,
0xa4, 0x52, 0x92, 0x0b, 0x2a, 0xeb, 0xba, 0x89, 0x9e, 0x52, 0x35, 0xa0, 0x63, 0x3a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0xac, 0x7f, 0x6f, 0x6a, 0x56,
0xef, 0xa1, 0xfe, 0x4b, 0xf7, 0xfa, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xd9, 0xa8, 0x18,
0x31, 0x0a, 0x00, 0x00,
}
func (m *Envelope) Marshal() (dAtA []byte, err error) {
@@ -1803,16 +1787,16 @@ func (m *ChainHeadResponse) MarshalTo(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.Hash) > 0 {
dAtA[i] = 0xa
if m.CanonicalSlot != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintMessages(dAtA, i, uint64(len(m.Hash)))
i += copy(dAtA[i:], m.Hash)
i = encodeVarintMessages(dAtA, i, uint64(m.CanonicalSlot))
}
if m.Slot != 0 {
dAtA[i] = 0x10
if len(m.CanonicalStateRootHash32) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Slot))
i = encodeVarintMessages(dAtA, i, uint64(len(m.CanonicalStateRootHash32)))
i += copy(dAtA[i:], m.CanonicalStateRootHash32)
}
if len(m.FinalizedStateRootHash32S) > 0 {
dAtA[i] = 0x1a
@@ -1905,26 +1889,6 @@ func (m *BeaconStateResponse) MarshalTo(dAtA []byte) (int, error) {
}
i += n3
}
if m.JustifiedState != nil {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.JustifiedState.Size()))
n4, err := m.JustifiedState.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n4
}
if m.CanonicalState != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintMessages(dAtA, i, uint64(m.CanonicalState.Size()))
n5, err := m.CanonicalState.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n5
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
@@ -2010,11 +1974,11 @@ func (m *AttestationResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Attestation.Size()))
n6, err := m.Attestation.MarshalTo(dAtA[i:])
n4, err := m.Attestation.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n6
i += n4
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2101,11 +2065,11 @@ func (m *ProposerSlashingResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.ProposerSlashing.Size()))
n7, err := m.ProposerSlashing.MarshalTo(dAtA[i:])
n5, err := m.ProposerSlashing.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n7
i += n5
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2192,11 +2156,11 @@ func (m *AttesterSlashingResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.AttesterSlashing.Size()))
n8, err := m.AttesterSlashing.MarshalTo(dAtA[i:])
n6, err := m.AttesterSlashing.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n8
i += n6
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2283,11 +2247,11 @@ func (m *DepositResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.Deposit.Size()))
n9, err := m.Deposit.MarshalTo(dAtA[i:])
n7, err := m.Deposit.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n9
i += n7
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2374,11 +2338,11 @@ func (m *ExitResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x12
i++
i = encodeVarintMessages(dAtA, i, uint64(m.VoluntaryExit.Size()))
n10, err := m.VoluntaryExit.MarshalTo(dAtA[i:])
n8, err := m.VoluntaryExit.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n10
i += n8
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
@@ -2539,13 +2503,13 @@ func (m *ChainHeadResponse) Size() (n int) {
}
var l int
_ = l
l = len(m.Hash)
if m.CanonicalSlot != 0 {
n += 1 + sovMessages(uint64(m.CanonicalSlot))
}
l = len(m.CanonicalStateRootHash32)
if l > 0 {
n += 1 + l + sovMessages(uint64(l))
}
if m.Slot != 0 {
n += 1 + sovMessages(uint64(m.Slot))
}
l = len(m.FinalizedStateRootHash32S)
if l > 0 {
n += 1 + l + sovMessages(uint64(l))
@@ -2598,14 +2562,6 @@ func (m *BeaconStateResponse) Size() (n int) {
l = m.FinalizedState.Size()
n += 1 + l + sovMessages(uint64(l))
}
if m.JustifiedState != nil {
l = m.JustifiedState.Size()
n += 1 + l + sovMessages(uint64(l))
}
if m.CanonicalState != nil {
l = m.CanonicalState.Size()
n += 1 + l + sovMessages(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@@ -3665,8 +3621,27 @@ func (m *ChainHeadResponse) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field CanonicalSlot", wireType)
}
m.CanonicalSlot = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.CanonicalSlot |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field CanonicalStateRootHash32", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
@@ -3693,30 +3668,11 @@ func (m *ChainHeadResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...)
if m.Hash == nil {
m.Hash = []byte{}
m.CanonicalStateRootHash32 = append(m.CanonicalStateRootHash32[:0], dAtA[iNdEx:postIndex]...)
if m.CanonicalStateRootHash32 == nil {
m.CanonicalStateRootHash32 = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Slot", wireType)
}
m.Slot = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Slot |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FinalizedStateRootHash32S", wireType)
@@ -4017,78 +3973,6 @@ func (m *BeaconStateResponse) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field JustifiedState", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthMessages
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.JustifiedState == nil {
m.JustifiedState = &BeaconState{}
}
if err := m.JustifiedState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CanonicalState", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowMessages
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthMessages
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthMessages
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.CanonicalState == nil {
m.CanonicalState = &BeaconState{}
}
if err := m.CanonicalState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipMessages(dAtA[iNdEx:])

View File

@@ -57,8 +57,8 @@ message BatchedBeaconBlockResponse {
message ChainHeadRequest {}
message ChainHeadResponse {
bytes hash = 1;
uint64 slot = 2;
uint64 canonical_slot = 1;
bytes canonical_state_root_hash32 = 2;
bytes finalized_state_root_hash32s = 3;
}
@@ -72,8 +72,6 @@ message BeaconStateRequest {
message BeaconStateResponse {
BeaconState finalized_state = 1;
BeaconState justified_state = 2;
BeaconState canonical_state = 3;
}
message AttestationAnnounce {