forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 10
/
msgs.go
60 lines (50 loc) · 1.74 KB
/
msgs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package types
import (
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
sdk "github.com/shapeshift/cosmos-sdk/types"
"github.com/shapeshift/cosmos-sdk/x/auth/migrations/legacytx"
)
const (
TypeMsgUpdateParams = "update_params"
)
var _ legacytx.LegacyMsg = &MsgUpdateParams{}
// GetSigners returns the signer addresses that are expected to sign the result
// of GetSignBytes.
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
authority, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{authority}
}
// GetSignBytes returns the raw bytes for a MsgUpdateParams message that
// the expected signer needs to sign.
func (msg MsgUpdateParams) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
func (msg MsgUpdateParams) Route() string {
return sdk.MsgTypeURL(&msg)
}
func (msg MsgUpdateParams) Type() string {
return sdk.MsgTypeURL(&msg)
}
// ValidateBasic performs basic MsgUpdateParams message validation.
func (msg MsgUpdateParams) ValidateBasic() error {
params := tmtypes.ConsensusParamsFromProto(msg.ToProtoConsensusParams())
return params.ValidateBasic()
}
func (msg MsgUpdateParams) ToProtoConsensusParams() tmproto.ConsensusParams {
return tmproto.ConsensusParams{
Block: &tmproto.BlockParams{
MaxBytes: msg.Block.MaxBytes,
MaxGas: msg.Block.MaxGas,
},
Evidence: &tmproto.EvidenceParams{
MaxAgeNumBlocks: msg.Evidence.MaxAgeNumBlocks,
MaxAgeDuration: msg.Evidence.MaxAgeDuration,
MaxBytes: msg.Evidence.MaxBytes,
},
Validator: &tmproto.ValidatorParams{
PubKeyTypes: msg.Validator.PubKeyTypes,
},
Version: tmtypes.DefaultConsensusParams().ToProto().Version, // Version is stored in x/upgrade
}
}