Make all IBC Msg types use pointers (#6857)

* Make IBC Msg types use pointers

* Fix tests

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
Aaron Craelius 2020-07-27 12:21:24 -04:00 committed by GitHub
parent 0201b94713
commit 20488b4f8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 15 deletions

View File

@ -25,9 +25,9 @@ func HandleMsgCreateClient(ctx sdk.Context, k keeper.Keeper, msg exported.MsgCre
switch clientType {
case exported.Tendermint:
tmMsg, ok := msg.(ibctmtypes.MsgCreateClient)
tmMsg, ok := msg.(*ibctmtypes.MsgCreateClient)
if !ok {
return nil, sdkerrors.Wrapf(types.ErrInvalidClientType, "got %T, expected %T", msg, ibctmtypes.MsgCreateClient{})
return nil, sdkerrors.Wrapf(types.ErrInvalidClientType, "got %T, expected %T", msg, &ibctmtypes.MsgCreateClient{})
}
var err error

View File

@ -52,7 +52,7 @@ type ClientState struct {
}
// InitializeFromMsg creates a tendermint client state from a CreateClientMsg
func InitializeFromMsg(msg MsgCreateClient) (ClientState, error) {
func InitializeFromMsg(msg *MsgCreateClient) (ClientState, error) {
return Initialize(
msg.GetClientID(), msg.TrustLevel,
msg.TrustingPeriod, msg.UnbondingPeriod, msg.MaxClockDrift,

View File

@ -45,18 +45,18 @@ type MsgCreateClient struct {
const TODO = "TODO"
// dummy implementation of proto.Message
func (msg MsgCreateClient) Reset() {}
func (msg MsgCreateClient) String() string { return TODO }
func (msg MsgCreateClient) ProtoMessage() {}
func (msg *MsgCreateClient) Reset() {}
func (msg *MsgCreateClient) String() string { return TODO }
func (msg *MsgCreateClient) ProtoMessage() {}
// NewMsgCreateClient creates a new MsgCreateClient instance
func NewMsgCreateClient(
id string, header Header, trustLevel tmmath.Fraction,
trustingPeriod, unbondingPeriod, maxClockDrift time.Duration,
specs []*ics23.ProofSpec, signer sdk.AccAddress,
) MsgCreateClient {
) *MsgCreateClient {
return MsgCreateClient{
return &MsgCreateClient{
ClientID: id,
Header: header,
TrustLevel: trustLevel,
@ -157,13 +157,13 @@ type MsgUpdateClient struct {
}
// dummy implementation of proto.Message
func (msg MsgUpdateClient) Reset() {}
func (msg MsgUpdateClient) String() string { return TODO }
func (msg MsgUpdateClient) ProtoMessage() {}
func (msg *MsgUpdateClient) Reset() {}
func (msg *MsgUpdateClient) String() string { return TODO }
func (msg *MsgUpdateClient) ProtoMessage() {}
// NewMsgUpdateClient creates a new MsgUpdateClient instance
func NewMsgUpdateClient(id string, header Header, signer sdk.AccAddress) MsgUpdateClient {
return MsgUpdateClient{
func NewMsgUpdateClient(id string, header Header, signer sdk.AccAddress) *MsgUpdateClient {
return &MsgUpdateClient{
ClientID: id,
Header: header,
Signer: signer,

View File

@ -20,7 +20,7 @@ func (suite *TendermintTestSuite) TestMsgCreateClientValidateBasic() {
invalidHeader.ValidatorSet = nil
cases := []struct {
msg ibctmtypes.MsgCreateClient
msg *ibctmtypes.MsgCreateClient
expPass bool
errMsg string
}{
@ -52,7 +52,7 @@ func (suite *TendermintTestSuite) TestMsgUpdateClient() {
signer := sdk.AccAddress(privKey.PubKey().Address())
cases := []struct {
msg ibctmtypes.MsgUpdateClient
msg *ibctmtypes.MsgUpdateClient
expPass bool
errMsg string
}{