Skip to content

Commit

Permalink
Add range check for sdk.Dec
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Jan 9, 2025
1 parent 7cd2252 commit 3d25d97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wormchain/Dockerfile.ict
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ WORKDIR /home/heighliner
COPY --from=builder /app/build/wormchaind /usr/bin

# copy over c bindings (libwasmvm.x86_64.so, etc)
COPY --from=builder /go/pkg/mod/github.com/!cosm!wasm/[email protected]/internal/api/* /usr/lib
COPY --from=builder /go/pkg/mod/github.com/!cosm!wasm/[email protected]/internal/api/* /usr/lib/

EXPOSE 26657
EXPOSE 26656
Expand Down
9 changes: 9 additions & 0 deletions wormchain/x/wormhole/client/cli/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ func CmdGenerateSlashingParamsUpdateVaa() *cobra.Command {
if err != nil {
return err
}
if minSignedPerWindowDec.LT(sdk.ZeroDec()) || minSignedPerWindowDec.GT(sdk.OneDec()) {
return fmt.Errorf("min signed per window must be greater than or equal to 0.000000000000000000 and less than or equal to 1.000000000000000000")
}

downtimeJailDuration, err := cmd.Flags().GetUint64(FLAG_DOWNTIME_JAIL_DURATION)
if err != nil {
Expand All @@ -463,6 +466,9 @@ func CmdGenerateSlashingParamsUpdateVaa() *cobra.Command {
if err != nil {
return err
}
if slashFractionDoubleSignDec.LT(sdk.ZeroDec()) || slashFractionDoubleSignDec.GT(sdk.OneDec()) {
return fmt.Errorf("slash fraction double sign must be greater than or equal to 0.000000000000000000 and less than or equal to 1.000000000000000000")
}

slashFractionDowntime, err := cmd.Flags().GetString(FLAG_SLASH_FRACTION_DOWNTIME)
if err != nil {
Expand All @@ -472,6 +478,9 @@ func CmdGenerateSlashingParamsUpdateVaa() *cobra.Command {
if err != nil {
return err
}
if slashFractionDowntimeDec.LT(sdk.ZeroDec()) || slashFractionDowntimeDec.GT(sdk.OneDec()) {
return fmt.Errorf("slash fraction downtime must be greater than or equal to 0.000000000000000000 and less than or equal to 1.000000000000000000")
}

slashingUpdate := make([]byte, 40)
binary.BigEndian.PutUint64(slashingUpdate[:8], signedBlocksWindow)
Expand Down

0 comments on commit 3d25d97

Please sign in to comment.