Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename decorator to RedundancyRelayDecorator #1820

Merged
merged 8 commits into from
Jul 28, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (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.
Expand Down
10 changes: 5 additions & 5 deletions modules/core/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (rd RedundantRelayDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
// 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`
Expand Down
4 changes: 2 additions & 2 deletions modules/core/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion testing/simapp/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down