Skip to content

Commit

Permalink
fix(dogfood): add operator stateful validation
Browse files Browse the repository at this point in the history
The dogfood module accepts a list of validators as input. These
validators must be registered within the operator module for the chain's
ChainID.
  • Loading branch information
MaxMustermann2 committed Apr 2, 2024
1 parent 6629d35 commit 25cde6f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions x/dogfood/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ func (k Keeper) InitGenesis(
for _, val := range genState.InitialValSet {
// #nosec G703 // already validated
consKey, _ := operatortypes.HexStringToPubKey(val.PublicKey)
// #nosec G601 // this only fails if the key is of a type not already defined.
consAddr, _ := operatortypes.TMCryptoPublicKeyToConsAddr(consKey)

Check warning

Code scanning / gosec

Returned error is not propagated up the stack. Warning

Returned error is not propagated up the stack.
found, _ := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr(
ctx, ctx.ChainID(), consAddr,
)
if !found {
panic(fmt.Sprintf("operator not found: %s", consAddr))
}
out = append(out, abci.ValidatorUpdate{
PubKey: *consKey,
Power: val.Power,
Expand Down

0 comments on commit 25cde6f

Please sign in to comment.