Skip to content

Commit 364cc76

Browse files
authored
feat: handle non-existing actors gracefully in F3 power proportion CLI (#12840)
Handle non-existing actors gracefully in F3 power proportion CLI When calculating proportional F3 participation power for a given actor IDs instead of failing when an actor isn't found, collect the non-existing ones and report them. This makes up a better UX when debugging F3 in cases where actors don't exist in the F3 power table.
1 parent 313cd2b commit 364cc76

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cli/f3.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ var f3SubCmdPowerTable = &cli.Command{
228228
}
229229
ScaledSum int64
230230
Proportion float64
231+
NotFound []gpbft.ActorID
231232
}{
232233
Instance: instance,
233234
FromEC: cctx.Bool(f3FlagPowerTableFromEC.Name),
@@ -287,7 +288,8 @@ var f3SubCmdPowerTable = &cli.Command{
287288
seenIDs[actorID] = struct{}{}
288289
scaled, key := pt.Get(actorID)
289290
if key == nil {
290-
return fmt.Errorf("actor ID %d not found in power table", actorID)
291+
result.NotFound = append(result.NotFound, actorID)
292+
continue
291293
}
292294
result.ScaledSum += scaled
293295
}

0 commit comments

Comments
 (0)