Skip to content

Commit

Permalink
fix: Handle phase0
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Dec 6, 2024
1 parent 27bd1fd commit 8bae0b0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/cannon/iterator/backfilling_checkpoint_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package iterator

import (
"context"
"strings"
"fmt"
"time"

"github.com/attestantio/go-eth2-client/spec"
Expand Down Expand Up @@ -215,9 +215,9 @@ func (c *BackfillingCheckpoint) Next(ctx context.Context) (rsp *BackFillingCheck
}
}

forkEpoch, errr := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(strings.ToUpper(c.activationFork.String()))
forkEpoch, errr := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(c.activationFork.String())
if errr != nil {
return nil, errors.Wrap(errr, "failed to get fork epoch")
return nil, errors.Wrap(errr, fmt.Sprintf("failed to get epoch for fork: %s", c.activationFork))
}

if checkpoint.Epoch < forkEpoch.Epoch {
Expand Down Expand Up @@ -435,7 +435,11 @@ func (c *BackfillingCheckpoint) GetMarker(location *xatu.CannonLocation) (*xatu.
func (c *BackfillingCheckpoint) getEarliestPossibleBackfillEpoch() (phase0.Epoch, error) {
// earliestEpochForType is the earliest epoch for the type based on the fork epochs.
// For example, the blob_sidecar cannon type will have an earliest epoch of the DENEB fork.
forkEpoch, err := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(strings.ToUpper(c.activationFork.String()))
if c.activationFork == spec.DataVersionPhase0 {
return 0, nil
}

forkEpoch, err := c.beaconNode.Metadata().Spec.ForkEpochs.GetByName(c.activationFork.String())
if err != nil {
return 0, errors.Wrap(err, "failed to get fork epoch")
}
Expand Down

0 comments on commit 8bae0b0

Please sign in to comment.