Skip to content

Commit

Permalink
bugfix: Stop the etx collection if the slice was not created yet
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Apr 26, 2024
1 parent 39b4362 commit a8696bd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,20 @@ func (sl *Slice) CollectNewlyConfirmedEtxs(block *types.WorkObject, location com
return newlyConfirmedEtxs, subRollup, nil
}

// Terminate the search if the slice to which the given block belongs was
// not activated yet, expansion number is validated on prime block, so only
// terminate on prime block, It is possible to make this check more
// optimized but this is performant enough and in some cases might have to
// go through few more region blocks than necessary
_, order, err := sl.Engine().CalcOrder(ancestor)
if err != nil {
return nil, nil, err
}
regions, zones := common.GetHierarchySizeForExpansionNumber(ancestor.ExpansionNumber())
if order == common.PRIME_CTX && (location.Region() > int(regions) || location.Zone() > int(zones)) {
return newlyConfirmedEtxs, subRollup, nil
}

// Terminate the search when we find a block produced by the same sub
if ancestor.Location().SubIndex(nodeLocation) == location.SubIndex(nodeLocation) {
return newlyConfirmedEtxs, subRollup, nil
Expand Down

0 comments on commit a8696bd

Please sign in to comment.