Skip to content

Commit

Permalink
fix(x/crosschain): resolve failure in UnpackInterfacesMessage (#855)
Browse files Browse the repository at this point in the history
Co-authored-by: fx0x55 <[email protected]>
  • Loading branch information
zakir-code and fx0x55 authored Jan 2, 2025
1 parent 3c75311 commit 0514ec1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 0 additions & 2 deletions app/interface_registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"cosmos.vesting.v1beta1.VestingAccount",
"ethermint.evm.v1.TxData",
"fx.ibc.applications.transfer.v1.MemoPacket",
"gravity.v1beta1.Confirm",
"gravity.v1beta1.ExternalClaim",
"ibc.core.channel.v1.ChannelI",
"ibc.core.channel.v1.CounterpartyChannelI",
"ibc.core.channel.v1.PacketI",
Expand Down
18 changes: 8 additions & 10 deletions x/crosschain/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgConfirm{},
)

registry.RegisterInterface(
"gravity.v1beta1.ExternalClaim",
registry.RegisterImplementations(
(*govv1betal.Content)(nil),
&InitCrossChainParamsProposal{},
&UpdateChainOraclesProposal{},
)

registry.RegisterImplementations(
(*ExternalClaim)(nil),
&MsgSendToExternalClaim{},
&MsgSendToFxClaim{},
Expand All @@ -51,20 +56,13 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgBridgeCallResultClaim{},
)

registry.RegisterInterface(
"gravity.v1beta1.Confirm",
registry.RegisterImplementations(
(*Confirm)(nil),
&MsgConfirmBatch{},
&MsgOracleSetConfirm{},
&MsgBridgeCallConfirm{},
)

registry.RegisterImplementations(
(*govv1betal.Content)(nil),
&InitCrossChainParamsProposal{},
&UpdateChainOraclesProposal{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

Expand Down
14 changes: 14 additions & 0 deletions x/crosschain/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
sdktx "github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/gogoproto/proto"
"github.com/ethereum/go-ethereum/common"
)
Expand Down Expand Up @@ -67,8 +68,11 @@ var (
_ sdk.Msg = &MsgUpdateParams{}
_ sdk.Msg = &MsgUpdateChainOracles{}
_ sdk.Msg = &MsgClaim{}
_ sdk.Msg = &MsgConfirm{}
)

var _ codectypes.UnpackInterfacesMessage = &MsgClaim{}

func (m *MsgBondedOracle) ValidateBasic() (err error) {
if _, ok := externalAddressRouter[m.ChainName]; !ok {
return sdkerrors.ErrInvalidRequest.Wrap("unrecognized crosschain name")
Expand Down Expand Up @@ -310,6 +314,11 @@ func (m *MsgClaim) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{claim.GetClaimer()}
}

// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (m MsgClaim) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return sdktx.UnpackInterfaces(unpacker, []*codectypes.Any{m.Claim})
}

func (m *MsgSendToFxClaim) GetType() ClaimType {
return CLAIM_TYPE_SEND_TO_FX
}
Expand Down Expand Up @@ -677,3 +686,8 @@ func (m *MsgUpdateChainOracles) ValidateBasic() error {
}
return nil
}

// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (m MsgConfirm) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return sdktx.UnpackInterfaces(unpacker, []*codectypes.Any{m.Confirm})
}

0 comments on commit 0514ec1

Please sign in to comment.