From 557e6d821217063863fcc6aec112c88a88325d2c Mon Sep 17 00:00:00 2001 From: Sean King Date: Wed, 4 May 2022 13:28:15 +0200 Subject: [PATCH] refactor: renaming Result in IncentivizedAcknowledgement to AppAcknowledgement --- docs/ibc/proto-docs.md | 2 +- modules/apps/29-fee/ibc_middleware.go | 4 +- modules/apps/29-fee/ibc_middleware_test.go | 10 ++-- modules/apps/29-fee/types/ack.go | 2 +- modules/apps/29-fee/types/ack.pb.go | 67 +++++++++++----------- proto/ibc/applications/fee/v1/ack.proto | 2 +- 6 files changed, 44 insertions(+), 43 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index cf411ade14c..6b0a13d9efb 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -355,7 +355,7 @@ IncentivizedAcknowledgement is the acknowledgement format to be used by applicat | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `result` | [bytes](#bytes) | | the underlying app acknowledgement result bytes | +| `app_acknowledgement` | [bytes](#bytes) | | the underlying app acknowledgement result bytes | | `forward_relayer_address` | [string](#string) | | the relayer address which submits the recv packet message | | `underlying_app_success` | [bool](#bool) | | success flag of the base application callback | diff --git a/modules/apps/29-fee/ibc_middleware.go b/modules/apps/29-fee/ibc_middleware.go index 236c7456b0d..96bb8be4030 100644 --- a/modules/apps/29-fee/ibc_middleware.go +++ b/modules/apps/29-fee/ibc_middleware.go @@ -226,7 +226,7 @@ func (im IBCMiddleware) OnAcknowledgementPacket( // for fee enabled channels // // Please see ADR 004 for more information. - return im.app.OnAcknowledgementPacket(ctx, packet, ack.Result, relayer) + return im.app.OnAcknowledgementPacket(ctx, packet, ack.AppAcknowledgement, relayer) } packetID := channeltypes.NewPacketId(packet.SourcePort, packet.SourceChannel, packet.Sequence) @@ -239,7 +239,7 @@ func (im IBCMiddleware) OnAcknowledgementPacket( } // call underlying callback - return im.app.OnAcknowledgementPacket(ctx, packet, ack.Result, relayer) + return im.app.OnAcknowledgementPacket(ctx, packet, ack.AppAcknowledgement, relayer) } // OnTimeoutPacket implements the IBCMiddleware interface diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index d46c414270e..8c76720ad3e 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -526,7 +526,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { forwardAddr, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) expectedAck := types.IncentivizedAcknowledgement{ - Result: ibcmock.MockAcknowledgement.Acknowledgement(), + AppAcknowledgement: ibcmock.MockAcknowledgement.Acknowledgement(), ForwardRelayerAddress: forwardAddr, UnderlyingAppSuccess: true, } @@ -545,7 +545,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { case !tc.forwardRelayer: expectedAck := types.IncentivizedAcknowledgement{ - Result: ibcmock.MockAcknowledgement.Acknowledgement(), + AppAcknowledgement: ibcmock.MockAcknowledgement.Acknowledgement(), ForwardRelayerAddress: "", UnderlyingAppSuccess: true, } @@ -584,7 +584,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeesInEscrow(suite.chainA.GetContext(), packetID) ack = types.IncentivizedAcknowledgement{ - Result: ibcmock.MockAcknowledgement.Acknowledgement(), + AppAcknowledgement: ibcmock.MockAcknowledgement.Acknowledgement(), ForwardRelayerAddress: suite.chainA.SenderAccount.GetAddress().String(), }.Acknowledgement() @@ -626,7 +626,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() ack = types.IncentivizedAcknowledgement{ - Result: ibcmock.MockAcknowledgement.Acknowledgement(), + AppAcknowledgement: ibcmock.MockAcknowledgement.Acknowledgement(), ForwardRelayerAddress: blockedAddr.String(), }.Acknowledgement() @@ -673,7 +673,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { // must be changed explicitly ack = types.IncentivizedAcknowledgement{ - Result: ibcmock.MockAcknowledgement.Acknowledgement(), + AppAcknowledgement: ibcmock.MockAcknowledgement.Acknowledgement(), ForwardRelayerAddress: relayerAddr.String(), }.Acknowledgement() diff --git a/modules/apps/29-fee/types/ack.go b/modules/apps/29-fee/types/ack.go index 229d8e4cc3f..d0fe4269868 100644 --- a/modules/apps/29-fee/types/ack.go +++ b/modules/apps/29-fee/types/ack.go @@ -7,7 +7,7 @@ import ( // NewIncentivizedAcknowledgement creates a new instance of IncentivizedAcknowledgement func NewIncentivizedAcknowledgement(relayer string, ack []byte, success bool) IncentivizedAcknowledgement { return IncentivizedAcknowledgement{ - Result: ack, + AppAcknowledgement: ack, ForwardRelayerAddress: relayer, UnderlyingAppSuccess: success, } diff --git a/modules/apps/29-fee/types/ack.pb.go b/modules/apps/29-fee/types/ack.pb.go index 4f6437da224..0044e17c1b7 100644 --- a/modules/apps/29-fee/types/ack.pb.go +++ b/modules/apps/29-fee/types/ack.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware type IncentivizedAcknowledgement struct { // the underlying app acknowledgement result bytes - Result []byte `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + AppAcknowledgement []byte `protobuf:"bytes,1,opt,name=app_acknowledgement,json=appAcknowledgement,proto3" json:"app_acknowledgement,omitempty"` // the relayer address which submits the recv packet message ForwardRelayerAddress string `protobuf:"bytes,2,opt,name=forward_relayer_address,json=forwardRelayerAddress,proto3" json:"forward_relayer_address,omitempty" yaml:"forward_relayer_address"` // success flag of the base application callback @@ -66,9 +66,9 @@ func (m *IncentivizedAcknowledgement) XXX_DiscardUnknown() { var xxx_messageInfo_IncentivizedAcknowledgement proto.InternalMessageInfo -func (m *IncentivizedAcknowledgement) GetResult() []byte { +func (m *IncentivizedAcknowledgement) GetAppAcknowledgement() []byte { if m != nil { - return m.Result + return m.AppAcknowledgement } return nil } @@ -94,27 +94,28 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/ack.proto", fileDescriptor_ab2834946fb65ea4) } var fileDescriptor_ab2834946fb65ea4 = []byte{ - // 315 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0xeb, 0xff, 0x97, 0x2a, 0x88, 0x98, 0xa2, 0xd2, 0x56, 0x20, 0x85, 0x92, 0xa9, 0x4b, - 0x63, 0x95, 0x8a, 0x01, 0xb6, 0x76, 0x63, 0x42, 0x0a, 0x0b, 0xea, 0x12, 0x39, 0xf6, 0x6d, 0xb0, - 0xea, 0xd8, 0x96, 0xed, 0xa4, 0x0a, 0x4f, 0xc1, 0x63, 0x31, 0x76, 0x64, 0x42, 0xa8, 0x1d, 0xd9, - 0x78, 0x02, 0x94, 0xa6, 0x12, 0x1d, 0x60, 0xbb, 0xf7, 0x9c, 0x4f, 0x67, 0xf8, 0xbc, 0x4b, 0x9e, - 0x52, 0x4c, 0xb4, 0x16, 0x9c, 0x12, 0xc7, 0x95, 0xb4, 0x78, 0x01, 0x80, 0xcb, 0x31, 0x26, 0x74, - 0x19, 0x69, 0xa3, 0x9c, 0xf2, 0x7b, 0x3c, 0xa5, 0xd1, 0x21, 0x12, 0x2d, 0x00, 0xa2, 0x72, 0x7c, - 0xd6, 0xc9, 0x54, 0xa6, 0x76, 0x0c, 0xae, 0xaf, 0x06, 0x0f, 0x3f, 0x91, 0x77, 0x7e, 0x27, 0x29, - 0x48, 0xc7, 0x4b, 0xfe, 0x0c, 0x6c, 0x4a, 0x97, 0x52, 0xad, 0x04, 0xb0, 0x0c, 0x72, 0x90, 0xce, - 0xef, 0x7a, 0x6d, 0x03, 0xb6, 0x10, 0xae, 0x8f, 0x06, 0x68, 0x78, 0x12, 0xef, 0x3f, 0x7f, 0xee, - 0xf5, 0x16, 0xca, 0xac, 0x88, 0x61, 0x89, 0x01, 0x41, 0x2a, 0x30, 0x09, 0x61, 0xcc, 0x80, 0xb5, - 0xfd, 0x7f, 0x03, 0x34, 0x3c, 0x9e, 0x85, 0x5f, 0xef, 0x17, 0x41, 0x45, 0x72, 0x71, 0x1b, 0xfe, - 0x01, 0x86, 0xf1, 0xe9, 0xbe, 0x89, 0x9b, 0x62, 0xda, 0xe4, 0xfe, 0xa3, 0xd7, 0x2d, 0x24, 0x03, - 0x23, 0x2a, 0x2e, 0xb3, 0x84, 0x68, 0x9d, 0xd8, 0x82, 0xd2, 0x7a, 0xfa, 0xff, 0x00, 0x0d, 0x8f, - 0x0e, 0xa7, 0x7f, 0xe7, 0x44, 0x18, 0x77, 0x7e, 0x9a, 0xa9, 0xd6, 0x0f, 0x4d, 0x3e, 0xbb, 0x7f, - 0xdd, 0x04, 0x68, 0xbd, 0x09, 0xd0, 0xc7, 0x26, 0x40, 0x2f, 0xdb, 0xa0, 0xb5, 0xde, 0x06, 0xad, - 0xb7, 0x6d, 0xd0, 0x9a, 0x5f, 0x67, 0xdc, 0x3d, 0x15, 0x69, 0x44, 0x55, 0x8e, 0xa9, 0xb2, 0xb9, - 0xb2, 0x98, 0xa7, 0x74, 0x94, 0x29, 0x5c, 0x4e, 0x70, 0xae, 0x58, 0x21, 0xc0, 0xd6, 0xe6, 0x2d, - 0xbe, 0xba, 0x19, 0xd5, 0xd2, 0x5d, 0xa5, 0xc1, 0xa6, 0xed, 0x9d, 0xc5, 0xc9, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x2e, 0x38, 0x5f, 0x80, 0x99, 0x01, 0x00, 0x00, + // 321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x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, 0x4f, 0x83, 0xb7, 0x97, + 0x13, 0x5c, 0xd1, 0x4c, 0x5e, 0x06, 0xbf, 0x80, 0x41, 0x74, 0xf0, 0xe1, 0x44, 0x8d, 0x31, 0x69, + 0x74, 0xff, 0xd6, 0x3b, 0x2c, 0x14, 0x07, 0x2b, 0x2b, 0xa1, 0xd2, 0xb8, 0xbe, 0xcb, 0x15, 0x8c, + 0xd5, 0xd1, 0x7f, 0xfa, 0x68, 0xf0, 0x6f, 0x37, 0xfa, 0x67, 0x4e, 0x06, 0x51, 0xe7, 0xd3, 0x99, + 0x18, 0x73, 0xd3, 0xe8, 0xd3, 0xeb, 0xa7, 0x35, 0x46, 0xab, 0x35, 0x46, 0xaf, 0x6b, 0x8c, 0x1e, + 0x37, 0xb8, 0xb5, 0xda, 0xe0, 0xd6, 0xf3, 0x06, 0xb7, 0x66, 0xe7, 0xa9, 0xc8, 0xef, 0x8a, 0x24, + 0x64, 0x3a, 0x23, 0x4c, 0xbb, 0x4c, 0x3b, 0x22, 0x12, 0x36, 0x4c, 0x35, 0x29, 0xc7, 0x24, 0xd3, + 0xbc, 0x90, 0xe0, 0xea, 0x4a, 0x1c, 0x39, 0xbb, 0x18, 0xd6, 0x6d, 0xe4, 0x95, 0x01, 0x97, 0xfc, + 0xdd, 0xbe, 0x77, 0xfc, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x89, 0x7e, 0xe8, 0xf3, 0xb2, 0x01, 0x00, + 0x00, } func (m *IncentivizedAcknowledgement) Marshal() (dAtA []byte, err error) { @@ -154,10 +155,10 @@ func (m *IncentivizedAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, er i-- dAtA[i] = 0x12 } - if len(m.Result) > 0 { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintAck(dAtA, i, uint64(len(m.Result))) + if len(m.AppAcknowledgement) > 0 { + i -= len(m.AppAcknowledgement) + copy(dAtA[i:], m.AppAcknowledgement) + i = encodeVarintAck(dAtA, i, uint64(len(m.AppAcknowledgement))) i-- dAtA[i] = 0xa } @@ -181,7 +182,7 @@ func (m *IncentivizedAcknowledgement) Size() (n int) { } var l int _ = l - l = len(m.Result) + l = len(m.AppAcknowledgement) if l > 0 { n += 1 + l + sovAck(uint64(l)) } @@ -232,7 +233,7 @@ func (m *IncentivizedAcknowledgement) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AppAcknowledgement", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -259,9 +260,9 @@ func (m *IncentivizedAcknowledgement) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) - if m.Result == nil { - m.Result = []byte{} + m.AppAcknowledgement = append(m.AppAcknowledgement[:0], dAtA[iNdEx:postIndex]...) + if m.AppAcknowledgement == nil { + m.AppAcknowledgement = []byte{} } iNdEx = postIndex case 2: diff --git a/proto/ibc/applications/fee/v1/ack.proto b/proto/ibc/applications/fee/v1/ack.proto index 728c7536c6b..1bd0aaf8f6e 100644 --- a/proto/ibc/applications/fee/v1/ack.proto +++ b/proto/ibc/applications/fee/v1/ack.proto @@ -9,7 +9,7 @@ import "gogoproto/gogo.proto"; // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware message IncentivizedAcknowledgement { // the underlying app acknowledgement result bytes - bytes result = 1; + bytes app_acknowledgement = 1; // the relayer address which submits the recv packet message string forward_relayer_address = 2 [(gogoproto.moretags) = "yaml:\"forward_relayer_address\""]; // success flag of the base application callback