From 6da557892c2e182cc43eb0cc3e6e87cd39acce39 Mon Sep 17 00:00:00 2001 From: stepit Date: Wed, 9 Apr 2025 07:51:33 +0200 Subject: [PATCH 1/4] chore: update ante --- ante.go | 14 ++++++++++---- simapp/ante.go | 10 +++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ante.go b/ante.go index b6cc8af..3ab3d47 100644 --- a/ante.go +++ b/ante.go @@ -22,11 +22,11 @@ package forwarding import ( storetypes "cosmossdk.io/store/types" - txsigning "cosmossdk.io/x/tx/signing" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/ante" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/noble-assets/forwarding/v2/types" ) @@ -45,17 +45,23 @@ func SigVerificationGasConsumer( // +var _ sdk.AnteDecorator = SigVerificationDecorator{} + type SigVerificationDecorator struct { - underlying ante.SigVerificationDecorator bank types.BankKeeper + underlying sdk.AnteDecorator } var _ sdk.AnteDecorator = SigVerificationDecorator{} -func NewSigVerificationDecorator(ak ante.AccountKeeper, bk types.BankKeeper, signModeHandler *txsigning.HandlerMap) SigVerificationDecorator { +func NewSigVerificationDecorator(bk types.BankKeeper, underlying sdk.AnteDecorator) SigVerificationDecorator { + if underlying == nil { + panic("underlying ante decorator cannot be nil") + } + return SigVerificationDecorator{ - underlying: ante.NewSigVerificationDecorator(ak, signModeHandler), bank: bk, + underlying: underlying, } } diff --git a/simapp/ante.go b/simapp/ante.go index b524fa3..5698a19 100644 --- a/simapp/ante.go +++ b/simapp/ante.go @@ -33,6 +33,11 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { return nil, errors.Wrap(errorstypes.ErrLogic, "sign mode handler is required for ante builder") } + sigVerificationDecorator := forwarding.NewSigVerificationDecorator( + options.BankKeeper, + ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), + ) + anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), @@ -44,7 +49,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewValidateSigCountDecorator(options.AccountKeeper), ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), - forwarding.NewSigVerificationDecorator(options.AccountKeeper, options.BankKeeper, options.SignModeHandler), + + // Custom signature verification for Forwarding accounts. + sigVerificationDecorator, + ante.NewIncrementSequenceDecorator(options.AccountKeeper), } From 178e38d684bb3ed12a613ce9d1c082cad83b405b Mon Sep 17 00:00:00 2001 From: stepit Date: Wed, 9 Apr 2025 11:49:18 +0200 Subject: [PATCH 2/4] chore: add changelog --- .../improvements/27-use-interface-for-underlying-ante.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 .changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md diff --git a/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md b/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md new file mode 100644 index 0000000..adf1cf4 --- /dev/null +++ b/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md @@ -0,0 +1 @@ +- Use an interface for underlying ante in `NewSigVerificationDecorator`. ([#27](https://github.com/noble-assets/forwarding/pull/27)) From 8d35474a20211fe1f376797a4724f9094c7bb34f Mon Sep 17 00:00:00 2001 From: stepit Date: Wed, 9 Apr 2025 11:57:43 +0200 Subject: [PATCH 3/4] chore: we can do it --- .../improvements/27-use-interface-for-underlying-ante.md | 2 +- .changelog/unreleased/summary.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changelog/unreleased/summary.md diff --git a/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md b/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md index adf1cf4..bd1b879 100644 --- a/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md +++ b/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md @@ -1 +1 @@ -- Use an interface for underlying ante in `NewSigVerificationDecorator`. ([#27](https://github.com/noble-assets/forwarding/pull/27)) +- Enable customization of underlying ante handler in `NewSigVerificationDecorator`. ([#27](https://github.com/noble-assets/forwarding/pull/27)) diff --git a/.changelog/unreleased/summary.md b/.changelog/unreleased/summary.md new file mode 100644 index 0000000..bb53cc4 --- /dev/null +++ b/.changelog/unreleased/summary.md @@ -0,0 +1,7 @@ +*Apr 9, 2025* + +This is a non-consensus breaking patch release to the v2 line. The release +improve the constructor of the `SigVerificationDecorator` +to accept an interface for the underlying ante handler. This change allows +to chain multiple signature verification decorator for +other modules. From 0c32a30ae07f8967cf65b7d8f353f29ceefde499 Mon Sep 17 00:00:00 2001 From: John Letey Date: Wed, 9 Apr 2025 12:01:24 +0200 Subject: [PATCH 4/4] chore: small cl updates --- .../27-use-interface-for-underlying-ante.md | 1 - .changelog/unreleased/summary.md | 7 ------- .changelog/v2.0.2/improvements/27-underlying-ante.md | 1 + .changelog/v2.0.2/summary.md | 3 +++ CHANGELOG.md | 10 ++++++++++ 5 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 .changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md delete mode 100644 .changelog/unreleased/summary.md create mode 100644 .changelog/v2.0.2/improvements/27-underlying-ante.md create mode 100644 .changelog/v2.0.2/summary.md diff --git a/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md b/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md deleted file mode 100644 index bd1b879..0000000 --- a/.changelog/unreleased/improvements/27-use-interface-for-underlying-ante.md +++ /dev/null @@ -1 +0,0 @@ -- Enable customization of underlying ante handler in `NewSigVerificationDecorator`. ([#27](https://github.com/noble-assets/forwarding/pull/27)) diff --git a/.changelog/unreleased/summary.md b/.changelog/unreleased/summary.md deleted file mode 100644 index bb53cc4..0000000 --- a/.changelog/unreleased/summary.md +++ /dev/null @@ -1,7 +0,0 @@ -*Apr 9, 2025* - -This is a non-consensus breaking patch release to the v2 line. The release -improve the constructor of the `SigVerificationDecorator` -to accept an interface for the underlying ante handler. This change allows -to chain multiple signature verification decorator for -other modules. diff --git a/.changelog/v2.0.2/improvements/27-underlying-ante.md b/.changelog/v2.0.2/improvements/27-underlying-ante.md new file mode 100644 index 0000000..63131d1 --- /dev/null +++ b/.changelog/v2.0.2/improvements/27-underlying-ante.md @@ -0,0 +1 @@ +- Enable customization of underlying ante handler in `SigVerificationDecorator` ([#27](https://github.com/noble-assets/forwarding/pull/27)) diff --git a/.changelog/v2.0.2/summary.md b/.changelog/v2.0.2/summary.md new file mode 100644 index 0000000..decf605 --- /dev/null +++ b/.changelog/v2.0.2/summary.md @@ -0,0 +1,3 @@ +*Apr 9, 2025* + +This is a non-consensus breaking patch release to the v2 line. diff --git a/CHANGELOG.md b/CHANGELOG.md index 0816188..82af505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # CHANGELOG +## v2.0.2 + +*Apr 9, 2025* + +This is a non-consensus breaking patch release to the v2 line. + +### IMPROVEMENTS + +- Enable customization of underlying ante handler in `SigVerificationDecorator` ([#27](https://github.com/noble-assets/forwarding/pull/27)) + ## v2.0.1 *Feb 10, 2025*