Skip to content

Commit

Permalink
feat: handle non-existing actors gracefully in F3 power proportion CLI (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
masih authored Jan 22, 2025
1 parent 313cd2b commit 364cc76
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ var f3SubCmdPowerTable = &cli.Command{
}
ScaledSum int64
Proportion float64
NotFound []gpbft.ActorID
}{
Instance: instance,
FromEC: cctx.Bool(f3FlagPowerTableFromEC.Name),
Expand Down Expand Up @@ -287,7 +288,8 @@ var f3SubCmdPowerTable = &cli.Command{
seenIDs[actorID] = struct{}{}
scaled, key := pt.Get(actorID)
if key == nil {
return fmt.Errorf("actor ID %d not found in power table", actorID)
result.NotFound = append(result.NotFound, actorID)
continue
}
result.ScaledSum += scaled
}
Expand Down

0 comments on commit 364cc76

Please sign in to comment.