Skip to content

Commit

Permalink
refactor: renaming Result in IncentivizedAcknowledgement to AppAcknow…
Browse files Browse the repository at this point in the history
…ledgement (#1338)

* refactor: renaming Result in IncentivizedAcknowledgement to AppAcknowledgement

* chore: changelog

* Update proto/ibc/applications/fee/v1/ack.proto

Co-authored-by: colin axnér <[email protected]>

* chore: yaml

Co-authored-by: colin axnér <[email protected]>
  • Loading branch information
seantking and colin-axner authored May 4, 2022
1 parent bd08650 commit 7bb609c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking

* (transfer) [\#1250](https://github.com/cosmos/ibc-go/pull/1250) Deprecate `GetTransferAccount` since the `transfer` module account is never used.
* (modules/29-fee)[\#1338](https://github.com/cosmos/ibc-go/pull/1338) Renaming `Result` field in `IncentivizedAcknowledgement` to `AppAcknowledgement`.

### State Machine Breaking

Expand Down
2 changes: 1 addition & 1 deletion docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 |

Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/29-fee/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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,
}
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/types/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
69 changes: 35 additions & 34 deletions modules/apps/29-fee/types/ack.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/ibc/applications/fee/v1/ack.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ 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;
// the underlying app acknowledgement bytes
bytes app_acknowledgement = 1 [(gogoproto.moretags) = "yaml:\"app_acknowledgement\""];
// 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
Expand Down

0 comments on commit 7bb609c

Please sign in to comment.