Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
cc6c67b
Support object store (#206)
Mar 25, 2024
17043e4
cleanup
mmsqe Mar 27, 2025
78e3a48
Merge remote-tracking branch 'origin/release/v0.53.x' into release/v0…
mmsqe Mar 28, 2025
f44f06b
fix test
mmsqe Mar 28, 2025
e1ee61f
lint
mmsqe Mar 28, 2025
b75bb98
Merge remote-tracking branch 'origin/main' into release/v0.53.x_obj_s…
mmsqe Apr 9, 2025
e64ccc0
resolve
mmsqe Apr 9, 2025
d2c1c3b
fix test
mmsqe Apr 9, 2025
8892029
fix test
mmsqe Apr 9, 2025
83f4859
Problem: store key type assertion is incorrect (#244)
mmsqe Apr 9, 2025
d97d3d1
Merge remote-tracking branch 'origin/main' into release/v0.53.x_obj_s…
mmsqe Apr 11, 2025
3c03b87
Merge remote-tracking branch 'origin/main' into release/v0.53.x_obj_s…
mmsqe Apr 25, 2025
25a12b9
build(deps): Bump go.uber.org/mock from 0.5.1 to 0.5.2 (backport #246…
mergify[bot] Apr 29, 2025
c1d1e68
chore: release prep (#24605)
Apr 29, 2025
81b5b75
docs: protocolpool wiring (backport #24607) (#24611)
mergify[bot] Apr 29, 2025
bcaf737
chore: audit epoch (backport #24610) (#24613)
mergify[bot] Apr 29, 2025
5901921
chore: all modules use `v0.53.0` (backport #24614) (#24615)
mergify[bot] Apr 29, 2025
61edea8
chore: use final tags (backport #24617) (#24618)
mergify[bot] Apr 29, 2025
ba118bf
chore: update simapp and tests go mod with new client tag (backport #…
mergify[bot] Apr 29, 2025
440eff1
docs: Update documentation links to v0.53.0-rc.2 (backport #24623) (#…
mergify[bot] Apr 30, 2025
be73009
chore: use latest patch for systemstest (backport #24621) (#24627)
mergify[bot] Apr 30, 2025
105186a
chore: add note in `x/staking` about reserved keys from LSM modules (…
mergify[bot] Apr 30, 2025
75c1629
docs: fix broken link to ARC implementation in interblock-cache.md (b…
mergify[bot] May 1, 2025
c33d4ae
docs: update SDK reference links to v0.53.0 in module-manager.md (bac…
mergify[bot] May 1, 2025
abb4756
docs: Update CLI documentation links to v0.53.0 (backport #24641) (#2…
mergify[bot] May 1, 2025
2394c83
docs: fix dead link in 16-testing.md (backport #24643) (#24644)
mergify[bot] May 2, 2025
8bca440
docs: update SDK reference links to v0.53.0 in 16-testing.md (backpor…
mergify[bot] May 2, 2025
b13daa6
docs: Update BaseApp documentation links to v0.53.0 (backport #24646)…
mergify[bot] May 2, 2025
ad9b52e
docs: Update Cosmos SDK references from v0.50.0-alpha.0 to v0.53.0 (b…
mergify[bot] May 2, 2025
fa31def
docs: Update SDK v0.53.0 documentation links (backport #24657) (#24661)
mergify[bot] May 2, 2025
9bbfee1
chore: add audit (backport #24653) (#24662)
mergify[bot] May 2, 2025
15cdcc2
docs: Update SDK documentation links in accounts.md (backport #24666)…
mergify[bot] May 2, 2025
d5bf57d
build(deps): Bump github.com/spf13/cast from 1.7.1 to 1.8.0 in /x/upg…
mergify[bot] May 5, 2025
f49154b
build(deps): Bump github.com/cockroachdb/errors from 1.11.3 to 1.12.0…
mergify[bot] May 5, 2025
dcda5d8
build(deps): Bump actions/create-github-app-token from 2.0.3 to 2.0.6…
mergify[bot] May 5, 2025
fda79d0
docs: Fix dead link in 02-sdk-app-architecture.md (backport #24679) (…
mergify[bot] May 5, 2025
2e961d3
docs: Update GitHub links in query lifecycle documentation (backport …
mergify[bot] May 5, 2025
85694fe
docs: Update SDK v0.53.0 documentation links (backport #24678) (#24692)
mergify[bot] May 5, 2025
4f4d71a
docs: Update GitHub links in `app-anatomy.md` (backport #24690) (#24691)
mergify[bot] May 5, 2025
ef7c838
docs: fix broken anchor link in ICS-030 spec (backport #24696) (#24699)
mergify[bot] May 5, 2025
9631e0c
docs: Update SDK v0.53.0 documentation links (backport #24694) (#24697)
mergify[bot] May 5, 2025
b26edff
build(deps): Bump golang.org/x/sync from 0.13.0 to 0.14.0 (backport #…
mergify[bot] May 6, 2025
dcec726
build(deps): Bump golang.org/x/crypto from 0.37.0 to 0.38.0 (backport…
mergify[bot] May 6, 2025
1228f82
chore: clean up example (backport #24709) (#24710)
mergify[bot] May 6, 2025
fa2c766
docs(x/mint): add example for setting custom minter in depinject setu…
mergify[bot] May 7, 2025
07eebe3
chore(baseapp): deprecate invariants (backport #24664) (#24714)
mergify[bot] May 8, 2025
c6710e1
docs: Add Circuit Breaker CLI command examples (backport #24680) (#24…
mergify[bot] May 12, 2025
e4f193f
chore: uncomment todo in upgrade systemtest (backport #24724) (#24735)
mergify[bot] May 12, 2025
abbb0ac
chore: update to use patched collections (backport #24743) (#24744)
mergify[bot] May 13, 2025
20c63a9
fix(x/epochs): fix register of epoch hooks in `InvokeSetHooks` (backp…
mergify[bot] May 23, 2025
c92ff3a
ci: remove slack notification (backport #24784) (#24785)
mergify[bot] May 28, 2025
1834f4c
fix(client/v2): improve message parsing by replacing proto.Merge with…
mergify[bot] May 30, 2025
d55608c
chore: prep for v0.53.1 (#24819)
May 30, 2025
e265bb9
chore: prep v0.53.2 (#24826)
Jun 3, 2025
c1ece30
docs: fix typos in documentation and error messages (backport #24888)…
mergify[bot] Jun 18, 2025
c4a14fa
Merge commit from fork
technicallyty Jul 8, 2025
908df9d
feat: set signer extraction adapter (backport #25008) (#25012)
mergify[bot] Jul 25, 2025
430b0a7
chore: ledger bump (backport #25036) (#25037)
mergify[bot] Jul 29, 2025
4130292
build(deps): Bump github.com/bytedance/sonic from 1.13.3 to 1.14.0 in…
mergify[bot] Jul 29, 2025
32970c9
add basic support in sdk for block-stm
thomas-nguy Apr 10, 2025
6146284
some cleanup
thomas-nguy Apr 13, 2025
a0236c5
add STM executor
thomas-nguy Apr 14, 2025
07d7b9d
renamme tx-executor to executor
thomas-nguy Apr 14, 2025
b24851d
Add blockstm directly
Eric-Warehime Aug 29, 2025
a282a7e
Merge remote-tracking branch 'mmsqe/release/v0.53.x_obj_store' into e…
Eric-Warehime Aug 29, 2025
541fb4d
move things around
Eric-Warehime Aug 29, 2025
957f9ba
Building
Eric-Warehime Aug 30, 2025
45f0405
Problem: no api to create cachemulti store from external cache store …
Apr 5, 2024
0129a1c
Update to work
Eric-Warehime Sep 5, 2025
349f5f1
Add incarnation cache usage to sigverify ante handler
Eric-Warehime Sep 7, 2025
fe3d98f
Abort oe in PrepareProposal
Eric-Warehime Sep 7, 2025
b54694f
Revert interface change
Eric-Warehime Sep 8, 2025
14e9394
Fully add everything
Eric-Warehime Sep 9, 2025
1f38aac
Add block gas to context
Apr 3, 2024
f0c7e6d
Merge remote-tracking branch 'origin' into eric/block-stm-upstream
Eric-Warehime Sep 10, 2025
39c757b
Fix casing
Eric-Warehime Sep 11, 2025
653659b
Remove some replaces
Eric-Warehime Sep 11, 2025
7b3dccf
Merge remote-tracking branch 'origin' into eric/block-stm-upstream
Eric-Warehime Sep 11, 2025
8651135
Fix mod blockstm
Eric-Warehime Sep 11, 2025
2bcfad4
Fix unit tests
Eric-Warehime Sep 11, 2025
a7416f5
Fix lints
Eric-Warehime Sep 12, 2025
2a8513b
Fix simapp
Eric-Warehime Sep 15, 2025
179ab16
Fix gosec
Eric-Warehime Sep 16, 2025
1e6f1f6
Don't modify docs
Eric-Warehime Sep 16, 2025
f4deb5b
Revert "Fix gosec"
Eric-Warehime Sep 16, 2025
2dbb0df
Merge remote-tracking branch 'origin' into eric/block-stm-upstream
Eric-Warehime Sep 16, 2025
35f0b72
Add metrics to blockstm
Eric-Warehime Sep 19, 2025
e5dcc4c
Simplify diff
Eric-Warehime Sep 24, 2025
fe831d5
Override btree dep
Eric-Warehime Sep 25, 2025
4375725
Use readonly tree in bstm
Eric-Warehime Sep 25, 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
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,30 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [Unreleased]
## [v0.53.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.3) - 2025-07-25

This patch update also includes minor dependency bumps.

### Features

* (abci_utils) [#25008](https://github.com/cosmos/cosmos-sdk/pull/24861) add the ability to assign a custom signer extraction adapter in `DefaultProposalHandler`.

## [v0.53.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.3) - 2025-07-08

### Bug Fixes

* [GHSA-p22h-3m2v-cmgh](https://github.com/cosmos/cosmos-sdk/security/advisories/GHSA-p22h-3m2v-cmgh) Fix x/distribution can halt when historical rewards overflow.


## [v0.53.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.2) - 2025-06-02

This patch update also includes minor dependency bumps.

### Bug Fixes

* (x/epochs) [#24770](https://github.com/cosmos/cosmos-sdk/pull/24770) Fix register of epoch hooks in `InvokeSetHooks`.

## [v0.53.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.53.0) - 2025-04-29


### Breaking Changes
Expand Down Expand Up @@ -99,6 +122,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (genutil) [#24018](https://github.com/cosmos/cosmos-sdk/pull/24018) Allow manually setting the consensus key type in genesis
* (client) [#18557](https://github.com/cosmos/cosmos-sdk/pull/18557) Add `--qrcode` flag to `keys show` command to support displaying keys address QR code.
* (x/auth) [#24030](https://github.com/cosmos/cosmos-sdk/pull/24030) Allow usage of ed25519 keys for transaction signing.
* (baseapp) [#24159](https://github.com/cosmos/cosmos-sdk/pull/24159) Support mount object store in baseapp, add `ObjectStore` api in context.
* (baseapp) [#24163](https://github.com/cosmos/cosmos-sdk/pull/24163) Add `StreamingManager` to baseapp to extend the abci listeners.
* (x/protocolpool) [#23933](https://github.com/cosmos/cosmos-sdk/pull/23933) Add x/protocolpool module.
* x/distribution can now utilize an externally managed community pool. NOTE: this will make the message handlers for FundCommunityPool and CommunityPoolSpend error, as well as the query handler for CommunityPool.
Expand All @@ -107,6 +131,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/mint) [#24436](https://github.com/cosmos/cosmos-sdk/pull/24436) Allow users to set a custom minting function used in the `x/mint` begin blocker.
* The `InflationCalculationFn` argument to `mint.NewAppModule()` is now ignored and must be nil. To set a custom `InflationCalculationFn` on the default minter, use `mintkeeper.WithMintFn(mintkeeper.DefaultMintFn(customInflationFn))`.
* (api) [#24428](https://github.com/cosmos/cosmos-sdk/pull/24428) Add block height to response headers
* (baseapp) [#24458](https://github.com/cosmos/cosmos-sdk/pull/24458) Add `Executor` to support custom execution logic and incarnation cache for performance optimisation

### Improvements

Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ lint:
@$(MAKE) lint-install
@./scripts/go-lint-all.bash --timeout=15m


lint-fix:
@echo "--> Running linter"
@$(MAKE) lint-install
Expand Down Expand Up @@ -532,4 +531,4 @@ build-v53:
else \
echo "No changes to reapply"; \
fi
.PHONY: build-v53
.PHONY: build-v53
9 changes: 4 additions & 5 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Cosmos SDK v0.53.0 Release Notes

💬 [**Release Discussion**](https://github.com/orgs/cosmos/discussions/58)
# Cosmos SDK v0.53.4 Release Notes

## 🚀 Highlights

Announcing Cosmos SDK v0.53
This patch release includes minor dependency and non-breaking functionality additions.

We are pleased to announce the release of Cosmos SDK v0.53! We’re excited to be delivering a new version of the Cosmos SDK that provides key features and updates while minimizing breaking changes so you can focus on what matters most: building.

Expand All @@ -14,4 +12,5 @@ For more upgrade information, check out our [upgrading guide](https://github.com

## 📝 Changelog

Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/CHANGELOG.md) for an exhaustive list of changes, or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/v0.50.12...v0.53.0) from the last release.
Check out the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.53.4/CHANGELOG.md) for an exhaustive list of changes or [compare changes](https://github.com/cosmos/cosmos-sdk/compare/v0.53.3...v0.53.4) from the last release.

79 changes: 48 additions & 31 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/baseapp/state"
"github.com/cosmos/cosmos-sdk/blockstm"

Check failure on line 24 in baseapp/abci.go

View workflow job for this annotation

GitHub Actions / golangci-lint

could not import github.com/cosmos/cosmos-sdk/blockstm (-: # github.com/cosmos/cosmos-sdk/blockstm
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -355,7 +356,7 @@
}

if app.abciHandlers.CheckTxHandler == nil {
gasInfo, result, anteEvents, err := app.runTx(mode, req.Tx, nil)
gasInfo, result, anteEvents, err := app.RunTx(mode, req.Tx, nil, -1, nil, nil)
if err != nil {
return sdkerrors.ResponseCheckTxWithEvents(err, gasInfo.GasWanted, gasInfo.GasUsed, anteEvents, app.trace), nil
}
Expand All @@ -371,7 +372,7 @@

// Create wrapper to avoid users overriding the execution mode
runTx := func(txBytes []byte, tx sdk.Tx) (gInfo sdk.GasInfo, result *sdk.Result, anteEvents []abci.Event, err error) {
return app.runTx(mode, txBytes, tx)
return app.RunTx(mode, txBytes, tx, -1, nil, nil)
}

return app.abciHandlers.CheckTxHandler(runTx, req)
Expand All @@ -395,6 +396,14 @@
return nil, errors.New("PrepareProposal handler not set")
}

// Abort any running OE so it cannot overlap with `PrepareProposal`. This could happen if optimistic
// `internalFinalizeBlock` from previous round takes a long time, but consensus has moved on to next round.
// Overlap is undesirable, since `internalFinalizeBlock` and `PrepareProoposal` could share access to
// in-memory structs depending on application implementation.
// No-op if OE is not enabled.
// Similar call to Abort() is done in `ProcessProposal`.
app.optimisticExec.Abort()

// Always reset state given that PrepareProposal can timeout and be called
// again in a subsequent round.
header := cmtproto.Header{
Expand Down Expand Up @@ -798,47 +807,45 @@

// Reset the gas meter so that the AnteHandlers aren't required to
gasMeter = app.getBlockGasMeter(finalizeState.Context())
finalizeState.SetContext(finalizeState.Context().WithBlockGasMeter(gasMeter))
finalizeState.SetContext(
finalizeState.Context().
WithBlockGasMeter(gasMeter).
WithTxCount(len(req.Txs)))

// Iterate over all raw transactions in the proposal and attempt to execute
// them, gathering the execution results.
//
// NOTE: Not all raw transactions may adhere to the sdk.Tx interface, e.g.
// vote extensions, so skip those.
txResults := make([]*abci.ExecTxResult, 0, len(req.Txs))
for _, rawTx := range req.Txs {
var response *abci.ExecTxResult

if _, err := app.txDecoder(rawTx); err == nil {
response = app.deliverTx(rawTx)
} else {
// In the case where a transaction included in a block proposal is malformed,
// we still want to return a default response to comet. This is because comet
// expects a response for each transaction included in a block proposal.
response = sdkerrors.ResponseExecTxResultWithEvents(
sdkerrors.ErrTxDecode,
0,
0,
nil,
false,
)
}

// check after every tx if we should abort
select {
case <-ctx.Done():
return nil, ctx.Err()
default:
// continue
}

txResults = append(txResults, response)
txResults, err := app.executeTxsWithExecutor(ctx, finalizeState.MultiStore, req.Txs)
if err != nil {
// usually due to canceled
return nil, err
}

if finalizeState.MultiStore.TracingEnabled() {
finalizeState.MultiStore = finalizeState.MultiStore.SetTracingContext(nil).(storetypes.CacheMultiStore)
}

var (
blockGasUsed uint64
blockGasWanted uint64
)
for _, res := range txResults {
// GasUsed should not be -1 but just in case
if res.GasUsed > 0 {
blockGasUsed += uint64(res.GasUsed)
}
// GasWanted could be -1 if the tx is invalid
if res.GasWanted > 0 {
blockGasWanted += uint64(res.GasWanted)
}
}
finalizeState.SetContext(
finalizeState.Context().
WithBlockGasUsed(blockGasUsed).
WithBlockGasWanted(blockGasWanted),
)
endBlock, err := app.endBlock(finalizeState.Context())
if err != nil {
return nil, err
Expand All @@ -863,6 +870,16 @@
}, nil
}

func (app *BaseApp) executeTxsWithExecutor(ctx context.Context, ms storetypes.MultiStore, txs [][]byte) ([]*abci.ExecTxResult, error) {
if app.txRunner == nil {
app.txRunner = blockstm.NewDefaultRunner(
app.txDecoder,
)
}

return app.txRunner.Run(ctx, ms, txs, app.deliverTx)
}

// FinalizeBlock will execute the block proposal provided by RequestFinalizeBlock.
// Specifically, it will execute an application's BeginBlock (if defined), followed
// by the transactions in the proposal, finally followed by the application's
Expand Down
46 changes: 35 additions & 11 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp/config"
"github.com/cosmos/cosmos-sdk/baseapp/oe"
"github.com/cosmos/cosmos-sdk/baseapp/state"
"github.com/cosmos/cosmos-sdk/blockstm"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -161,6 +162,9 @@ type BaseApp struct {
//
// SAFETY: it's safe to do if validators validate the total gas wanted in the `ProcessProposal`, which is the case in the default handler.
disableBlockGasMeter bool

// Optional alternative tx runner, used for block-stm parallel transaction execution. If nil, default txRunner is used.
txRunner blockstm.TxRunner
}

// NewBaseApp returns a reference to an initialized BaseApp. It accepts a
Expand Down Expand Up @@ -283,6 +287,9 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) {
case *storetypes.MemoryStoreKey:
app.MountStore(key, storetypes.StoreTypeMemory)

case *storetypes.ObjectStoreKey:
app.MountStore(key, storetypes.StoreTypeObject)

default:
panic(fmt.Sprintf("Unrecognized store key type :%T", key))
}
Expand Down Expand Up @@ -321,6 +328,16 @@ func (app *BaseApp) MountMemoryStores(keys map[string]*storetypes.MemoryStoreKey
}
}

// MountObjectStores mounts all transient object stores with the BaseApp's internal
// commit multi-store.
func (app *BaseApp) MountObjectStores(keys map[string]*storetypes.ObjectStoreKey) {
skeys := slices.Sorted(maps.Keys(keys))
for _, key := range skeys {
memKey := keys[key]
app.MountStore(memKey, storetypes.StoreTypeObject)
}
}

// MountStore mounts a store to the provided key in the BaseApp multistore,
// using the default DB.
func (app *BaseApp) MountStore(key storetypes.StoreKey, typ storetypes.StoreType) {
Expand Down Expand Up @@ -589,9 +606,7 @@ func (app *BaseApp) getBlockGasMeter(ctx sdk.Context) storetypes.GasMeter {
return storetypes.NewInfiniteGasMeter()
}

// getContextForTx retrieves the context for the tx w/ txBytes and other memoized values.
// retrieve the context for the tx w/ txBytes and other memoized values.
func (app *BaseApp) getContextForTx(mode sdk.ExecMode, txBytes []byte) sdk.Context {
func (app *BaseApp) getContextForTx(mode sdk.ExecMode, txBytes []byte, txIndex int) sdk.Context {
app.mu.Lock()
defer app.mu.Unlock()

Expand All @@ -601,6 +616,7 @@ func (app *BaseApp) getContextForTx(mode sdk.ExecMode, txBytes []byte) sdk.Conte
}
ctx := modeState.Context().
WithTxBytes(txBytes).
WithTxIndex(txIndex).
WithGasMeter(storetypes.NewInfiniteGasMeter())
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed

Expand Down Expand Up @@ -685,7 +701,7 @@ func (app *BaseApp) beginBlock(_ *abci.RequestFinalizeBlock) (sdk.BeginBlock, er
return resp, nil
}

func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult {
func (app *BaseApp) deliverTx(tx []byte, txMultiStore storetypes.MultiStore, txIndex int, incarnationCache map[string]any) *abci.ExecTxResult {
gInfo := sdk.GasInfo{}
resultStr := "successful"

Expand All @@ -698,7 +714,7 @@ func (app *BaseApp) deliverTx(tx []byte) *abci.ExecTxResult {
telemetry.SetGauge(float32(gInfo.GasWanted), "tx", "gas", "wanted")
}()

gInfo, result, anteEvents, err := app.runTx(execModeFinalize, tx, nil)
gInfo, result, anteEvents, err := app.RunTx(execModeFinalize, tx, nil, txIndex, txMultiStore, incarnationCache)
if err != nil {
resultStr = "failed"
resp = sdkerrors.ResponseExecTxResultWithEvents(
Expand Down Expand Up @@ -748,7 +764,7 @@ func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) {
return endblock, nil
}

// runTx processes a transaction within a given execution mode, encoded transaction
// RunTx processes a transaction within a given execution mode, encoded transaction
// bytes, and the decoded transaction itself. All state transitions occur through
// a cached Context depending on the mode provided. State only gets persisted
// if all messages get executed successfully and the execution mode is DeliverTx.
Expand All @@ -757,17 +773,23 @@ func (app *BaseApp) endBlock(_ context.Context) (sdk.EndBlock, error) {
// and execute successfully. An error is returned otherwise.
// both txbytes and the decoded tx are passed to runTx to avoid the state machine encoding the tx and decoding the transaction twice
// passing the decoded tx to runTX is optional, it will be decoded if the tx is nil
func (app *BaseApp) runTx(mode sdk.ExecMode, txBytes []byte, tx sdk.Tx) (gInfo sdk.GasInfo, result *sdk.Result, anteEvents []abci.Event, err error) {
func (app *BaseApp) RunTx(mode sdk.ExecMode, txBytes []byte, tx sdk.Tx, txIndex int, txMultiStore storetypes.MultiStore, incarnationCache map[string]any) (gInfo sdk.GasInfo, result *sdk.Result, anteEvents []abci.Event, err error) {
// NOTE: GasWanted should be returned by the AnteHandler. GasUsed is
// determined by the GasMeter. We need access to the context to get the gas
// meter, so we initialize upfront.
var gasWanted uint64

ctx := app.getContextForTx(mode, txBytes)
ctx := app.getContextForTx(mode, txBytes, txIndex)
if incarnationCache != nil {
ctx = ctx.WithIncarnationCache(incarnationCache)
}
if txMultiStore != nil {
ctx = ctx.WithMultiStore(txMultiStore)
}
ms := ctx.MultiStore()

// only run the tx if there is block gas remaining
if mode == execModeFinalize && ctx.BlockGasMeter().IsOutOfGas() {
if mode == sdk.ExecModeFinalize && ctx.BlockGasMeter().IsOutOfGas() {
return gInfo, nil, nil, errorsmod.Wrap(sdkerrors.ErrOutOfGas, "no block gas left to run tx")
}

Expand Down Expand Up @@ -956,6 +978,8 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, msgsV2 []protov2.Me
break
}

ctx = ctx.WithMsgIndex(i)

handler := app.msgServiceRouter.Handler(msg)
if handler == nil {
return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "no message handler found for %T", msg)
Expand Down Expand Up @@ -1054,7 +1078,7 @@ func (app *BaseApp) PrepareProposalVerifyTx(tx sdk.Tx) ([]byte, error) {
return nil, err
}

_, _, _, err = app.runTx(execModePrepareProposal, bz, tx)
_, _, _, err = app.RunTx(execModePrepareProposal, bz, tx, -1, nil, nil)
if err != nil {
return nil, err
}
Expand All @@ -1073,7 +1097,7 @@ func (app *BaseApp) ProcessProposalVerifyTx(txBz []byte) (sdk.Tx, error) {
return nil, err
}

_, _, _, err = app.runTx(execModeProcessProposal, txBz, tx)
_, _, _, err = app.RunTx(execModeProcessProposal, txBz, tx, -1, nil, nil)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion baseapp/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var _ genesis.TxHandler = (*BaseApp)(nil)
// ExecuteGenesisTx implements genesis.GenesisState from
// cosmossdk.io/core/genesis to set initial state in genesis
func (ba *BaseApp) ExecuteGenesisTx(tx []byte) error {
res := ba.deliverTx(tx)
res := ba.deliverTx(tx, nil, -1, nil)

if res.Code != types.CodeTypeOK {
return errors.New(res.Log)
Expand Down
6 changes: 6 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/baseapp/oe"
"github.com/cosmos/cosmos-sdk/blockstm"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -124,6 +125,11 @@ func SetOptimisticExecution(opts ...func(*oe.OptimisticExecution)) func(*BaseApp
}
}

// SetBlockSTMTxRunner sets the block stm tx runner for the BaseApp for parallel execution.
func (app *BaseApp) SetBlockSTMTxRunner(txRunner blockstm.TxRunner) {
app.txRunner = txRunner
}

// DisableBlockGasMeter disables the block gas meter.
func DisableBlockGasMeter() func(*BaseApp) {
return func(app *BaseApp) { app.SetDisableBlockGasMeter(true) }
Expand Down
Loading
Loading