Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f30c29b
backport unordered tx
technicallyty Feb 14, 2025
f0d0d04
fix test
technicallyty Feb 14, 2025
c28ae02
Fix test
technicallyty Feb 14, 2025
17b8543
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 14, 2025
f9b42d8
update go mod
technicallyty Feb 14, 2025
fa6c344
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 14, 2025
e254223
feat: [ADR-070] Unordered Transactions (1/2) (#18641)
alexanderbez Jan 4, 2024
ff6063f
import ordering
technicallyty Feb 15, 2025
c56005b
changelog and upgrading
technicallyty Feb 15, 2025
77a4db0
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 21, 2025
daf1ce6
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 24, 2025
73aa638
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 25, 2025
e4fce16
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
0272e5e
add changelog entry
technicallyty Feb 26, 2025
f815582
remove upgrading for now
technicallyty Feb 26, 2025
4572229
make upgrading.md for v53
technicallyty Feb 26, 2025
b754f48
fix(unorderedtx): issues reported in audit (#21467) (#23727)
technicallyty Feb 26, 2025
426c38d
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
6274a10
make unordered and timeouttimestamp required together
technicallyty Feb 26, 2025
926b02b
revise adr
technicallyty Feb 26, 2025
9188d9e
lint fixes, proto comment fix
technicallyty Feb 26, 2025
f1cd89f
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
7f8c878
fix sigverify business and restore ante handlers
technicallyty Feb 26, 2025
70a67aa
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
Feb 27, 2025
1b6d687
optional utx
technicallyty Feb 27, 2025
43c8f5c
Merge branch 'technicallyty/backport-6ec53aaf54-unorderedtx-part-1' o…
technicallyty Feb 27, 2025
af456e8
changelog
technicallyty Feb 27, 2025
e58306f
fix test
technicallyty Feb 27, 2025
1fd8c3d
linter
technicallyty Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions docs/architecture/adr-070-unordered-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

* Dec 4, 2023: Initial Draft (@yihuang, @tac0turtle, @alexanderbez)
* Jan 30, 2024: Include section on deterministic transaction encoding
* Feb 26, 2025: Revise section about facilitating nonce incrementing to align with the context of cosmos-sdk v0.53.x.

## Status

Expand Down Expand Up @@ -215,23 +214,17 @@ func channelBatchRecv[T any](ch <-chan *T) []*T {

### AnteHandler Decorator

In order to facilitate bypassing nonce verification, we have to modify the `authenticate` method of the
SigVerificationDecorator type.
In order to facilitate bypassing nonce verification, we have to modify the existing
`IncrementSequenceDecorator` AnteHandler decorator to skip the nonce verification
when the transaction is marked as un-ordered.

```golang
// authenticate the authentication of the TX for a specific tx signer.
func (svd SigVerificationDecorator) authenticate(ctx sdk.Context, tx sdk.Tx, simulate bool, signer []byte, sig signing.SignatureV2) error {
// ....

// Bypass incrementing sequence for transactions with unordered set to true.
// The actual parameters of the un-ordered tx will be checked in a separate
// decorator.
unorderedTx, ok := tx.(sdk.TxWithUnordered)
if ok && unorderedTx.GetUnordered() {
return nil
}
func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
if tx.UnOrdered() {
return next(ctx, tx, simulate)
}

return svd.increaseSequence(ctx, acc)
// ...
}
```

Expand Down
8 changes: 7 additions & 1 deletion simapp/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, errors.New("sign mode handler is required for ante builder")
}

if options.UnorderedTxManager == nil {
return nil, errors.New("unordered tx manager is required for ante builder")
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
Expand All @@ -44,7 +48,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.SigGasConsumer),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
9 changes: 5 additions & 4 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import (
"os"
"path/filepath"

abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
"github.com/spf13/cast"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
Expand All @@ -32,10 +37,6 @@ import (
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
"github.com/spf13/cast"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down
4 changes: 3 additions & 1 deletion x/auth/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
NewValidateSigCountDecorator(options.AccountKeeper),
NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.SigGasConsumer),
NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
NewIncrementSequenceDecorator(options.AccountKeeper),
}

if options.UnorderedTxManager != nil {
Expand Down
Loading