From 5db45361b0d7b2b2af3fb4a81db9e5d73b22dfbd Mon Sep 17 00:00:00 2001 From: haiyizxx Date: Tue, 1 Oct 2024 03:33:29 +0800 Subject: [PATCH 1/2] feat(nexus): gmp events metadata (#2189) --- docs/proto/proto-docs.md | 8 + proto/axelar/axelarnet/v1beta1/events.proto | 6 + proto/axelar/nexus/v1beta1/events.proto | 30 +- x/axelarnet/keeper/msg_server.go | 10 +- x/axelarnet/message_handler.go | 18 +- x/axelarnet/types/events.pb.go | 219 ++++++++--- x/nexus/keeper/general_message.go | 18 +- x/nexus/types/events.pb.go | 400 +++++++++++++++++--- 8 files changed, 588 insertions(+), 121 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index c16a558aa8..0f400a786f 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -887,6 +887,8 @@ Msg defines the nexus Msg service. | `fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | | `refund_recipient` | [string](#string) | | | | `asset` | [string](#string) | | registered asset name in nexus | +| `source_chain` | [string](#string) | | | +| `destination_chain` | [string](#string) | | | @@ -6166,6 +6168,8 @@ Query defines the gRPC querier service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `id` | [string](#string) | | | +| `source_chain` | [string](#string) | | | +| `destination_chain` | [string](#string) | | | @@ -6181,6 +6185,8 @@ Query defines the gRPC querier service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `id` | [string](#string) | | | +| `source_chain` | [string](#string) | | | +| `destination_chain` | [string](#string) | | | @@ -6196,6 +6202,8 @@ Query defines the gRPC querier service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `id` | [string](#string) | | | +| `source_chain` | [string](#string) | | | +| `destination_chain` | [string](#string) | | | diff --git a/proto/axelar/axelarnet/v1beta1/events.proto b/proto/axelar/axelarnet/v1beta1/events.proto index a5e9e0a67d..8c25374d8a 100644 --- a/proto/axelar/axelarnet/v1beta1/events.proto +++ b/proto/axelar/axelarnet/v1beta1/events.proto @@ -82,6 +82,12 @@ message FeePaid { cosmos.base.v1beta1.Coin fee = 3 [ (gogoproto.nullable) = false ]; string refund_recipient = 4; string asset = 5; // registered asset name in nexus + string source_chain = 6 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; + string destination_chain = 7 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; } message ContractCallSubmitted { diff --git a/proto/axelar/nexus/v1beta1/events.proto b/proto/axelar/nexus/v1beta1/events.proto index 7ec5ec8295..4e443d5c42 100644 --- a/proto/axelar/nexus/v1beta1/events.proto +++ b/proto/axelar/nexus/v1beta1/events.proto @@ -55,11 +55,35 @@ message MessageReceived { [ (gogoproto.nullable) = false ]; } -message MessageProcessing { string id = 1 [ (gogoproto.customname) = "ID" ]; } +message MessageProcessing { + string id = 1 [ (gogoproto.customname) = "ID" ]; + string source_chain = 2 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; + string destination_chain = 3 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; +} -message MessageExecuted { string id = 1 [ (gogoproto.customname) = "ID" ]; } +message MessageExecuted { + string id = 1 [ (gogoproto.customname) = "ID" ]; + string source_chain = 2 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; + string destination_chain = 3 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; +} -message MessageFailed { string id = 1 [ (gogoproto.customname) = "ID" ]; } +message MessageFailed { + string id = 1 [ (gogoproto.customname) = "ID" ]; + string source_chain = 2 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; + string destination_chain = 3 + [ (gogoproto.casttype) = + "github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" ]; +} message WasmMessageRouted { exported.v1beta1.WasmMessage message = 1 [ (gogoproto.nullable) = false ]; diff --git a/x/axelarnet/keeper/msg_server.go b/x/axelarnet/keeper/msg_server.go index 01a0f8438e..efaadbc488 100644 --- a/x/axelarnet/keeper/msg_server.go +++ b/x/axelarnet/keeper/msg_server.go @@ -90,10 +90,12 @@ func (s msgServer) CallContract(c context.Context, req *types.CallContractReques } feePaidEvent := types.FeePaid{ - MessageID: msgID, - Recipient: req.Fee.Recipient, - Fee: req.Fee.Amount, - Asset: lockableAsset.GetAsset().Denom, + MessageID: msgID, + Recipient: req.Fee.Recipient, + Fee: req.Fee.Amount, + Asset: lockableAsset.GetAsset().Denom, + SourceChain: msg.GetSourceChain(), + DestinationChain: msg.GetDestinationChain(), } if req.Fee.RefundRecipient != nil { feePaidEvent.RefundRecipient = req.Fee.RefundRecipient.String() diff --git a/x/axelarnet/message_handler.go b/x/axelarnet/message_handler.go index 84bc451373..ab2ef617a9 100644 --- a/x/axelarnet/message_handler.go +++ b/x/axelarnet/message_handler.go @@ -247,7 +247,7 @@ func handleMessage(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK type id, txID, nonce := n.GenerateMessageID(ctx) // ignore token for call contract - _, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id) + _, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, nexus.ChainName(msg.DestinationChain)) if err != nil { return err } @@ -287,7 +287,7 @@ func handleMessage(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK type func handleMessageWithToken(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IBCKeeper, sourceAddress nexus.CrossChainAddress, msg Message, token nexus.LockableAsset) error { id, txID, nonce := n.GenerateMessageID(ctx) - token, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id) + token, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, nexus.ChainName(msg.DestinationChain)) if err != nil { return err } @@ -393,7 +393,7 @@ func extractTokenFromPacketData(ctx sdk.Context, ibcK keeper.IBCKeeper, n types. } // deductFee pays the fee and returns the updated transfer amount with the fee deducted -func deductFee(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IBCKeeper, fee *Fee, token nexus.LockableAsset, msgID string) (nexus.LockableAsset, error) { +func deductFee(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IBCKeeper, fee *Fee, token nexus.LockableAsset, msgID string, sourceChain nexus.ChainName, destinationChain nexus.ChainName) (nexus.LockableAsset, error) { if fee == nil { return token, nil } @@ -401,12 +401,16 @@ func deductFee(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IB feeAmount := funcs.MustOk(sdk.NewIntFromString(fee.Amount)) feeCoin := sdk.NewCoin(token.GetCoin(ctx).Denom, feeAmount) recipient := funcs.Must(sdk.AccAddressFromBech32(fee.Recipient)) + // destination chain is from user input, normalize it to lowercase + destinationChain = nexus.ChainName(strings.ToLower(destinationChain.String())) feePaidEvent := types.FeePaid{ - MessageID: msgID, - Recipient: recipient, - Fee: feeCoin, - Asset: token.GetAsset().Denom, + MessageID: msgID, + Recipient: recipient, + Fee: feeCoin, + Asset: token.GetAsset().Denom, + SourceChain: sourceChain, + DestinationChain: destinationChain, } if fee.RefundRecipient != nil { feePaidEvent.RefundRecipient = *fee.RefundRecipient diff --git a/x/axelarnet/types/events.pb.go b/x/axelarnet/types/events.pb.go index 6a705ce1db..6c249252d6 100644 --- a/x/axelarnet/types/events.pb.go +++ b/x/axelarnet/types/events.pb.go @@ -494,11 +494,13 @@ func (*FeeCollected) XXX_MessageName() string { } type FeePaid struct { - MessageID string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty"` - Fee types.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee"` - RefundRecipient string `protobuf:"bytes,4,opt,name=refund_recipient,json=refundRecipient,proto3" json:"refund_recipient,omitempty"` - Asset string `protobuf:"bytes,5,opt,name=asset,proto3" json:"asset,omitempty"` + MessageID string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty"` + Fee types.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee"` + RefundRecipient string `protobuf:"bytes,4,opt,name=refund_recipient,json=refundRecipient,proto3" json:"refund_recipient,omitempty"` + Asset string `protobuf:"bytes,5,opt,name=asset,proto3" json:"asset,omitempty"` + SourceChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,6,opt,name=source_chain,json=sourceChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"source_chain,omitempty"` + DestinationChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,7,opt,name=destination_chain,json=destinationChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"destination_chain,omitempty"` } func (m *FeePaid) Reset() { *m = FeePaid{} } @@ -569,6 +571,20 @@ func (m *FeePaid) GetAsset() string { return "" } +func (m *FeePaid) GetSourceChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.SourceChain + } + return "" +} + +func (m *FeePaid) GetDestinationChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.DestinationChain + } + return "" +} + func (*FeePaid) XXX_MessageName() string { return "axelar.axelarnet.v1beta1.FeePaid" } @@ -878,59 +894,60 @@ func init() { } var fileDescriptor_7e862d506c60b5a3 = []byte{ - // 830 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xae, 0x9d, 0x6c, 0xba, 0x79, 0x0d, 0x6a, 0x77, 0x28, 0x10, 0x2a, 0xe4, 0x94, 0x20, 0xa4, - 0xae, 0x44, 0x6d, 0x15, 0x04, 0x57, 0x68, 0x5c, 0x55, 0x04, 0x09, 0x58, 0x79, 0x2b, 0x21, 0xed, - 0x25, 0x9a, 0x8c, 0x5f, 0x9b, 0x51, 0x9d, 0x99, 0x30, 0x33, 0x59, 0xba, 0xff, 0x02, 0xf1, 0x07, - 0xf8, 0x3b, 0x3d, 0xee, 0x05, 0x69, 0xc5, 0xc1, 0x40, 0x7a, 0xe7, 0x07, 0x54, 0x1c, 0x90, 0x3d, - 0x93, 0xc4, 0xbb, 0x12, 0xa8, 0x5d, 0x6d, 0x11, 0xa2, 0x9c, 0xec, 0x79, 0xf3, 0xe9, 0xcd, 0xfb, - 0xbe, 0xef, 0xcd, 0xb3, 0x0c, 0xef, 0xd3, 0x33, 0xcc, 0xa8, 0x8a, 0xec, 0x43, 0xa0, 0x89, 0x1e, - 0xef, 0x0d, 0xd1, 0xd0, 0xbd, 0x08, 0x1f, 0xa3, 0x30, 0x3a, 0x9c, 0x28, 0x69, 0x24, 0x69, 0xdb, - 0xfd, 0x70, 0x01, 0x0b, 0x1d, 0x6c, 0x6b, 0xf3, 0x44, 0x9e, 0xc8, 0x12, 0x14, 0x15, 0x6f, 0x16, - 0xbf, 0x15, 0x30, 0xa9, 0xc7, 0x52, 0x47, 0x43, 0xaa, 0x71, 0x91, 0x91, 0x49, 0x2e, 0xec, 0x7e, - 0xf7, 0x27, 0x1f, 0xd6, 0xfb, 0xbd, 0xf8, 0x48, 0x51, 0xa1, 0x8f, 0x51, 0x3d, 0x44, 0x61, 0xc8, - 0x23, 0xf0, 0x79, 0xda, 0xf6, 0xb6, 0xbd, 0x9d, 0x7a, 0xef, 0x8b, 0x59, 0xde, 0xf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0x60, - 0xf1, 0x0d, 0x48, 0x66, 0x79, 0x07, 0x96, 0x73, 0xfc, 0x95, 0x7c, 0x0b, 0x60, 0x7e, 0xcc, 0xad, - 0xec, 0x89, 0x08, 0x5e, 0xaf, 0x9e, 0xf8, 0x7c, 0x5b, 0x90, 0xca, 0xd6, 0xbc, 0x33, 0x16, 0xe6, - 0x36, 0xae, 0x63, 0x6e, 0xef, 0xe8, 0x7c, 0x16, 0x78, 0x4f, 0x67, 0x81, 0xf7, 0xeb, 0x2c, 0xf0, - 0xbe, 0xbf, 0x08, 0x56, 0xce, 0x2f, 0x02, 0xef, 0xe9, 0x45, 0xb0, 0xf2, 0xec, 0x22, 0x58, 0x79, - 0xf4, 0xc9, 0x15, 0x89, 0x2d, 0x7f, 0x89, 0xca, 0x0f, 0xc8, 0xb0, 0x51, 0xfe, 0xba, 0x7c, 0xf4, - 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x49, 0xfb, 0xe1, 0xd9, 0x33, 0x0d, 0x00, 0x00, + // 837 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xaf, 0xed, 0x6c, 0xb2, 0x79, 0x0d, 0xea, 0xae, 0x29, 0x10, 0x2a, 0xe4, 0x94, 0x20, 0xa4, + 0x22, 0x51, 0x5b, 0x05, 0xc1, 0x15, 0x1a, 0x57, 0x15, 0x46, 0x02, 0x56, 0xde, 0x4a, 0x48, 0x7b, + 0x89, 0x26, 0xf6, 0x6b, 0x33, 0xaa, 0x33, 0x13, 0x66, 0x26, 0x4b, 0xf7, 0x5b, 0x20, 0xbe, 0x00, + 0x5f, 0xa7, 0xc7, 0xbd, 0x80, 0x56, 0x1c, 0x0c, 0xa4, 0x77, 0x3e, 0x40, 0x4f, 0xc8, 0x9e, 0x71, + 0xe2, 0x5d, 0x04, 0x6a, 0x57, 0x9b, 0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 0x7f, 0xf6, 0xca, + 0xd1, 0x38, 0x6a, 0x96, 0x3f, 0x65, 0x1f, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x9c, 0x09, + 0x02, 0x0d, 0x0e, 0x00, 0x00, } func (m *IBCTransferSent) Marshal() (dAtA []byte, err error) { @@ -1281,6 +1298,20 @@ func (m *FeePaid) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x3a + } + if len(m.SourceChain) > 0 { + i -= len(m.SourceChain) + copy(dAtA[i:], m.SourceChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SourceChain))) + i-- + dAtA[i] = 0x32 + } if len(m.Asset) > 0 { i -= len(m.Asset) copy(dAtA[i:], m.Asset) @@ -1726,6 +1757,14 @@ func (m *FeePaid) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.SourceChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -3118,6 +3157,70 @@ func (m *FeePaid) Unmarshal(dAtA []byte) error { } m.Asset = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/nexus/keeper/general_message.go b/x/nexus/keeper/general_message.go index 494e1a236a..d61548dee6 100644 --- a/x/nexus/keeper/general_message.go +++ b/x/nexus/keeper/general_message.go @@ -51,7 +51,11 @@ func (k Keeper) SetMessageExecuted(ctx sdk.Context, id string) error { m.Status = exported.Executed - funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageExecuted{ID: m.ID})) + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageExecuted{ + ID: m.ID, + SourceChain: m.GetSourceChain(), + DestinationChain: m.GetDestinationChain(), + })) return k.setMessage(ctx, m) } @@ -71,7 +75,11 @@ func (k Keeper) SetMessageFailed(ctx sdk.Context, id string) error { m.Status = exported.Failed - funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageFailed{ID: m.ID})) + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageFailed{ + ID: m.ID, + SourceChain: m.GetSourceChain(), + DestinationChain: m.GetDestinationChain(), + })) return k.setMessage(ctx, m) } @@ -180,7 +188,11 @@ func (k Keeper) setMessageProcessing(ctx sdk.Context, id string) error { } funcs.MustNoErr(k.setProcessingMessageID(ctx, msg)) - funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageProcessing{ID: msg.ID})) + funcs.MustNoErr(ctx.EventManager().EmitTypedEvent(&types.MessageProcessing{ + ID: msg.ID, + SourceChain: msg.GetSourceChain(), + DestinationChain: msg.GetDestinationChain(), + })) return nil } diff --git a/x/nexus/types/events.pb.go b/x/nexus/types/events.pb.go index 02bf10c660..e672871332 100644 --- a/x/nexus/types/events.pb.go +++ b/x/nexus/types/events.pb.go @@ -327,7 +327,9 @@ func (*MessageReceived) XXX_MessageName() string { } type MessageProcessing struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SourceChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,2,opt,name=source_chain,json=sourceChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"source_chain,omitempty"` + DestinationChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,3,opt,name=destination_chain,json=destinationChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"destination_chain,omitempty"` } func (m *MessageProcessing) Reset() { *m = MessageProcessing{} } @@ -370,12 +372,28 @@ func (m *MessageProcessing) GetID() string { return "" } +func (m *MessageProcessing) GetSourceChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.SourceChain + } + return "" +} + +func (m *MessageProcessing) GetDestinationChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.DestinationChain + } + return "" +} + func (*MessageProcessing) XXX_MessageName() string { return "axelar.nexus.v1beta1.MessageProcessing" } type MessageExecuted struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SourceChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,2,opt,name=source_chain,json=sourceChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"source_chain,omitempty"` + DestinationChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,3,opt,name=destination_chain,json=destinationChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"destination_chain,omitempty"` } func (m *MessageExecuted) Reset() { *m = MessageExecuted{} } @@ -418,12 +436,28 @@ func (m *MessageExecuted) GetID() string { return "" } +func (m *MessageExecuted) GetSourceChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.SourceChain + } + return "" +} + +func (m *MessageExecuted) GetDestinationChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.DestinationChain + } + return "" +} + func (*MessageExecuted) XXX_MessageName() string { return "axelar.nexus.v1beta1.MessageExecuted" } type MessageFailed struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SourceChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,2,opt,name=source_chain,json=sourceChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"source_chain,omitempty"` + DestinationChain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName `protobuf:"bytes,3,opt,name=destination_chain,json=destinationChain,proto3,casttype=github.com/axelarnetwork/axelar-core/x/nexus/exported.ChainName" json:"destination_chain,omitempty"` } func (m *MessageFailed) Reset() { *m = MessageFailed{} } @@ -466,6 +500,20 @@ func (m *MessageFailed) GetID() string { return "" } +func (m *MessageFailed) GetSourceChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.SourceChain + } + return "" +} + +func (m *MessageFailed) GetDestinationChain() github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName { + if m != nil { + return m.DestinationChain + } + return "" +} + func (*MessageFailed) XXX_MessageName() string { return "axelar.nexus.v1beta1.MessageFailed" } @@ -531,49 +579,51 @@ func init() { func init() { proto.RegisterFile("axelar/nexus/v1beta1/events.proto", fileDescriptor_4433ea5171b09eb9) } var fileDescriptor_4433ea5171b09eb9 = []byte{ - // 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, 0xb6, 0xd0, 0x8b, 0x20, - 0x71, 0x57, 0x30, 0xc6, 0x83, 0x07, 0xb5, 0x54, 0x62, 0x8d, 0x12, 0xb2, 0xc1, 0x18, 0xbd, 0x34, - 0xd3, 0x9d, 0xd7, 0xed, 0xc4, 0xee, 0x4c, 0x33, 0x33, 0x0b, 0xe5, 0x4f, 0xf0, 0x60, 0xe2, 0xd1, - 0x3f, 0x89, 0x23, 0x47, 0x4f, 0x55, 0xdb, 0xff, 0xc0, 0x23, 0x27, 0xb3, 0xb3, 0xb3, 0x8b, 0x98, - 0xa0, 0x48, 0x4c, 0xbc, 0x78, 0x9b, 0xbe, 0x7e, 0xef, 0x7b, 0xdf, 0xfb, 0xde, 0xeb, 0x2b, 0x5a, - 0xc1, 0x43, 0xe8, 0x63, 0xe1, 0x31, 0x18, 0xc6, 0xd2, 0xdb, 0xdf, 0xe8, 0x80, 0xc2, 0x1b, 0x1e, - 0xec, 0x03, 0x53, 0xd2, 0x1d, 0x08, 0xae, 0xb8, 0xbd, 0x98, 0x42, 0x5c, 0x0d, 0x71, 0x0d, 0x64, - 0xc9, 0x09, 0x39, 0x0f, 0xfb, 0xe0, 0x69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, 0x9e, 0xbd, 0x83, 0xca, 0x12, 0x18, 0x01, 0x61, 0xb4, 0xdc, 0x76, 0xcf, - 0x9c, 0xbd, 0xbc, 0xf7, 0xbc, 0x1b, 0xc1, 0xa5, 0xd4, 0x46, 0x98, 0x01, 0x67, 0x53, 0x4b, 0x59, - 0xec, 0x3d, 0x34, 0x93, 0xaf, 0x80, 0x99, 0xf8, 0x65, 0x29, 0x4f, 0x89, 0xea, 0xeb, 0x68, 0xc1, - 0xf4, 0xbc, 0x2b, 0x78, 0x00, 0x52, 0x52, 0x16, 0x9e, 0xd7, 0x75, 0x7d, 0x2d, 0x37, 0xe8, 0xf1, - 0x10, 0x82, 0x58, 0x9d, 0x6f, 0x50, 0xfd, 0x06, 0xba, 0x62, 0xa0, 0xdb, 0x98, 0xf6, 0x7f, 0x02, - 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, + // 702 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x31, 0x6f, 0x13, 0x4b, + 0x10, 0xf6, 0xd9, 0x89, 0xdf, 0xcb, 0x3a, 0xef, 0x25, 0x3e, 0x45, 0xc8, 0xa4, 0x38, 0x27, 0xae, + 0x02, 0x88, 0x3b, 0x12, 0x84, 0x28, 0x28, 0x00, 0xc7, 0x44, 0x18, 0x41, 0x14, 0x9d, 0x82, 0x10, + 0x34, 0xd6, 0xfa, 0x76, 0x6c, 0xaf, 0xb0, 0x77, 0x4f, 0xbb, 0x7b, 0x89, 0x53, 0x22, 0x44, 0x41, + 0x81, 0x44, 0xc9, 0x4f, 0x4a, 0x99, 0x92, 0xca, 0x80, 0xfd, 0x0f, 0x28, 0x53, 0xa1, 0xdb, 0xdb, + 0xbb, 0x24, 0x48, 0x40, 0x88, 0x22, 0x21, 0x01, 0xdd, 0x65, 0x32, 0xf3, 0x7d, 0x33, 0xdf, 0xb7, + 0x33, 0x32, 0x5a, 0xc6, 0x43, 0xe8, 0x63, 0xe1, 0x31, 0x18, 0x46, 0xd2, 0xdb, 0x59, 0x6d, 0x83, + 0xc2, 0xab, 0x1e, 0xec, 0x00, 0x53, 0xd2, 0x0d, 0x05, 0x57, 0xdc, 0x5e, 0x48, 0x52, 0x5c, 0x9d, + 0xe2, 0x9a, 0x94, 0x45, 0xa7, 0xcb, 0x79, 0xb7, 0x0f, 0x9e, 0xce, 0x69, 0x47, 0x1d, 0x8f, 0x44, + 0x02, 0x2b, 0xca, 0x59, 0x52, 0xb5, 0xb8, 0xd0, 0xe5, 0x5d, 0xae, 0x3f, 0xbd, 0xf8, 0xcb, 0x44, + 0x9d, 0x80, 0xcb, 0x01, 0x97, 0x5e, 0x1b, 0x4b, 0xc8, 0xd8, 0x02, 0x4e, 0xd3, 0xaa, 0x4b, 0x27, + 0xda, 0x81, 0x61, 0xc8, 0x85, 0x02, 0x92, 0x65, 0xaa, 0xbd, 0x10, 0x4c, 0x5b, 0xb5, 0xd7, 0x05, + 0x54, 0xda, 0x00, 0x68, 0x00, 0x89, 0x02, 0x05, 0xc4, 0x96, 0xa8, 0xa4, 0x04, 0x66, 0xb2, 0x03, + 0xa2,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, 0xa2, + 0x32, 0x01, 0xa9, 0x28, 0xd3, 0x5e, 0x19, 0xb2, 0xc2, 0xf9, 0x91, 0xcd, 0x1f, 0x43, 0xd7, 0xd1, + 0xda, 0xcb, 0x7c, 0x66, 0xfe, 0xbd, 0x21, 0x04, 0x91, 0xfa, 0x8e, 0xf9, 0xbf, 0xaf, 0x0a, 0x2f, + 0xf2, 0xe8, 0x3f, 0xa3, 0xc2, 0x06, 0xa6, 0xfd, 0x3f, 0x52, 0x83, 0x16, 0x2a, 0x3f, 0xc1, 0x72, + 0x90, 0x5e, 0x02, 0xae, 0x9f, 0xc2, 0x03, 0xf4, 0xcf, 0x20, 0x09, 0x68, 0x2d, 0x4a, 0x6b, 0x97, + 0x7f, 0xb0, 0x7a, 0xc7, 0x20, 0xcc, 0xd2, 0xa5, 0x00, 0xf5, 0xad, 0xfd, 0xb1, 0x63, 0x1d, 0x8c, + 0x1d, 0xeb, 0xe3, 0xd8, 0xb1, 0xde, 0x4e, 0x9c, 0xdc, 0xfe, 0xc4, 0xb1, 0x0e, 0x26, 0x4e, 0xee, + 0xfd, 0xc4, 0xc9, 0x3d, 0x5b, 0xfb, 0xa9, 0x89, 0xf4, 0xef, 0x97, 0x76, 0x51, 0x9f, 0xb7, 0xeb, + 0x5f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x92, 0xd8, 0x9b, 0x95, 0x7c, 0x09, 0x00, 0x00, } func (m *FeeDeducted) Marshal() (dAtA []byte, err error) { @@ -825,6 +875,20 @@ func (m *MessageProcessing) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.SourceChain) > 0 { + i -= len(m.SourceChain) + copy(dAtA[i:], m.SourceChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SourceChain))) + i-- + dAtA[i] = 0x12 + } if len(m.ID) > 0 { i -= len(m.ID) copy(dAtA[i:], m.ID) @@ -855,6 +919,20 @@ func (m *MessageExecuted) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.SourceChain) > 0 { + i -= len(m.SourceChain) + copy(dAtA[i:], m.SourceChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SourceChain))) + i-- + dAtA[i] = 0x12 + } if len(m.ID) > 0 { i -= len(m.ID) copy(dAtA[i:], m.ID) @@ -885,6 +963,20 @@ func (m *MessageFailed) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DestinationChain) > 0 { + i -= len(m.DestinationChain) + copy(dAtA[i:], m.DestinationChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.DestinationChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.SourceChain) > 0 { + i -= len(m.SourceChain) + copy(dAtA[i:], m.SourceChain) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SourceChain))) + i-- + dAtA[i] = 0x12 + } if len(m.ID) > 0 { i -= len(m.ID) copy(dAtA[i:], m.ID) @@ -1035,6 +1127,14 @@ func (m *MessageProcessing) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.SourceChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -1048,6 +1148,14 @@ func (m *MessageExecuted) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.SourceChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -1061,6 +1169,14 @@ func (m *MessageFailed) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + l = len(m.SourceChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.DestinationChain) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -1870,6 +1986,70 @@ func (m *MessageProcessing) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -1952,6 +2132,70 @@ func (m *MessageExecuted) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -2034,6 +2278,70 @@ func (m *MessageFailed) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SourceChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DestinationChain = github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) From 798132ad4a43f109472aecbdb62680b55d157f78 Mon Sep 17 00:00:00 2001 From: Haiyi Zhong Date: Fri, 18 Oct 2024 17:31:19 +0800 Subject: [PATCH 2/2] update --- x/axelarnet/message_handler.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/x/axelarnet/message_handler.go b/x/axelarnet/message_handler.go index ab2ef617a9..dbe85e7ad3 100644 --- a/x/axelarnet/message_handler.go +++ b/x/axelarnet/message_handler.go @@ -246,12 +246,6 @@ func validateMessage(ctx sdk.Context, ibcK keeper.IBCKeeper, n types.Nexus, ibcP func handleMessage(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IBCKeeper, sourceAddress nexus.CrossChainAddress, msg Message, token nexus.LockableAsset) error { id, txID, nonce := n.GenerateMessageID(ctx) - // ignore token for call contract - _, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, nexus.ChainName(msg.DestinationChain)) - if err != nil { - return err - } - destChain, ok := n.GetChain(ctx, nexus.ChainName(msg.DestinationChain)) if !ok { // try forwarding it to wasm router if destination chain is not registered @@ -260,6 +254,12 @@ func handleMessage(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK type destChain = nexus.Chain{Name: destChainName, SupportsForeignAssets: false, KeyType: tss.None, Module: wasm.ModuleName} } + // ignore token for call contract + _, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, destChain.GetName()) + if err != nil { + return err + } + recipient := nexus.CrossChainAddress{Chain: destChain, Address: msg.DestinationAddress} m := nexus.NewGeneralMessage( id, @@ -286,8 +286,9 @@ func handleMessage(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK type func handleMessageWithToken(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IBCKeeper, sourceAddress nexus.CrossChainAddress, msg Message, token nexus.LockableAsset) error { id, txID, nonce := n.GenerateMessageID(ctx) + destChain := funcs.MustOk(n.GetChain(ctx, nexus.ChainName(msg.DestinationChain))) - token, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, nexus.ChainName(msg.DestinationChain)) + token, err := deductFee(ctx, n, b, ibcK, msg.Fee, token, id, sourceAddress.Chain.Name, destChain.GetName()) if err != nil { return err } @@ -296,7 +297,6 @@ func handleMessageWithToken(ctx sdk.Context, n types.Nexus, b types.BankKeeper, return err } - destChain := funcs.MustOk(n.GetChain(ctx, nexus.ChainName(msg.DestinationChain))) recipient := nexus.CrossChainAddress{Chain: destChain, Address: msg.DestinationAddress} coin := token.GetAsset() m := nexus.NewGeneralMessage( @@ -401,8 +401,6 @@ func deductFee(ctx sdk.Context, n types.Nexus, b types.BankKeeper, ibcK types.IB feeAmount := funcs.MustOk(sdk.NewIntFromString(fee.Amount)) feeCoin := sdk.NewCoin(token.GetCoin(ctx).Denom, feeAmount) recipient := funcs.Must(sdk.AccAddressFromBech32(fee.Recipient)) - // destination chain is from user input, normalize it to lowercase - destinationChain = nexus.ChainName(strings.ToLower(destinationChain.String())) feePaidEvent := types.FeePaid{ MessageID: msgID,