mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 20:43:57 -05:00
disable backfill if the checkpoint sync origin slot is in fulu (#15987)
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
2
changelog/kasey_disable-backfill-if-fulu.md
Normal file
2
changelog/kasey_disable-backfill-if-fulu.md
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user