diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b794ca286..178094ba455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core/04-channel) [\#1792](https://github.com/cosmos/ibc-go/pull/1792) Remove `PreviousChannelID` from `NewMsgChannelOpenTry` arguments. `MsgChannelOpenTry.ValidateBasic()` returns error if the deprecated `PreviousChannelID` is not empty. * (core/04-channel) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `NewPacketId` has been renamed to `NewPacketID` to comply with go linting rules. * (core/ante) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `AnteDecorator` has been renamed to `RedundancyDecorator` to comply with go linting rules and to give more clarity to the purpose of the Decorator. +* (core/ante) [\#1820](https://github.com/cosmos/ibc-go/pull/1418) `RedundancyDecorator` has been renamed to `RedundantRelayDecorator` to make the name for explicit. * (testing) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `MockIBCApp` has been renamed to `IBCApp` and `MockEmptyAcknowledgement` has been renamed to `EmptyAcknowledgement` to comply with go linting rules * (modules/core/03-connection) [\#1672](https://github.com/cosmos/ibc-go/pull/1672) Remove crossing hellos from connection handshakes. The `PreviousConnectionId` in `MsgConnectionOpenTry` has been deprecated. * (modules/core/04-channel) [\#1317](https://github.com/cosmos/ibc-go/pull/1317) Remove crossing hellos from channel handshakes. The `PreviousChannelId` in `MsgChannelOpenTry` has been deprecated. diff --git a/modules/core/ante/ante.go b/modules/core/ante/ante.go index 14206b40ef0..48caef7bff5 100644 --- a/modules/core/ante/ante.go +++ b/modules/core/ante/ante.go @@ -8,20 +8,20 @@ import ( "github.com/cosmos/ibc-go/v5/modules/core/keeper" ) -type RedundancyDecorator struct { +type RedundantRelayDecorator struct { k *keeper.Keeper } -func NewRedundancyDecorator(k *keeper.Keeper) RedundancyDecorator { - return RedundancyDecorator{k: k} +func NewRedundantRelayDecorator(k *keeper.Keeper) RedundantRelayDecorator { + return RedundantRelayDecorator{k: k} } -// RedundancyDecorator returns an error if a multiMsg tx only contains packet messages (Recv, Ack, Timeout) and additional update messages +// RedundantRelayDecorator returns an error if a multiMsg tx only contains packet messages (Recv, Ack, Timeout) and additional update messages // and all packet messages are redundant. If the transaction is just a single UpdateClient message, or the multimsg transaction // contains some other message type, then the antedecorator returns no error and continues processing to ensure these transactions // are included. This will ensure that relayers do not waste fees on multiMsg transactions when another relayer has already submitted // all packets, by rejecting the tx at the mempool layer. -func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { +func (rrd RedundantRelayDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { // do not run redundancy check on DeliverTx or simulate if (ctx.IsCheckTx() || ctx.IsReCheckTx()) && !simulate { // keep track of total packet messages and number of redundancies across `RecvPacket`, `AcknowledgePacket`, and `TimeoutPacket/OnClose` @@ -30,7 +30,7 @@ func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo for _, m := range tx.GetMsgs() { switch msg := m.(type) { case *channeltypes.MsgRecvPacket: - response, err := rd.k.RecvPacket(sdk.WrapSDKContext(ctx), msg) + response, err := rrd.k.RecvPacket(sdk.WrapSDKContext(ctx), msg) if err != nil { return ctx, err } @@ -40,7 +40,7 @@ func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo packetMsgs++ case *channeltypes.MsgAcknowledgement: - response, err := rd.k.Acknowledgement(sdk.WrapSDKContext(ctx), msg) + response, err := rrd.k.Acknowledgement(sdk.WrapSDKContext(ctx), msg) if err != nil { return ctx, err } @@ -50,7 +50,7 @@ func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo packetMsgs++ case *channeltypes.MsgTimeout: - response, err := rd.k.Timeout(sdk.WrapSDKContext(ctx), msg) + response, err := rrd.k.Timeout(sdk.WrapSDKContext(ctx), msg) if err != nil { return ctx, err } @@ -60,7 +60,7 @@ func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo packetMsgs++ case *channeltypes.MsgTimeoutOnClose: - response, err := rd.k.TimeoutOnClose(sdk.WrapSDKContext(ctx), msg) + response, err := rrd.k.TimeoutOnClose(sdk.WrapSDKContext(ctx), msg) if err != nil { return ctx, err } @@ -70,7 +70,7 @@ func (rd RedundancyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo packetMsgs++ case *clienttypes.MsgUpdateClient: - _, err := rd.k.UpdateClient(sdk.WrapSDKContext(ctx), msg) + _, err := rrd.k.UpdateClient(sdk.WrapSDKContext(ctx), msg) if err != nil { return ctx, err } diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 79c7bfa4264..3d074429a66 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -433,7 +433,7 @@ func (suite *AnteTestSuite) TestAnteDecorator() { // committing it to a block, so that the when check tx runs with the redundant // message they are both in the same block k := suite.chainB.App.GetIBCKeeper() - decorator := ante.NewRedundancyDecorator(k) + decorator := ante.NewRedundantRelayDecorator(k) checkCtx := suite.chainB.GetContext().WithIsCheckTx(true) next := func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { return ctx, nil } txBuilder := suite.chainB.TxConfig.NewTxBuilder() @@ -458,7 +458,7 @@ func (suite *AnteTestSuite) TestAnteDecorator() { suite.SetupTest() k := suite.chainB.App.GetIBCKeeper() - decorator := ante.NewRedundancyDecorator(k) + decorator := ante.NewRedundantRelayDecorator(k) msgs := tc.malleate(suite) diff --git a/testing/simapp/ante_handler.go b/testing/simapp/ante_handler.go index 84621c75883..581140150b1 100644 --- a/testing/simapp/ante_handler.go +++ b/testing/simapp/ante_handler.go @@ -48,7 +48,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), - ibcante.NewRedundancyDecorator(options.IBCKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), } return sdk.ChainAnteDecorators(anteDecorators...), nil