From a25710d50d2e1c6a32c95edae2ed2c41bab11895 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 25 Dec 2024 22:24:17 +0200 Subject: [PATCH] validating time in software upgrade proposal --- x/timeupgrade/types/msgs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/timeupgrade/types/msgs.go b/x/timeupgrade/types/msgs.go index a55a0363..b9030a18 100644 --- a/x/timeupgrade/types/msgs.go +++ b/x/timeupgrade/types/msgs.go @@ -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{} @@ -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 }