diff --git a/app/app.go b/app/app.go index 0bc64eb54..f5cff9ab7 100644 --- a/app/app.go +++ b/app/app.go @@ -471,6 +471,9 @@ func NewAxelarApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest scopedWasmK := app.capabilityKeeper.ScopeToModule(wasm.ModuleName) // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks + wasmOpts = append(wasmOpts, wasmkeeper.WithMessageHandlerDecorator(func(old wasmkeeper.Messenger) wasmkeeper.Messenger { + return wasmkeeper.NewMessageHandlerChain(old, nexusKeeper.NewMessenger(nexusK)) + })) wasmK = wasm.NewKeeper( appCodec, keys[wasm.StoreKey], diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 09eee4bbd..194656383 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -56,6 +56,7 @@ - [FeeInfo](#axelar.nexus.exported.v1beta1.FeeInfo) - [GeneralMessage](#axelar.nexus.exported.v1beta1.GeneralMessage) - [TransferFee](#axelar.nexus.exported.v1beta1.TransferFee) + - [WasmMessage](#axelar.nexus.exported.v1beta1.WasmMessage) - [GeneralMessage.Status](#axelar.nexus.exported.v1beta1.GeneralMessage.Status) - [TransferDirection](#axelar.nexus.exported.v1beta1.TransferDirection) @@ -379,6 +380,7 @@ - [MessageProcessing](#axelar.nexus.v1beta1.MessageProcessing) - [MessageReceived](#axelar.nexus.v1beta1.MessageReceived) - [RateLimitUpdated](#axelar.nexus.v1beta1.RateLimitUpdated) + - [WasmMessageRouted](#axelar.nexus.v1beta1.WasmMessageRouted) - [axelar/nexus/v1beta1/genesis.proto](#axelar/nexus/v1beta1/genesis.proto) - [GenesisState](#axelar.nexus.v1beta1.GenesisState) @@ -1325,6 +1327,27 @@ TransferFee represents accumulated fees generated by the network + + + +### WasmMessage + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `source_chain` | [string](#string) | | | +| `source_address` | [string](#string) | | | +| `destination_chain` | [string](#string) | | | +| `destination_address` | [string](#string) | | | +| `payload_hash` | [bytes](#bytes) | | | +| `source_tx_id` | [bytes](#bytes) | | | +| `source_tx_index` | [uint64](#uint64) | | | + + + + + @@ -5979,6 +6002,21 @@ Query defines the gRPC querier service. + + + +### WasmMessageRouted + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `message` | [axelar.nexus.exported.v1beta1.WasmMessage](#axelar.nexus.exported.v1beta1.WasmMessage) | | | + + + + + diff --git a/proto/axelar/nexus/exported/v1beta1/types.proto b/proto/axelar/nexus/exported/v1beta1/types.proto index 7e1b7f386..d787f748b 100644 --- a/proto/axelar/nexus/exported/v1beta1/types.proto +++ b/proto/axelar/nexus/exported/v1beta1/types.proto @@ -109,3 +109,13 @@ message GeneralMessage { bytes source_tx_id = 7 [ (gogoproto.customname) = "SourceTxID" ]; uint64 source_tx_index = 8; } + +message WasmMessage { + string source_chain = 1 [ (gogoproto.casttype) = "ChainName" ]; + string source_address = 2; + string destination_chain = 3 [ (gogoproto.casttype) = "ChainName" ]; + string destination_address = 4; + bytes payload_hash = 5; + bytes source_tx_id = 6 [ (gogoproto.customname) = "SourceTxID" ]; + uint64 source_tx_index = 7; +} diff --git a/proto/axelar/nexus/v1beta1/events.proto b/proto/axelar/nexus/v1beta1/events.proto index 554c7b50e..7ec5ec829 100644 --- a/proto/axelar/nexus/v1beta1/events.proto +++ b/proto/axelar/nexus/v1beta1/events.proto @@ -60,3 +60,7 @@ message MessageProcessing { string id = 1 [ (gogoproto.customname) = "ID" ]; } message MessageExecuted { string id = 1 [ (gogoproto.customname) = "ID" ]; } message MessageFailed { string id = 1 [ (gogoproto.customname) = "ID" ]; } + +message WasmMessageRouted { + exported.v1beta1.WasmMessage message = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/x/axelarnet/types/expected_keepers.go b/x/axelarnet/types/expected_keepers.go index 1f48191ae..b09d0e771 100644 --- a/x/axelarnet/types/expected_keepers.go +++ b/x/axelarnet/types/expected_keepers.go @@ -12,8 +12,7 @@ import ( ibctypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" - ibcclient "github.com/cosmos/ibc-go/v4/modules/core/exported" - ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported" + ibc "github.com/cosmos/ibc-go/v4/modules/core/exported" tmbytes "github.com/tendermint/tendermint/libs/bytes" "github.com/tendermint/tendermint/libs/log" @@ -89,15 +88,15 @@ type IBCTransferKeeper interface { // ChannelKeeper defines the expected IBC channel keeper type ChannelKeeper interface { GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) - GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, ibcclient.ClientState, error) + GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, ibc.ClientState, error) GetChannel(ctx sdk.Context, srcPort string, srcChan string) (channel channeltypes.Channel, found bool) // used in module_test - SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error // used in module_test + SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibc.PacketI) error // used in module_test WriteAcknowledgement( ctx sdk.Context, chanCap *capabilitytypes.Capability, - packet ibcexported.PacketI, - ack ibcexported.Acknowledgement, + packet ibc.PacketI, + ack ibc.Acknowledgement, ) error GetAppVersion(ctx sdk.Context, portID string, channelID string) (string, bool) // used in module_test } diff --git a/x/nexus/exported/types.pb.go b/x/nexus/exported/types.pb.go index 3455c6a99..38118cf33 100644 --- a/x/nexus/exported/types.pb.go +++ b/x/nexus/exported/types.pb.go @@ -402,6 +402,49 @@ func (m *GeneralMessage) XXX_DiscardUnknown() { var xxx_messageInfo_GeneralMessage proto.InternalMessageInfo +type WasmMessage struct { + SourceChain ChainName `protobuf:"bytes,1,opt,name=source_chain,json=sourceChain,proto3,casttype=ChainName" json:"source_chain,omitempty"` + SourceAddress string `protobuf:"bytes,2,opt,name=source_address,json=sourceAddress,proto3" json:"source_address,omitempty"` + DestinationChain ChainName `protobuf:"bytes,3,opt,name=destination_chain,json=destinationChain,proto3,casttype=ChainName" json:"destination_chain,omitempty"` + DestinationAddress string `protobuf:"bytes,4,opt,name=destination_address,json=destinationAddress,proto3" json:"destination_address,omitempty"` + PayloadHash []byte `protobuf:"bytes,5,opt,name=payload_hash,json=payloadHash,proto3" json:"payload_hash,omitempty"` + SourceTxID []byte `protobuf:"bytes,6,opt,name=source_tx_id,json=sourceTxId,proto3" json:"source_tx_id,omitempty"` + SourceTxIndex uint64 `protobuf:"varint,7,opt,name=source_tx_index,json=sourceTxIndex,proto3" json:"source_tx_index,omitempty"` +} + +func (m *WasmMessage) Reset() { *m = WasmMessage{} } +func (m *WasmMessage) String() string { return proto.CompactTextString(m) } +func (*WasmMessage) ProtoMessage() {} +func (*WasmMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_82a7a8692925fe67, []int{7} +} +func (m *WasmMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WasmMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WasmMessage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WasmMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_WasmMessage.Merge(m, src) +} +func (m *WasmMessage) XXX_Size() int { + return m.Size() +} +func (m *WasmMessage) XXX_DiscardUnknown() { + xxx_messageInfo_WasmMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_WasmMessage proto.InternalMessageInfo + func init() { proto.RegisterEnum("axelar.nexus.exported.v1beta1.TransferState", TransferState_name, TransferState_value) proto.RegisterEnum("axelar.nexus.exported.v1beta1.TransferDirection", TransferDirection_name, TransferDirection_value) @@ -413,6 +456,7 @@ func init() { proto.RegisterType((*FeeInfo)(nil), "axelar.nexus.exported.v1beta1.FeeInfo") proto.RegisterType((*Asset)(nil), "axelar.nexus.exported.v1beta1.Asset") proto.RegisterType((*GeneralMessage)(nil), "axelar.nexus.exported.v1beta1.GeneralMessage") + proto.RegisterType((*WasmMessage)(nil), "axelar.nexus.exported.v1beta1.WasmMessage") } func init() { @@ -420,80 +464,85 @@ func init() { } var fileDescriptor_82a7a8692925fe67 = []byte{ - // 1155 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x1b, 0xc5, - 0x1b, 0xf7, 0x3a, 0x7e, 0xcb, 0xe4, 0xa5, 0xee, 0xa8, 0xff, 0xd6, 0x7f, 0xa3, 0xae, 0x5d, 0x53, - 0xda, 0x14, 0xd1, 0x75, 0x5f, 0x28, 0x47, 0xc0, 0xb1, 0xd7, 0xe9, 0xd2, 0x76, 0x6d, 0xad, 0xd7, - 0x08, 0x71, 0x59, 0x6d, 0x76, 0x1f, 0x3b, 0xa3, 0xc4, 0x33, 0xd6, 0xce, 0xba, 0x38, 0xdf, 0x00, - 0x85, 0x0b, 0x07, 0xae, 0x3e, 0x20, 0x38, 0x20, 0xc4, 0x97, 0xe0, 0x44, 0x2f, 0x48, 0x3d, 0x22, - 0x0e, 0x06, 0xd2, 0x6f, 0xd1, 0x13, 0x9a, 0xd9, 0xdd, 0xc4, 0x49, 0xa3, 0x06, 0x2a, 0x4e, 0x9e, - 0x99, 0xe7, 0x79, 0x7e, 0xcf, 0xef, 0xf7, 0xbc, 0x58, 0x8b, 0x6e, 0xb9, 0x53, 0xd8, 0x73, 0x83, - 0x3a, 0x85, 0xe9, 0x84, 0xd7, 0x61, 0x3a, 0x66, 0x41, 0x08, 0x7e, 0xfd, 0xe9, 0xdd, 0x6d, 0x08, - 0xdd, 0xbb, 0xf5, 0x70, 0x7f, 0x0c, 0x5c, 0x1b, 0x07, 0x2c, 0x64, 0xf8, 0x6a, 0xe4, 0xaa, 0x49, - 0x57, 0x2d, 0x71, 0xd5, 0x62, 0xd7, 0xf2, 0xa5, 0x21, 0x1b, 0x32, 0xe9, 0x59, 0x17, 0xa7, 0x28, - 0xa8, 0xac, 0x7a, 0x8c, 0x8f, 0x18, 0xaf, 0x6f, 0xbb, 0x1c, 0x8e, 0x50, 0x3d, 0x46, 0x68, 0x6c, - 0xbf, 0x19, 0xe7, 0x0f, 0xf9, 0xeb, 0xb3, 0xd7, 0x7e, 0x56, 0x50, 0xb6, 0xb9, 0xe3, 0x12, 0x8a, - 0xaf, 0xa1, 0x0c, 0x75, 0x47, 0x50, 0x52, 0xaa, 0xca, 0xc6, 0xf2, 0xe6, 0xda, 0xcb, 0x79, 0x65, - 0x59, 0x1a, 0x4c, 0x77, 0x04, 0x96, 0x34, 0xe1, 0x0f, 0xd0, 0x15, 0x3e, 0x19, 0x0b, 0x34, 0xee, - 0x0c, 0x58, 0x00, 0x64, 0x48, 0x1d, 0x97, 0x73, 0x08, 0x79, 0x69, 0xa9, 0xaa, 0x6c, 0x14, 0xac, - 0xff, 0x25, 0xe6, 0x76, 0x64, 0x6d, 0x48, 0x23, 0xfe, 0x08, 0x15, 0x76, 0x61, 0xdf, 0x11, 0x79, - 0x4b, 0x99, 0xaa, 0xb2, 0xb1, 0x7e, 0xef, 0xba, 0x16, 0xab, 0x0e, 0xf9, 0xab, 0x9a, 0xb5, 0x47, - 0xb0, 0x6f, 0xef, 0x8f, 0xc1, 0xca, 0xef, 0x46, 0x07, 0x7c, 0x19, 0xe5, 0x46, 0xcc, 0x9f, 0xec, - 0x41, 0x29, 0x2b, 0xd8, 0x59, 0xf1, 0xed, 0x93, 0x4c, 0x21, 0x5d, 0x5c, 0xaa, 0x31, 0x74, 0xb1, - 0x19, 0x30, 0xce, 0x25, 0xdd, 0x86, 0xef, 0x07, 0xc0, 0x39, 0xfe, 0x18, 0x65, 0x3d, 0x71, 0x97, - 0x7a, 0x56, 0x8e, 0x13, 0x9e, 0x5d, 0x66, 0x4d, 0xc6, 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, 0x35, 0x18, 0xd4, 0x63, 0x23, 0x21, 0xf7, 0x6c, 0xf7, 0x4e, 0xdf, 0xde, 0xea, 0x44, 0x6d, - 0x94, 0xee, 0x9d, 0x49, 0x38, 0x64, 0x84, 0x0e, 0xcb, 0x19, 0x41, 0x79, 0xb3, 0xf7, 0xec, 0x2f, - 0x35, 0xf5, 0xec, 0x50, 0x55, 0x9e, 0x1f, 0xaa, 0xca, 0x9f, 0x87, 0xaa, 0xf2, 0xf5, 0x0b, 0x35, - 0xf5, 0xfc, 0x85, 0x9a, 0xfa, 0xed, 0x85, 0x9a, 0xfa, 0xfc, 0xc1, 0xc2, 0x1f, 0x56, 0xb4, 0x39, - 0x14, 0xc2, 0x2f, 0x58, 0xb0, 0x1b, 0xdf, 0x6e, 0x7b, 0x2c, 0x80, 0xfa, 0xf4, 0xd4, 0x27, 0xd2, - 0x76, 0x4e, 0x7e, 0x97, 0xdc, 0xff, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x8b, 0x8f, 0x7e, 0x42, - 0x09, 0x00, 0x00, + // 1237 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x6f, 0x1b, 0x55, + 0x14, 0xf6, 0xf8, 0x9d, 0xeb, 0x24, 0x75, 0x2e, 0xa5, 0x35, 0x46, 0xb5, 0x5d, 0xd3, 0x47, 0x5a, + 0x51, 0xbb, 0x0f, 0xca, 0x82, 0x05, 0xe0, 0xd8, 0xe3, 0x74, 0x68, 0x3b, 0xb6, 0xc6, 0x36, 0x20, + 0x36, 0xd6, 0x64, 0xe6, 0xd8, 0x19, 0x25, 0xbe, 0xd7, 0x9a, 0x3b, 0x2e, 0xce, 0x3f, 0x40, 0x61, + 0xc3, 0x82, 0x6d, 0x16, 0x08, 0x16, 0x08, 0xf1, 0x27, 0x58, 0xd1, 0x0d, 0x52, 0x97, 0x88, 0x45, + 0x80, 0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 0x5d, 0x88, 0x3c, 0x3d, 0x2a, 0x68, 0xcf, 0x8e, 0x0a, 0xda, 0x5f, 0x47, 0x05, 0xed, 0x9b, 0xe7, + 0x85, 0xc8, 0xb3, 0xe7, 0x85, 0xc8, 0xef, 0xcf, 0x0b, 0x91, 0x2f, 0xee, 0xcf, 0x7d, 0x03, 0xe4, + 0xcb, 0x88, 0x40, 0xf0, 0x25, 0xf5, 0x77, 0xd4, 0xe9, 0x96, 0x43, 0x7d, 0xa8, 0x4e, 0x17, 0xfe, + 0x75, 0x6e, 0x25, 0xc5, 0x5f, 0xbd, 0x7b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc7, 0xc5, 0xf7, + 0x02, 0x95, 0x0a, 0x00, 0x00, } func (m *Chain) Marshal() (dAtA []byte, err error) { @@ -871,6 +920,76 @@ func (m *GeneralMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *WasmMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WasmMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WasmMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SourceTxIndex != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SourceTxIndex)) + i-- + dAtA[i] = 0x38 + } + if len(m.SourceTxID) > 0 { + i -= len(m.SourceTxID) + copy(dAtA[i:], m.SourceTxID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourceTxID))) + i-- + dAtA[i] = 0x32 + } + if len(m.PayloadHash) > 0 { + i -= len(m.PayloadHash) + copy(dAtA[i:], m.PayloadHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PayloadHash))) + i-- + dAtA[i] = 0x2a + } + if len(m.DestinationAddress) > 0 { + i -= len(m.DestinationAddress) + copy(dAtA[i:], m.DestinationAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DestinationAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.SourceAddress) > 0 { + i -= len(m.SourceAddress) + copy(dAtA[i:], m.SourceAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourceAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.SourceChain) > 0 { + i -= len(m.SourceChain) + copy(dAtA[i:], m.SourceChain) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SourceChain))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -1028,6 +1147,42 @@ func (m *GeneralMessage) Size() (n int) { return n } +func (m *WasmMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SourceChain) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.SourceAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.DestinationAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.PayloadHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.SourceTxID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SourceTxIndex != 0 { + n += 1 + sovTypes(uint64(m.SourceTxIndex)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2145,6 +2300,271 @@ func (m *GeneralMessage) Unmarshal(dAtA []byte) error { } return nil } +func (m *WasmMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WasmMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WasmMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChain = ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DestinationAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PayloadHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PayloadHash = append(m.PayloadHash[:0], dAtA[iNdEx:postIndex]...) + if m.PayloadHash == nil { + m.PayloadHash = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceTxID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceTxID = append(m.SourceTxID[:0], dAtA[iNdEx:postIndex]...) + if m.SourceTxID == nil { + m.SourceTxID = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SourceTxIndex", wireType) + } + m.SourceTxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SourceTxIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/nexus/keeper/general_message.go b/x/nexus/keeper/general_message.go index ae9fe0242..cb314b252 100644 --- a/x/nexus/keeper/general_message.go +++ b/x/nexus/keeper/general_message.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/axelarnetwork/axelar-core/utils" @@ -35,6 +36,53 @@ func (k Keeper) GenerateMessageID(ctx sdk.Context) (string, []byte, uint64) { return fmt.Sprintf("0x%s-%d", hex.EncodeToString(hash[:]), nonce), hash[:], nonce } +// SetNewWasmMessage sets the given general message from a wasm contract. +func (k Keeper) SetNewWasmMessage(ctx sdk.Context, msg exported.GeneralMessage) error { + if msg.Asset != nil { + return fmt.Errorf("asset transfer is not supported") + } + + if _, ok := k.GetChain(ctx, msg.GetDestinationChain()); !ok { + return fmt.Errorf("destination chain %s is not a registered chain", msg.GetDestinationChain()) + } + + if !k.IsChainActivated(ctx, msg.Recipient.Chain) { + return fmt.Errorf("destination chain %s is not activated", msg.GetDestinationChain()) + } + + if err := k.ValidateAddress(ctx, msg.Recipient); err != nil { + return sdkerrors.Wrap(err, "invalid recipient address") + } + + if _, ok := k.GetMessage(ctx, msg.ID); ok { + return fmt.Errorf("general message %s already exists", msg.ID) + } + + if err := k.setMessage(ctx, msg); err != nil { + return err + } + + switch msg.Status { + case exported.Approved: + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageReceived{ + ID: msg.ID, + PayloadHash: msg.PayloadHash, + Sender: msg.Sender, + Recipient: msg.Recipient, + })) + case exported.Processing: + if err := k.setProcessingMessageID(ctx, msg); err != nil { + return err + } + + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageProcessing{ID: msg.ID})) + default: + return fmt.Errorf("invalid message status %s", msg.Status) + } + + return nil +} + // SetNewMessage sets the given general message. If the messages is approved, adds the message ID to approved messages store func (k Keeper) SetNewMessage(ctx sdk.Context, m exported.GeneralMessage) error { sourceChain, ok := k.GetChain(ctx, m.GetSourceChain()) diff --git a/x/nexus/keeper/general_message_test.go b/x/nexus/keeper/general_message_test.go index fa8ea5d0b..60e800fcc 100644 --- a/x/nexus/keeper/general_message_test.go +++ b/x/nexus/keeper/general_message_test.go @@ -15,6 +15,7 @@ import ( "github.com/axelarnetwork/axelar-core/testutils/rand" "github.com/axelarnetwork/axelar-core/utils" axelarnet "github.com/axelarnetwork/axelar-core/x/axelarnet/exported" + evm "github.com/axelarnetwork/axelar-core/x/evm/exported" evmtypes "github.com/axelarnetwork/axelar-core/x/evm/types" evmtestutils "github.com/axelarnetwork/axelar-core/x/evm/types/testutils" "github.com/axelarnetwork/axelar-core/x/nexus/exported" @@ -24,6 +25,124 @@ import ( . "github.com/axelarnetwork/utils/test" ) +func randWasmMsg(status exported.GeneralMessage_Status) exported.GeneralMessage { + return exported.GeneralMessage{ + ID: rand.NormalizedStr(10), + Sender: exported.CrossChainAddress{ + Chain: nexustestutils.RandomChain(), + Address: rand.NormalizedStr(42), + }, + Recipient: exported.CrossChainAddress{ + Chain: evm.Ethereum, + Address: evmtestutils.RandomAddress().Hex(), + }, + PayloadHash: evmtestutils.RandomHash().Bytes(), + Status: status, + Asset: nil, + SourceTxID: evmtestutils.RandomHash().Bytes(), + SourceTxIndex: uint64(rand.I64Between(0, 100)), + } +} + +func TestSetNewWasmMessage(t *testing.T) { + var ( + msg exported.GeneralMessage + ctx sdk.Context + keeper nexus.Keeper + ) + + cfg := app.MakeEncodingConfig() + givenKeeper := Given("the keeper", func() { + keeper, ctx = setup(cfg) + }) + + givenKeeper. + When("the message is valid", func() { + msg = randWasmMsg(exported.Approved) + }). + Branch( + When("the message contains token transfer", func() { + coin := rand.Coin() + msg.Asset = &coin + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "asset transfer is not supported") + }), + + When("the destination chain is not registered", func() { + msg.Recipient.Chain = nexustestutils.RandomChain() + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "is not a registered chain") + }), + + When("the destination chain is not activated", func() { + keeper.DeactivateChain(ctx, msg.Recipient.Chain) + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "is not activated") + }), + + When("the recipient address is invalid", func() { + msg.Recipient.Address = rand.Str(20) + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "invalid recipient address") + }), + + When("the message already exists", func() { + keeper.SetNewWasmMessage(ctx, msg) + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "already exists") + }), + + When("the message is invalid", func() { + msg.Sender.Address = "" + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "invalid source chain: invalid address: string is empty") + }), + + When("the message status is invalid", func() { + msg.Status = exported.Failed + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, keeper.SetNewWasmMessage(ctx, msg), "invalid message status") + }), + ). + Run(t) + + givenKeeper. + Branch( + When("the message status is approved", func() { + msg = randWasmMsg(exported.Approved) + }). + Then("should be stored as approved and emit MessageReceived event", func(t *testing.T) { + assert.NoError(t, keeper.SetNewWasmMessage(ctx, msg)) + + actual, ok := keeper.GetMessage(ctx, msg.ID) + assert.True(t, ok) + assert.Equal(t, msg, actual) + assert.Equal(t, "axelar.nexus.v1beta1.MessageReceived", ctx.EventManager().Events()[len(ctx.EventManager().Events())-1].Type) + }), + + When("the message status is processing", func() { + msg = randWasmMsg(exported.Processing) + }). + Then("should be stored as processing and emit MessageProcessing event", func(t *testing.T) { + assert.NoError(t, keeper.SetNewWasmMessage(ctx, msg)) + + actual, ok := keeper.GetMessage(ctx, msg.ID) + assert.True(t, ok) + assert.Equal(t, msg, actual) + assert.Equal(t, "axelar.nexus.v1beta1.MessageProcessing", ctx.EventManager().Events()[len(ctx.EventManager().Events())-1].Type) + assert.Equal(t, msg, keeper.GetProcessingMessages(ctx, msg.GetDestinationChain(), 1)[0]) + }), + ). + Run(t) +} + func TestSetNewGeneralMessage(t *testing.T) { var ( generalMessage exported.GeneralMessage @@ -53,7 +172,6 @@ func TestSetNewGeneralMessage(t *testing.T) { PayloadHash: crypto.Keccak256Hash(rand.Bytes(int(rand.I64Between(1, 100)))).Bytes(), Asset: &asset, } - }) whenChainsAreRegistered := givenContractCallEvent. diff --git a/x/nexus/keeper/msg_dispatcher.go b/x/nexus/keeper/msg_dispatcher.go new file mode 100644 index 000000000..2baa592d1 --- /dev/null +++ b/x/nexus/keeper/msg_dispatcher.go @@ -0,0 +1,94 @@ +package keeper + +import ( + "encoding/json" + "fmt" + + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + axelarnet "github.com/axelarnetwork/axelar-core/x/axelarnet/exported" + "github.com/axelarnetwork/axelar-core/x/nexus/exported" + "github.com/axelarnetwork/axelar-core/x/nexus/types" + tss "github.com/axelarnetwork/axelar-core/x/tss/exported" + "github.com/axelarnetwork/utils/funcs" +) + +var _ wasmkeeper.Messenger = (*Messenger)(nil) + +type request = exported.WasmMessage + +type Messenger struct { + types.Nexus +} + +// NewMessenger returns a new Messenger +func NewMessenger(nexus types.Nexus) Messenger { + return Messenger{nexus} +} + +// DispatchMsg decodes the messages from the cosmowasm connection router and routes them to the nexus module if possible +func (m Messenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { + req := request{} + if err := json.Unmarshal(msg.Custom, &req); err != nil { + return nil, nil, sdkerrors.Wrap(wasmtypes.ErrUnknownMsg, err.Error()) + } + + // TODO: rename to gateway + connectionRouter := m.GetParams(ctx).ConnectionRouter + + if len(connectionRouter) == 0 { + return nil, nil, fmt.Errorf("connection router is not set") + } + + if !connectionRouter.Equals(contractAddr) { + return nil, nil, fmt.Errorf("contract address %s is not the connection router", contractAddr) + } + + if err := m.routeMsg(ctx, req); err != nil { + return nil, nil, err + } + + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.WasmMessageRouted{Message: req})) + + return nil, nil, nil +} + +func (m Messenger) routeMsg(ctx sdk.Context, msg exported.WasmMessage) error { + destinationChain, ok := m.GetChain(ctx, msg.DestinationChain) + if !ok { + return fmt.Errorf("recipient chain %s is not a registered chain", msg.DestinationChain) + } + + id, _, _ := m.GenerateMessageID(ctx) + sourceChain := exported.Chain{Name: msg.SourceChain, SupportsForeignAssets: false, KeyType: tss.None, Module: wasmtypes.ModuleName} + sender := exported.CrossChainAddress{Chain: sourceChain, Address: msg.SourceAddress} + recipient := exported.CrossChainAddress{Chain: destinationChain, Address: msg.DestinationAddress} + + // set status to approved if the message is sent to a cosmos chain and set + // to processing otherwise, because messages sent to cosmos chains require + // translation with the original payload. + // https://github.com/axelarnetwork/axelar-core/blob/ea48d5b974dfd94ea235311eddabe23bfa430cd9/x/axelarnet/keeper/msg_server.go#L520 + status := exported.Approved + if !destinationChain.IsFrom(axelarnet.ModuleName) { + status = exported.Processing + } + + if err := m.Nexus.SetNewWasmMessage(ctx, exported.NewGeneralMessage( + id, + sender, + recipient, + msg.PayloadHash, + status, + msg.SourceTxID, + msg.SourceTxIndex, + nil, + )); err != nil { + return err + } + + return nil +} diff --git a/x/nexus/keeper/msg_dispatcher_test.go b/x/nexus/keeper/msg_dispatcher_test.go new file mode 100644 index 000000000..ae0bd3bcf --- /dev/null +++ b/x/nexus/keeper/msg_dispatcher_test.go @@ -0,0 +1,200 @@ +package keeper_test + +import ( + "errors" + "fmt" + "testing" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/axelarnetwork/axelar-core/testutils/fake" + "github.com/axelarnetwork/axelar-core/testutils/rand" + axelarnet "github.com/axelarnetwork/axelar-core/x/axelarnet/exported" + evm "github.com/axelarnetwork/axelar-core/x/evm/exported" + "github.com/axelarnetwork/axelar-core/x/nexus/exported" + "github.com/axelarnetwork/axelar-core/x/nexus/keeper" + "github.com/axelarnetwork/axelar-core/x/nexus/types" + "github.com/axelarnetwork/axelar-core/x/nexus/types/mock" + . "github.com/axelarnetwork/utils/test" +) + +func TestMessenger_DispatchMsg(t *testing.T) { + var ( + ctx sdk.Context + messenger keeper.Messenger + nexus *mock.NexusMock + msg wasmvmtypes.CosmosMsg + ) + + contractAddr := rand.AccAddr() + + givenMessenger := Given("a messenger", func() { + ctx = sdk.NewContext(fake.NewMultiStore(), tmproto.Header{}, false, log.TestingLogger()) + nexus = &mock.NexusMock{} + messenger = keeper.NewMessenger(nexus) + }) + + givenMessenger. + When("the msg is encoded incorrectly", func() { + msg = wasmvmtypes.CosmosMsg{ + Custom: []byte("[]"), + } + }). + Then("should return error", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + + assert.Error(t, err) + assert.True(t, errors.Is(err, wasmtypes.ErrUnknownMsg)) + }). + Run(t) + + givenMessenger. + When("the msg is encoded correctly", func() { + msg = wasmvmtypes.CosmosMsg{ + Custom: []byte("{}"), + } + }). + Branch( + When("the connection router is not set", func() { + nexus.GetParamsFunc = func(_ sdk.Context) types.Params { + return types.DefaultParams() + } + }). + Then("should return error", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + + assert.ErrorContains(t, err, "connection router is not set") + assert.False(t, errors.Is(err, wasmtypes.ErrUnknownMsg)) + }), + + When("the connection router is set but given contract address does not match", func() { + nexus.GetParamsFunc = func(_ sdk.Context) types.Params { + params := types.DefaultParams() + params.ConnectionRouter = rand.AccAddr() + + return params + } + }). + Then("should return error", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + + assert.ErrorContains(t, err, "is not the connection router") + assert.False(t, errors.Is(err, wasmtypes.ErrUnknownMsg)) + }), + ). + Run(t) + + givenMessenger. + When("the msg is encoded correctly and the connection router is set correctly", func() { + msg = wasmvmtypes.CosmosMsg{ + Custom: []byte("{}"), + } + + nexus.GetParamsFunc = func(_ sdk.Context) types.Params { + params := types.DefaultParams() + params.ConnectionRouter = contractAddr + + return params + } + }). + Branch( + When("the destination chain is not registered", func() { + nexus.GetChainFunc = func(_ sdk.Context, chain exported.ChainName) (exported.Chain, bool) { + return exported.Chain{}, false + } + }). + Then("should return error", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + + assert.ErrorContains(t, err, "is not a registered chain") + assert.False(t, errors.Is(err, wasmtypes.ErrUnknownMsg)) + }), + + When("the destination chain is registered", func() { + nexus.GetChainFunc = func(ctx sdk.Context, chain exported.ChainName) (exported.Chain, bool) { return exported.Chain{}, true } + + }). + When("the msg fails to be set", func() { + nexus.GenerateMessageIDFunc = func(_ sdk.Context) (string, []byte, uint64) { + return "1", []byte("1"), 1 + } + nexus.SetNewWasmMessageFunc = func(_ sdk.Context, _ exported.GeneralMessage) error { + return fmt.Errorf("set msg error") + } + }). + Then("should return error", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + + assert.ErrorContains(t, err, "set msg error") + assert.False(t, errors.Is(err, wasmtypes.ErrUnknownMsg)) + }), + ). + Run(t) + + givenMessenger. + When("the connection router is set correctly", func() { + nexus.GetParamsFunc = func(_ sdk.Context) types.Params { + params := types.DefaultParams() + params.ConnectionRouter = contractAddr + + return params + } + }). + When("the destination chain is registered", func() { + nexus.GetChainFunc = func(_ sdk.Context, chain exported.ChainName) (exported.Chain, bool) { + switch chain { + case evm.Ethereum.Name: + return evm.Ethereum, true + case axelarnet.Axelarnet.Name: + return axelarnet.Axelarnet, true + default: + return exported.Chain{}, false + } + } + }). + When("the msg succeeds to be set", func() { + nexus.GenerateMessageIDFunc = func(_ sdk.Context) (string, []byte, uint64) { + return "1", []byte("1"), 1 + } + nexus.SetNewWasmMessageFunc = func(_ sdk.Context, msg exported.GeneralMessage) error { + return nil + } + }). + Branch( + When("the destination chain is a cosmos chain", func() { + msg = wasmvmtypes.CosmosMsg{ + Custom: []byte("{\"source_chain\":\"SomeChain\",\"source_address\":\"SomeAddress\",\"destination_chain\":\"Axelarnet\",\"destination_address\":\"axelarvaloper1zh9wrak6ke4n6fclj5e8yk397czv430ygs5jz7\",\"payload_hash\":\"XZx9n7ycI4EWhVo411N4PVWPconX0CPuNfVvKDLMSOQ=\",\"source_tx_id\":\"jvJHwR7yyDhI53dnhELdJj5ZUDO/FJovyCjamgOQ5Xk=\",\"source_tx_index\":100}"), + } + }). + Then("should set message as approved", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + assert.NoError(t, err) + + assert.Len(t, nexus.SetNewWasmMessageCalls(), 1) + assert.Equal(t, nexus.SetNewWasmMessageCalls()[0].Msg.Recipient.Chain, axelarnet.Axelarnet) + assert.Equal(t, nexus.SetNewWasmMessageCalls()[0].Msg.Status, exported.Approved) + assert.Nil(t, nexus.SetNewWasmMessageCalls()[0].Msg.Asset) + }), + + When("the destination chain is a non-cosmos chain", func() { + msg = wasmvmtypes.CosmosMsg{ + Custom: []byte("{\"source_chain\":\"SomeChain\",\"source_address\":\"SomeAddress\",\"destination_chain\":\"Ethereum\",\"destination_address\":\"0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5\",\"payload_hash\":\"pOcUbpJ7WCC/TIx2sJA/qm0gZGSvDvXgK9QagbH4E2w=\",\"source_tx_id\":\"0ITBsic95Pt5EqsbMyKO04iW/74srqpDnPMzthkCM6w=\",\"source_tx_index\":0}"), + } + }). + Then("should set message as processing", func(t *testing.T) { + _, _, err := messenger.DispatchMsg(ctx, contractAddr, "", msg) + assert.NoError(t, err) + + assert.Len(t, nexus.SetNewWasmMessageCalls(), 1) + assert.Equal(t, nexus.SetNewWasmMessageCalls()[0].Msg.Recipient.Chain, evm.Ethereum) + assert.Equal(t, nexus.SetNewWasmMessageCalls()[0].Msg.Status, exported.Processing) + assert.Nil(t, nexus.SetNewWasmMessageCalls()[0].Msg.Asset) + }), + ). + Run(t) +} diff --git a/x/nexus/types/events.pb.go b/x/nexus/types/events.pb.go index e6ea2d978..02bf10c66 100644 --- a/x/nexus/types/events.pb.go +++ b/x/nexus/types/events.pb.go @@ -469,6 +469,54 @@ func (m *MessageFailed) GetID() string { func (*MessageFailed) XXX_MessageName() string { return "axelar.nexus.v1beta1.MessageFailed" } + +type WasmMessageRouted struct { + Message exported.WasmMessage `protobuf:"bytes,1,opt,name=message,proto3" json:"message"` +} + +func (m *WasmMessageRouted) Reset() { *m = WasmMessageRouted{} } +func (m *WasmMessageRouted) String() string { return proto.CompactTextString(m) } +func (*WasmMessageRouted) ProtoMessage() {} +func (*WasmMessageRouted) Descriptor() ([]byte, []int) { + return fileDescriptor_4433ea5171b09eb9, []int{7} +} +func (m *WasmMessageRouted) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WasmMessageRouted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WasmMessageRouted.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WasmMessageRouted) XXX_Merge(src proto.Message) { + xxx_messageInfo_WasmMessageRouted.Merge(m, src) +} +func (m *WasmMessageRouted) XXX_Size() int { + return m.Size() +} +func (m *WasmMessageRouted) XXX_DiscardUnknown() { + xxx_messageInfo_WasmMessageRouted.DiscardUnknown(m) +} + +var xxx_messageInfo_WasmMessageRouted proto.InternalMessageInfo + +func (m *WasmMessageRouted) GetMessage() exported.WasmMessage { + if m != nil { + return m.Message + } + return exported.WasmMessage{} +} + +func (*WasmMessageRouted) XXX_MessageName() string { + return "axelar.nexus.v1beta1.WasmMessageRouted" +} func init() { proto.RegisterType((*FeeDeducted)(nil), "axelar.nexus.v1beta1.FeeDeducted") proto.RegisterType((*InsufficientFee)(nil), "axelar.nexus.v1beta1.InsufficientFee") @@ -477,52 +525,55 @@ func init() { proto.RegisterType((*MessageProcessing)(nil), "axelar.nexus.v1beta1.MessageProcessing") proto.RegisterType((*MessageExecuted)(nil), "axelar.nexus.v1beta1.MessageExecuted") proto.RegisterType((*MessageFailed)(nil), "axelar.nexus.v1beta1.MessageFailed") + proto.RegisterType((*WasmMessageRouted)(nil), "axelar.nexus.v1beta1.WasmMessageRouted") } func init() { proto.RegisterFile("axelar/nexus/v1beta1/events.proto", fileDescriptor_4433ea5171b09eb9) } var fileDescriptor_4433ea5171b09eb9 = []byte{ - // 625 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0x41, 0x4f, 0x13, 0x41, - 0x14, 0xee, 0xb4, 0xd0, 0xc8, 0x14, 0x05, 0x26, 0xc4, 0x54, 0x0e, 0x5b, 0xe8, 0x45, 0x08, 0x71, - 0x57, 0x30, 0xc6, 0x83, 0x07, 0xb5, 0x54, 0x62, 0x13, 0x25, 0x64, 0x83, 0x07, 0xbd, 0x90, 0xe9, - 0xce, 0xeb, 0x76, 0xe2, 0x76, 0x66, 0x33, 0x33, 0x0b, 0xe5, 0x27, 0x78, 0x30, 0xf1, 0xe8, 0x4f, - 0xe2, 0xc8, 0xd1, 0x53, 0xd5, 0xf6, 0x1f, 0x78, 0xe4, 0x64, 0x76, 0x77, 0xba, 0x04, 0x13, 0x12, - 0x24, 0x26, 0x5e, 0xbc, 0x4d, 0x5f, 0xbf, 0xf7, 0xbe, 0x6f, 0xbe, 0x6f, 0xf6, 0xe1, 0x35, 0x3a, - 0x84, 0x88, 0x2a, 0x4f, 0xc0, 0x30, 0xd1, 0xde, 0xd1, 0x56, 0x17, 0x0c, 0xdd, 0xf2, 0xe0, 0x08, - 0x84, 0xd1, 0x6e, 0xac, 0xa4, 0x91, 0x64, 0x39, 0x87, 0xb8, 0x19, 0xc4, 0xb5, 0x90, 0x15, 0x27, - 0x94, 0x32, 0x8c, 0xc0, 0xcb, 0x30, 0xdd, 0xa4, 0xe7, 0xb1, 0x44, 0x51, 0xc3, 0xa5, 0xc8, 0xbb, - 0x56, 0x96, 0x43, 0x19, 0xca, 0xec, 0xe8, 0xa5, 0x27, 0x5b, 0x75, 0x02, 0xa9, 0x07, 0x52, 0x7b, - 0x5d, 0xaa, 0xa1, 0x60, 0x0b, 0x24, 0x9f, 0x76, 0x6d, 0x5c, 0x92, 0x03, 0xc3, 0x58, 0x2a, 0x03, - 0xac, 0x40, 0x9a, 0x93, 0x18, 0xac, 0xac, 0xe6, 0xc7, 0x0a, 0xae, 0xed, 0x02, 0xb4, 0x81, 0x25, - 0x81, 0x01, 0x46, 0x34, 0xae, 0x19, 0x45, 0x85, 0xee, 0x81, 0x3a, 0xe4, 0xac, 0x8e, 0x56, 0xd1, - 0xfa, 0x4c, 0xcb, 0x1f, 0x8f, 0x1a, 0xf8, 0xc0, 0x96, 0x3b, 0xed, 0xf3, 0x51, 0xe3, 0x79, 0xc8, - 0x4d, 0x3f, 0xe9, 0xba, 0x81, 0x1c, 0x78, 0x39, 0x99, 0x00, 0x73, 0x2c, 0xd5, 0x07, 0xfb, 0xeb, - 0x41, 0x20, 0x15, 0x78, 0xc3, 0xdf, 0x14, 0xb8, 0x17, 0x33, 0x7c, 0x3c, 0xa5, 0xe9, 0x30, 0x12, - 0xe1, 0x05, 0x05, 0x01, 0x8f, 0x39, 0x08, 0x73, 0x18, 0xf4, 0x29, 0x17, 0xf5, 0xf2, 0x2a, 0x5a, - 0x9f, 0x6b, 0xed, 0x9c, 0x8f, 0x1a, 0xcf, 0x6e, 0x46, 0xb5, 0x93, 0x8e, 0xd9, 0xa3, 0x03, 0xf0, - 0xef, 0x14, 0xb3, 0xb3, 0x1a, 0xd9, 0xc4, 0x4b, 0x17, 0x6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c, 0xac, 0xe1, 0xf9, 0x98, - 0x9e, 0x44, 0x92, 0xb2, 0xc3, 0x3e, 0xd5, 0xfd, 0x4c, 0xe6, 0xbc, 0x5f, 0xb3, 0xb5, 0x57, 0x54, - 0xf7, 0xc9, 0x1e, 0xae, 0x6a, 0x10, 0x0c, 0x94, 0xd5, 0xf2, 0xd0, 0xbd, 0xb4, 0xf6, 0x8a, 0xbb, - 0x17, 0xb7, 0x51, 0x52, 0xeb, 0xcc, 0x08, 0x1b, 0xf0, 0x34, 0xb5, 0x7c, 0x0a, 0x39, 0xc0, 0x73, - 0xc5, 0x13, 0xb0, 0x89, 0xdf, 0x74, 0xe4, 0xc5, 0xa0, 0xe6, 0x26, 0x5e, 0xb2, 0x77, 0xde, 0x57, - 0x32, 0x00, 0xad, 0xb9, 0x08, 0xaf, 0xba, 0x75, 0x73, 0xa3, 0x30, 0xe8, 0xe5, 0x10, 0x82, 0xc4, - 0x5c, 0x6d, 0x50, 0xf3, 0x3e, 0xbe, 0x6d, 0xa1, 0xbb, 0x94, 0x47, 0x57, 0x03, 0x5b, 0xfb, 0xa7, - 0x63, 0x07, 0x9d, 0x8d, 0x1d, 0xf4, 0x7d, 0xec, 0xa0, 0xcf, 0x13, 0xa7, 0x74, 0x3a, 0x71, 0xd0, - 0xd9, 0xc4, 0x29, 0x7d, 0x9d, 0x38, 0xa5, 0xf7, 0xdb, 0x7f, 0xf4, 0x9e, 0xb2, 0x6d, 0xde, 0xad, - 0x66, 0x61, 0x3f, 0xfa, 0x15, 0x00, 0x00, 0xff, 0xff, 0x35, 0x60, 0x41, 0xd9, 0x8a, 0x06, 0x00, - 0x00, + // 658 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xc1, 0x4f, 0x13, 0x4f, + 0x14, 0xee, 0xb6, 0xd0, 0xdf, 0x8f, 0x29, 0x0a, 0x6c, 0x88, 0xa9, 0x1c, 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+ 0x6c, 0xa3, 0x85, 0x97, 0x58, 0x46, 0x99, 0xf1, 0x5c, 0xb3, 0x3e, 0x45, 0xff, 0x45, 0x69, 0x40, + 0x67, 0x54, 0x36, 0x6f, 0xfe, 0xa2, 0xd3, 0xef, 0x28, 0x4c, 0x8f, 0x19, 0x41, 0x63, 0xf7, 0x68, + 0xec, 0x58, 0xc7, 0x63, 0xc7, 0xfa, 0x3c, 0x76, 0xac, 0xf7, 0x13, 0xa7, 0x70, 0x34, 0x71, 0xac, + 0xe3, 0x89, 0x53, 0xf8, 0x38, 0x71, 0x0a, 0xaf, 0x37, 0x7f, 0x6b, 0x61, 0xf5, 0xdf, 0x45, 0xa7, + 0xac, 0xb7, 0xe9, 0xce, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x79, 0x15, 0x2b, 0xeb, 0x06, + 0x00, 0x00, } func (m *FeeDeducted) Marshal() (dAtA []byte, err error) { @@ -844,6 +895,39 @@ func (m *MessageFailed) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *WasmMessageRouted) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WasmMessageRouted) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WasmMessageRouted) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -980,6 +1064,17 @@ func (m *MessageFailed) Size() (n int) { return n } +func (m *WasmMessageRouted) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Message.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1960,6 +2055,89 @@ func (m *MessageFailed) Unmarshal(dAtA []byte) error { } return nil } +func (m *WasmMessageRouted) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WasmMessageRouted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WasmMessageRouted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/nexus/types/expected_keepers.go b/x/nexus/types/expected_keepers.go index bde4eb9a6..30e8b10b9 100644 --- a/x/nexus/types/expected_keepers.go +++ b/x/nexus/types/expected_keepers.go @@ -40,6 +40,8 @@ type Nexus interface { GetFeeInfo(ctx sdk.Context, chain exported.Chain, asset string) exported.FeeInfo SetRateLimit(ctx sdk.Context, chainName exported.ChainName, limit sdk.Coin, window time.Duration) error RateLimitTransfer(ctx sdk.Context, chain exported.ChainName, asset sdk.Coin, direction exported.TransferDirection) error + GenerateMessageID(ctx sdk.Context) (string, []byte, uint64) + SetNewWasmMessage(ctx sdk.Context, msg exported.GeneralMessage) error } // Snapshotter provides functionality to the snapshot module diff --git a/x/nexus/types/mock/expected_keepers.go b/x/nexus/types/mock/expected_keepers.go index 18c29668a..902881a41 100644 --- a/x/nexus/types/mock/expected_keepers.go +++ b/x/nexus/types/mock/expected_keepers.go @@ -37,6 +37,9 @@ var _ nexustypes.Nexus = &NexusMock{} // ExportGenesisFunc: func(ctx cosmossdktypes.Context) *nexustypes.GenesisState { // panic("mock out the ExportGenesis method") // }, +// GenerateMessageIDFunc: func(ctx cosmossdktypes.Context) (string, []byte, uint64) { +// panic("mock out the GenerateMessageID method") +// }, // GetChainFunc: func(ctx cosmossdktypes.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, bool) { // panic("mock out the GetChain method") // }, @@ -79,6 +82,9 @@ var _ nexustypes.Nexus = &NexusMock{} // RemoveChainMaintainerFunc: func(ctx cosmossdktypes.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, validator cosmossdktypes.ValAddress) error { // panic("mock out the RemoveChainMaintainer method") // }, +// SetNewWasmMessageFunc: func(ctx cosmossdktypes.Context, msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage) error { +// panic("mock out the SetNewWasmMessage method") +// }, // SetParamsFunc: func(ctx cosmossdktypes.Context, p nexustypes.Params) { // panic("mock out the SetParams method") // }, @@ -104,6 +110,9 @@ type NexusMock struct { // ExportGenesisFunc mocks the ExportGenesis method. ExportGenesisFunc func(ctx cosmossdktypes.Context) *nexustypes.GenesisState + // GenerateMessageIDFunc mocks the GenerateMessageID method. + GenerateMessageIDFunc func(ctx cosmossdktypes.Context) (string, []byte, uint64) + // GetChainFunc mocks the GetChain method. GetChainFunc func(ctx cosmossdktypes.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, bool) @@ -146,6 +155,9 @@ type NexusMock struct { // RemoveChainMaintainerFunc mocks the RemoveChainMaintainer method. RemoveChainMaintainerFunc func(ctx cosmossdktypes.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, validator cosmossdktypes.ValAddress) error + // SetNewWasmMessageFunc mocks the SetNewWasmMessage method. + SetNewWasmMessageFunc func(ctx cosmossdktypes.Context, msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage) error + // SetParamsFunc mocks the SetParams method. SetParamsFunc func(ctx cosmossdktypes.Context, p nexustypes.Params) @@ -182,6 +194,11 @@ type NexusMock struct { // Ctx is the ctx argument value. Ctx cosmossdktypes.Context } + // GenerateMessageID holds details about calls to the GenerateMessageID method. + GenerateMessageID []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + } // GetChain holds details about calls to the GetChain method. GetChain []struct { // Ctx is the ctx argument value. @@ -288,6 +305,13 @@ type NexusMock struct { // Validator is the validator argument value. Validator cosmossdktypes.ValAddress } + // SetNewWasmMessage holds details about calls to the SetNewWasmMessage method. + SetNewWasmMessage []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // Msg is the msg argument value. + Msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage + } // SetParams holds details about calls to the SetParams method. SetParams []struct { // Ctx is the ctx argument value. @@ -311,6 +335,7 @@ type NexusMock struct { lockAddChainMaintainer sync.RWMutex lockDeactivateChain sync.RWMutex lockExportGenesis sync.RWMutex + lockGenerateMessageID sync.RWMutex lockGetChain sync.RWMutex lockGetChainMaintainerStates sync.RWMutex lockGetChainMaintainers sync.RWMutex @@ -325,6 +350,7 @@ type NexusMock struct { lockRateLimitTransfer sync.RWMutex lockRegisterFee sync.RWMutex lockRemoveChainMaintainer sync.RWMutex + lockSetNewWasmMessage sync.RWMutex lockSetParams sync.RWMutex lockSetRateLimit sync.RWMutex } @@ -473,6 +499,38 @@ func (mock *NexusMock) ExportGenesisCalls() []struct { return calls } +// GenerateMessageID calls GenerateMessageIDFunc. +func (mock *NexusMock) GenerateMessageID(ctx cosmossdktypes.Context) (string, []byte, uint64) { + if mock.GenerateMessageIDFunc == nil { + panic("NexusMock.GenerateMessageIDFunc: method is nil but Nexus.GenerateMessageID was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + }{ + Ctx: ctx, + } + mock.lockGenerateMessageID.Lock() + mock.calls.GenerateMessageID = append(mock.calls.GenerateMessageID, callInfo) + mock.lockGenerateMessageID.Unlock() + return mock.GenerateMessageIDFunc(ctx) +} + +// GenerateMessageIDCalls gets all the calls that were made to GenerateMessageID. +// Check the length with: +// +// len(mockedNexus.GenerateMessageIDCalls()) +func (mock *NexusMock) GenerateMessageIDCalls() []struct { + Ctx cosmossdktypes.Context +} { + var calls []struct { + Ctx cosmossdktypes.Context + } + mock.lockGenerateMessageID.RLock() + calls = mock.calls.GenerateMessageID + mock.lockGenerateMessageID.RUnlock() + return calls +} + // GetChain calls GetChainFunc. func (mock *NexusMock) GetChain(ctx cosmossdktypes.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, bool) { if mock.GetChainFunc == nil { @@ -993,6 +1051,42 @@ func (mock *NexusMock) RemoveChainMaintainerCalls() []struct { return calls } +// SetNewWasmMessage calls SetNewWasmMessageFunc. +func (mock *NexusMock) SetNewWasmMessage(ctx cosmossdktypes.Context, msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage) error { + if mock.SetNewWasmMessageFunc == nil { + panic("NexusMock.SetNewWasmMessageFunc: method is nil but Nexus.SetNewWasmMessage was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + Msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage + }{ + Ctx: ctx, + Msg: msg, + } + mock.lockSetNewWasmMessage.Lock() + mock.calls.SetNewWasmMessage = append(mock.calls.SetNewWasmMessage, callInfo) + mock.lockSetNewWasmMessage.Unlock() + return mock.SetNewWasmMessageFunc(ctx, msg) +} + +// SetNewWasmMessageCalls gets all the calls that were made to SetNewWasmMessage. +// Check the length with: +// +// len(mockedNexus.SetNewWasmMessageCalls()) +func (mock *NexusMock) SetNewWasmMessageCalls() []struct { + Ctx cosmossdktypes.Context + Msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage +} { + var calls []struct { + Ctx cosmossdktypes.Context + Msg github_com_axelarnetwork_axelar_core_x_nexus_exported.GeneralMessage + } + mock.lockSetNewWasmMessage.RLock() + calls = mock.calls.SetNewWasmMessage + mock.lockSetNewWasmMessage.RUnlock() + return calls +} + // SetParams calls SetParamsFunc. func (mock *NexusMock) SetParams(ctx cosmossdktypes.Context, p nexustypes.Params) { if mock.SetParamsFunc == nil {