From 54800fe6538e9f637d8f39534645b48eb491c03c Mon Sep 17 00:00:00 2001 From: Giulio Date: Sat, 16 Nov 2024 08:47:29 +0100 Subject: [PATCH] save --- cl/phase1/core/state/cache.go | 1 + cl/phase1/core/state/raw/state.go | 4 +--- cl/phase1/forkchoice/fork_choice_test.go | 1 - cl/phase1/forkchoice/fork_graph/fork_graph_disk.go | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cl/phase1/core/state/cache.go b/cl/phase1/core/state/cache.go index a4da6a8e275..1bff0f63c59 100644 --- a/cl/phase1/core/state/cache.go +++ b/cl/phase1/core/state/cache.go @@ -287,6 +287,7 @@ func (b *CachingBeaconState) InitBeaconState() error { if b.Version() >= clparams.Phase0Version { return b._initializeValidatorsPhase0() } + return nil } diff --git a/cl/phase1/core/state/raw/state.go b/cl/phase1/core/state/raw/state.go index 1ed31ee7798..66c67c60acd 100644 --- a/cl/phase1/core/state/raw/state.go +++ b/cl/phase1/core/state/raw/state.go @@ -115,9 +115,7 @@ func New(cfg *clparams.BeaconChainConfig) *BeaconState { } func (b *BeaconState) init() error { - if b.touchedLeaves == nil { - b.touchedLeaves = make([]atomic.Uint32, StateLeafSize) - } + b.touchedLeaves = make([]atomic.Uint32, StateLeafSize) return nil } diff --git a/cl/phase1/forkchoice/fork_choice_test.go b/cl/phase1/forkchoice/fork_choice_test.go index 8ed7c94d794..d484cbe03a1 100644 --- a/cl/phase1/forkchoice/fork_choice_test.go +++ b/cl/phase1/forkchoice/fork_choice_test.go @@ -112,7 +112,6 @@ func TestForkChoiceBasic(t *testing.T) { require.Equal(t, headSlot, uint64(3)) require.Equal(t, headRoot, libcommon.HexToHash("0x744cc484f6503462f0f3a5981d956bf4fcb3e57ab8687ed006467e05049ee033")) // last block - fmt.Println("X") require.NoError(t, store.OnBlock(ctx, block0xd4, false, true, false)) require.Equal(t, store.Time(), uint64(36)) require.Equal(t, store.ProposerBoostRoot(), libcommon.HexToHash("0x744cc484f6503462f0f3a5981d956bf4fcb3e57ab8687ed006467e05049ee033")) diff --git a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go index 7575966ddeb..10946292f4f 100644 --- a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go +++ b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go @@ -377,13 +377,13 @@ func (f *forkGraphDisk) GetState(blockRoot libcommon.Hash, out *state.CachingBea } } blocksInTheWay = append(blocksInTheWay, block) + currentIteratorRoot = block.Block.ParentRoot } - // Traverse the blocks from top to bottom. for i := len(blocksInTheWay) - 1; i >= 0; i-- { if err := transition.TransitionState(copyReferencedState, blocksInTheWay[i], nil, false); err != nil { - return nil, err + return nil, fmt.Errorf("GetState: %w, blockRoot; %x", err, blockRoot) } } return copyReferencedState, nil