diff --git a/beacon-chain/sync/backfill/BUILD.bazel b/beacon-chain/sync/backfill/BUILD.bazel index bbd2691dc4..cbaa1b7cac 100644 --- a/beacon-chain/sync/backfill/BUILD.bazel +++ b/beacon-chain/sync/backfill/BUILD.bazel @@ -81,6 +81,7 @@ go_test( "//runtime/interop:go_default_library", "//testing/require:go_default_library", "//testing/util:go_default_library", + "//time/slots:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_libp2p_go_libp2p//core/peer:go_default_library", "@com_github_pkg_errors//:go_default_library", diff --git a/beacon-chain/sync/backfill/service.go b/beacon-chain/sync/backfill/service.go index fcbd0086fe..c07d753bdd 100644 --- a/beacon-chain/sync/backfill/service.go +++ b/beacon-chain/sync/backfill/service.go @@ -249,6 +249,18 @@ func (s *Service) scheduleTodos() { } } +// fuluOrigin checks whether the origin block (ie the checkpoint sync block from which backfill +// syncs backwards) is in an unsupported fork, enabling the backfill service to shut down rather than +// run with buggy behavior. +// This will be removed once DataColumnSidecar support is released. +func fuluOrigin(cfg *params.BeaconChainConfig, status *dbval.BackfillStatus) bool { + originEpoch := slots.ToEpoch(primitives.Slot(status.OriginSlot)) + if originEpoch < cfg.FuluForkEpoch { + return false + } + return true +} + // Start begins the runloop of backfill.Service in the current goroutine. func (s *Service) Start() { if !s.enabled { @@ -281,6 +293,12 @@ func (s *Service) Start() { return } status := s.store.status() + if fuluOrigin(params.BeaconConfig(), status) { + log.WithField("originSlot", s.store.status().OriginSlot). + Warn("backfill disabled; DataColumnSidecar currently unsupported, for updates follow https://github.com/OffchainLabs/prysm/issues/15982") + s.markComplete() + return + } // Exit early if there aren't going to be any batches to backfill. if primitives.Slot(status.LowSlot) <= s.ms(s.clock.CurrentSlot()) { log.WithField("minimumRequiredSlot", s.ms(s.clock.CurrentSlot())). @@ -289,6 +307,7 @@ func (s *Service) Start() { s.markComplete() return } + s.verifier, s.ctxMap, err = s.initVerifier(ctx) if err != nil { log.WithError(err).Error("Unable to initialize backfill verifier") diff --git a/beacon-chain/sync/backfill/service_test.go b/beacon-chain/sync/backfill/service_test.go index 59efb21f0e..b0b270c2b0 100644 --- a/beacon-chain/sync/backfill/service_test.go +++ b/beacon-chain/sync/backfill/service_test.go @@ -15,6 +15,7 @@ import ( "github.com/OffchainLabs/prysm/v6/proto/dbval" "github.com/OffchainLabs/prysm/v6/testing/require" "github.com/OffchainLabs/prysm/v6/testing/util" + "github.com/OffchainLabs/prysm/v6/time/slots" ) type mockMinimumSlotter struct { @@ -131,3 +132,41 @@ func TestBackfillMinSlotDefault(t *testing.T) { require.Equal(t, specMin, s.ms(current)) }) } + +func TestFuluOrigin(t *testing.T) { + cfg := params.BeaconConfig() + fuluEpoch := cfg.FuluForkEpoch + fuluSlot, err := slots.EpochStart(fuluEpoch) + require.NoError(t, err) + cases := []struct { + name string + origin primitives.Slot + isFulu bool + }{ + { + name: "before fulu", + origin: fuluSlot - 1, + isFulu: false, + }, + { + name: "at fulu", + origin: fuluSlot, + isFulu: true, + }, + { + name: "after fulu", + origin: fuluSlot + 1, + isFulu: true, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + status := &dbval.BackfillStatus{ + OriginSlot: uint64(tc.origin), + } + result := fuluOrigin(cfg, status) + require.Equal(t, tc.isFulu, result) + }) + } +} diff --git a/changelog/kasey_disable-backfill-if-fulu.md b/changelog/kasey_disable-backfill-if-fulu.md new file mode 100644 index 0000000000..b512f44118 --- /dev/null +++ b/changelog/kasey_disable-backfill-if-fulu.md @@ -0,0 +1,2 @@ +### Fixed +- Backfill disabled if checkpoint sync origin is after fulu fork due to lack of DataColumnSidecar support in backfill. To track the availability of fulu-compatible backfill please watch https://github.com/OffchainLabs/prysm/issues/15982