Skip to content

Commit

Permalink
fix(timeupgrade): validating time in software upgrade proposal (#652)
Browse files Browse the repository at this point in the history
(cherry picked from commit 68cd3e1)
  • Loading branch information
mtsitrin authored and omritoptix committed Dec 25, 2024
1 parent d3d6a08 commit 212a113
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/timeupgrade/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
sdkerrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errors "github.com/cosmos/cosmos-sdk/types/errors"
prototypes "github.com/gogo/protobuf/types"
)

var _, _ sdk.Msg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{}
Expand All @@ -15,6 +16,11 @@ func (m *MsgSoftwareUpgrade) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil {
return sdkerrors.Wrap(err, "authority")
}

_, err := prototypes.TimestampFromProto(m.UpgradeTime)
if err != nil || m.UpgradeTime == nil || m.UpgradeTime.Seconds == 0 {
return sdkerrors.Wrap(err, "upgrade time")
}
return nil
}

Expand Down

0 comments on commit 212a113

Please sign in to comment.