Summary
While reading x/conflict/keeper/vote.go I noticed that in HandleAndCloseVote, the bail amount for providers that failed to vote is computed but the division result appears to be discarded.
Location
x/conflict/keeper/vote.go (the default branch of the vote-counting switch):
// punish providers that didnt vote
providersWithoutVote = append(providersWithoutVote, vote.Address)
bail := stake
bail.Quo(sdk.NewIntFromUint64(BailStakeDiv))
err = k.pairingKeeper.JailEntry(ctx, vote.Address, conflictVote.ChainID,
conflictVote.VoteStartBlock, blocksToSave,
sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), bail))
Observation
sdk.Int / cosmossdk.io/math.Int (v1.3.0, the version pinned in go.mod) is immutable. Quo has a value receiver and returns a freshly allocated Int (SafeQuo → div() does new(big.Int).Quo(...)); it does not mutate the receiver. So the line bail.Quo(sdk.NewIntFromUint64(BailStakeDiv)) has no effect — its return value is dropped, and bail stays equal to the full stake.
The intent (per BailStakeDiv = 5 // 20% - Can't be 0!) seems to be bailing non-voters at stake / 5. A few lines below, totalVotes.Quo(...) is used in the assigning form (halfTotalVotes := totalVotes.Quo(...)), which suggests the non-assigning call here is an oversight rather than deliberate.
Questions
Is bailing non-voters at the full stake intended, or should it be stake / BailStakeDiv as the constant name/comment imply?
Summary
While reading
x/conflict/keeper/vote.goI noticed that inHandleAndCloseVote, thebailamount for providers that failed to vote is computed but the division result appears to be discarded.Location
x/conflict/keeper/vote.go(thedefaultbranch of the vote-counting switch):Observation
sdk.Int / cosmossdk.io/math.Int (v1.3.0, the version pinned in go.mod) is immutable. Quo has a value receiver and returns a freshly allocated Int (SafeQuo → div() does new(big.Int).Quo(...)); it does not mutate the receiver. So the line bail.Quo(sdk.NewIntFromUint64(BailStakeDiv)) has no effect — its return value is dropped, and bail stays equal to the full stake.
The intent (per BailStakeDiv = 5 // 20% - Can't be 0!) seems to be bailing non-voters at stake / 5. A few lines below, totalVotes.Quo(...) is used in the assigning form (halfTotalVotes := totalVotes.Quo(...)), which suggests the non-assigning call here is an oversight rather than deliberate.
Questions
Is bailing non-voters at the full stake intended, or should it be stake / BailStakeDiv as the constant name/comment imply?