From 5237cb60cb2e903367cafed41c0b9a251bb6912b Mon Sep 17 00:00:00 2001 From: Potuz Date: Wed, 6 Mar 2024 10:58:44 -0300 Subject: [PATCH 1/2] pass justified = finalized at startup --- beacon-chain/blockchain/service.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index 09d0cce7906d..ca3a696e4a53 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -272,13 +272,6 @@ func (s *Service) StartFromSavedState(saved state.BeaconState) error { } spawnCountdownIfPreGenesis(s.ctx, s.genesisTime, s.cfg.BeaconDB) - justified, err := s.cfg.BeaconDB.JustifiedCheckpoint(s.ctx) - if err != nil { - return errors.Wrap(err, "could not get justified checkpoint") - } - if justified == nil { - return errNilJustifiedCheckpoint - } finalized, err := s.cfg.BeaconDB.FinalizedCheckpoint(s.ctx) if err != nil { return errors.Wrap(err, "could not get finalized checkpoint") @@ -290,8 +283,8 @@ func (s *Service) StartFromSavedState(saved state.BeaconState) error { fRoot := s.ensureRootNotZeros(bytesutil.ToBytes32(finalized.Root)) s.cfg.ForkChoiceStore.Lock() defer s.cfg.ForkChoiceStore.Unlock() - if err := s.cfg.ForkChoiceStore.UpdateJustifiedCheckpoint(s.ctx, &forkchoicetypes.Checkpoint{Epoch: justified.Epoch, - Root: bytesutil.ToBytes32(justified.Root)}); err != nil { + if err := s.cfg.ForkChoiceStore.UpdateJustifiedCheckpoint(s.ctx, &forkchoicetypes.Checkpoint{Epoch: finalized.Epoch, + Root: bytesutil.ToBytes32(finalized.Root)}); err != nil { return errors.Wrap(err, "could not update forkchoice's justified checkpoint") } if err := s.cfg.ForkChoiceStore.UpdateFinalizedCheckpoint(&forkchoicetypes.Checkpoint{Epoch: finalized.Epoch, From fd4460fd462cca1f09dffc4ae8795b93b8b4be1c Mon Sep 17 00:00:00 2001 From: Potuz Date: Wed, 6 Mar 2024 11:11:16 -0300 Subject: [PATCH 2/2] remove unused error --- beacon-chain/blockchain/error.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/beacon-chain/blockchain/error.go b/beacon-chain/blockchain/error.go index 87ed0d2416db..ad2c5e8bf339 100644 --- a/beacon-chain/blockchain/error.go +++ b/beacon-chain/blockchain/error.go @@ -13,8 +13,6 @@ var ( errNilFinalizedInStore = errors.New("nil finalized checkpoint returned from store") // errNilFinalizedCheckpoint is returned when a nil finalized checkpt is returned from a state. errNilFinalizedCheckpoint = errors.New("nil finalized checkpoint returned from state") - // errNilJustifiedCheckpoint is returned when a nil justified checkpt is returned from a state. - errNilJustifiedCheckpoint = errors.New("nil justified checkpoint returned from state") // errBlockDoesNotExist is returned when a block does not exist for a particular state summary. errBlockDoesNotExist = errors.New("could not find block in DB") // errBlockNotFoundInCacheOrDB is returned when a block is not found in the cache or DB.