Skip to content

Commit

Permalink
(NOBIDS) fix pre-genesis epoch underflow while exporting sync duties
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Sep 27, 2023
1 parent 654b273 commit faa51e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion exporter/sync_committees.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func exportSyncCommittees(rpcClient rpc.Client) error {
for _, p := range dbPeriods {
dbPeriodsMap[p] = true
}
currEpoch := services.LatestFinalizedEpoch() - 1
currEpoch := services.LatestFinalizedEpoch()
if currEpoch > 0 { // guard against underflows
currEpoch = currEpoch - 1
}
lastPeriod := utils.SyncPeriodOfEpoch(uint64(currEpoch)) + 1 // we can look into the future
firstPeriod := utils.SyncPeriodOfEpoch(utils.Config.Chain.Config.AltairForkEpoch)
for p := firstPeriod; p <= lastPeriod; p++ {
Expand Down

0 comments on commit faa51e2

Please sign in to comment.