Skip to content

Commit 6514b67

Browse files
committed
feat: enable unordered transactions
Signed-off-by: Artur Troian <troian@users.noreply.github.com>
1 parent 797e26b commit 6514b67

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

app/ante.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
5353
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
5454
ante.NewValidateSigCountDecorator(options.AccountKeeper),
5555
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
56-
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
56+
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.SigVerifyOptions...),
5757
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
5858
}
5959

app/types/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ func (app *App) InitNormalKeepers(
276276
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
277277
AccountAddressPrefix,
278278
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
279+
authkeeper.WithUnorderedTransactions(true),
279280
)
280281

281282
app.Keepers.Cosmos.Bank = bankkeeper.NewBaseKeeper(

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/boz/go-lifecycle v0.1.1
2121
github.com/cometbft/cometbft v0.38.21
2222
github.com/cosmos/cosmos-db v1.1.3
23-
github.com/cosmos/cosmos-sdk v0.53.5
23+
github.com/cosmos/cosmos-sdk v0.53.6
2424
github.com/cosmos/gogoproto v1.7.2
2525
github.com/cosmos/ibc-go/v10 v10.5.0
2626
github.com/cosmos/rosetta v0.50.12
@@ -64,7 +64,7 @@ replace (
6464
// use akash fork of cometbft
6565
github.com/cometbft/cometbft => github.com/akash-network/cometbft v0.38.21-akash.1
6666
// use akash fork of cosmos sdk
67-
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.5-akash.1
67+
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.6-akash.1
6868

6969
github.com/cosmos/gogoproto => github.com/akash-network/gogoproto v1.7.0-akash.2
7070

@@ -139,7 +139,7 @@ require (
139139
github.com/cosmos/gogogateway v1.2.0 // indirect
140140
github.com/cosmos/iavl v1.2.6 // indirect
141141
github.com/cosmos/ics23/go v0.11.0 // indirect
142-
github.com/cosmos/ledger-cosmos-go v0.16.0 // indirect
142+
github.com/cosmos/ledger-cosmos-go v1.0.0 // indirect
143143
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
144144
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
145145
github.com/danieljoos/wincred v1.2.2 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,8 @@ github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3
12871287
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
12881288
github.com/akash-network/cometbft v0.38.21-akash.1 h1:li8x87YansHyID6VBTOxe/yBLRcdb6lQnjAeTvnMn/w=
12891289
github.com/akash-network/cometbft v0.38.21-akash.1/go.mod h1:UCu8dlHqvkAsmAFmWDRWNZJPlu6ya2fTWZlDrWsivwo=
1290-
github.com/akash-network/cosmos-sdk v0.53.5-akash.1 h1:9FZBLNjvx8SRIFht0BuyjrOqfWFZ23kOUqfI6NFTXXs=
1291-
github.com/akash-network/cosmos-sdk v0.53.5-akash.1/go.mod h1:wS9wPP97nCfQ28+Zsa4SkPhcK6ymTKxbOVKN0yqYGqk=
1290+
github.com/akash-network/cosmos-sdk v0.53.6-akash.1 h1:Da37/oS0rbO77FfUNbcNeYp9oKZr2ktV3jhA1sjv+KY=
1291+
github.com/akash-network/cosmos-sdk v0.53.6-akash.1/go.mod h1:ZKpVIHvKJgJJqOO2DpIJTwSyuKC0ekgIySUJsEPKnFs=
12921292
github.com/akash-network/gogoproto v1.7.0-akash.2 h1:zY5seM6kBOLMBWn15t8vrY1ao4J1HjrhNaEeO/Soro0=
12931293
github.com/akash-network/gogoproto v1.7.0-akash.2/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
12941294
github.com/akash-network/ledger-go v0.16.0 h1:75oasauaV0dNGOgMB3jr/rUuxJC0gHDdYYnQW+a4bvg=

x/oracle/keeper/prune.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (k *keeper) prunePrices(ctx sdk.Context, cutoff time.Time, maxDelete int64)
7373

7474
// pruneSourcePrices deletes price records for a single (source, denom, baseDenom)
7575
// prefix that are older than cutoff. Returns number of records deleted.
76-
func (k *keeper) pruneSourcePrices(ctx sdk.Context, source uint32, denom, baseDenom string, cutoff time.Time, maxDelete int64) int64 {
76+
func (k *keeper) pruneSourcePrices(ctx sdk.Context, source uint32, denom, baseDenom string, cutoff time.Time, maxDelete int64) (int64, error) {
7777
start := types.PriceDataRecordID{
7878
Source: source,
7979
Denom: denom,
@@ -95,17 +95,21 @@ func (k *keeper) pruneSourcePrices(ctx sdk.Context, source uint32, denom, baseDe
9595
var toDelete []types.PriceDataRecordID
9696
var count int64
9797

98-
_ = k.prices.Walk(ctx, rng, func(key types.PriceDataRecordID, _ types.PriceDataState) (bool, error) {
98+
if err := k.prices.Walk(ctx, rng, func(key types.PriceDataRecordID, _ types.PriceDataState) (bool, error) {
9999
toDelete = append(toDelete, key)
100100
count++
101101
return count >= maxDelete, nil
102-
})
102+
}); err != nil {
103+
return count, err
104+
}
103105

104106
for _, key := range toDelete {
105-
_ = k.prices.Remove(ctx, key)
107+
if err := k.prices.Remove(ctx, key); err != nil {
108+
return count, err
109+
}
106110
}
107111

108-
return count
112+
return count, nil
109113
}
110114

111115
// EpochHooks returns the oracle keeper as an EpochHooks implementation for

0 commit comments

Comments
 (0)