Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

Commit e710d56

Browse files
tac0turtlegithub-actions[bot]
authored andcommitted
chore: Sync docs from cosmos-sdk/docs
1 parent 4845163 commit e710d56

79 files changed

Lines changed: 789 additions & 467 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/build/abci/01-prepare-proposal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The Cosmos SDK defines the `DefaultProposalHandler` type, which provides applica
2626
`PrepareProposal` and `ProcessProposal` handlers. If you decide to implement your
2727
own `PrepareProposal` handler, you must ensure that the transactions
2828
selected DO NOT exceed the maximum block gas (if set) and the maximum bytes provided
29-
by `req.MaxBytes`.
29+
by `req.MaxTxBytes`.
3030

3131
```go reference
3232
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/baseapp/abci_utils.go

docs/build/abci/03-vote-extensions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ defined in ABCI++.
88
## Extend Vote
99

1010
ABCI 2.0 (colloquially called ABCI++) allows an application to extend a pre-commit vote with arbitrary data. This process does NOT have to be deterministic, and the data returned can be unique to the
11-
validator process. The Cosmos SDK defines [`baseapp.ExtendVoteHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/types/abci.go#L32):
11+
validator process. The Cosmos SDK defines [`sdk.ExtendVoteHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/types/abci.go#L32):
1212

1313
```go
14-
type ExtendVoteHandler func(Context, *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, error)
14+
type ExtendVoteHandler func(Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
1515
```
1616

1717
An application can set this handler in `app.go` via the `baseapp.SetExtendVoteHandler`
@@ -38,7 +38,7 @@ other validators when validating their pre-commits. For a given vote extension,
3838
this process MUST be deterministic. The Cosmos SDK defines [`sdk.VerifyVoteExtensionHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/types/abci.go#L29-L31):
3939

4040
```go
41-
type VerifyVoteExtensionHandler func(Context, *abci.VerifyVoteExtensionRequest) (*abci.VerifyVoteExtensionResponse, error)
41+
type VerifyVoteExtensionHandler func(Context, *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error)
4242
```
4343

4444
An application can set this handler in `app.go` via the `baseapp.SetVerifyVoteExtensionHandler`
@@ -49,7 +49,7 @@ validators will share the same view of what vote extensions they verify dependin
4949
on how votes are propagated. See [here](https://github.com/cometbft/cometbft/blob/v0.38.0-rc1/spec/abci/abci++_methods.md#verifyvoteextension)
5050
for more details.
5151

52-
Additionally, please keep in mind that performance can be degraded if vote extensions are too big (https://docs.cometbft.com/v0.38/qa/cometbft-qa-38#vote-extensions-testbed), so we highly recommend a size validation in `VerifyVoteExtensions`.
52+
Additionally, please keep in mind that performance can be degraded if vote extensions are too big (https://docs.cometbft.com/v0.38/qa/cometbft-qa-38#vote-extensions-testbed), so we highly recommend a size validation in `ValidateVoteExtensions`.
5353

5454

5555
## Vote Extension Propagation
@@ -78,7 +78,7 @@ will be available to the application during the subsequent `FinalizeBlock` call.
7878
An example of how a pre-FinalizeBlock hook could look like is shown below:
7979

8080
```go
81-
app.SetPreBlocker(func(ctx sdk.Context, req *abci.FinalizeBlockRequest) error {
81+
app.SetPreBlocker(func(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
8282
allVEs := []VE{} // store all parsed vote extensions here
8383
for _, tx := range req.Txs {
8484
// define a custom function that tries to parse the tx as a vote extension
@@ -95,10 +95,10 @@ app.SetPreBlocker(func(ctx sdk.Context, req *abci.FinalizeBlockRequest) error {
9595
result := compute(allVEs)
9696
err := storeVEResult(ctx, result)
9797
if err != nil {
98-
return err
98+
return nil, err
9999
}
100100

101-
return nil
101+
return &sdk.ResponsePreBlock{}, nil
102102
})
103103

104104
```

docs/build/abci/04-checktx.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ https://github.com/cosmos/cosmos-sdk/blob/31c604762a434c7b676b6a89897ecbd7c4653a
2020

2121
## CheckTx Handler
2222

23-
`CheckTxHandler` allows users to extend the logic of `CheckTx`. `CheckTxHandler` is called by passing context and the transaction bytes received through ABCI. It is required that the handler returns deterministic results given the same transaction bytes.
24-
25-
:::note
26-
we return the raw decoded transaction here to avoid decoding it twice.
27-
:::
23+
`CheckTxHandler` allows applications to extend the logic of `CheckTx`. It is invoked with the ABCI request and a `RunTx` function that executes the standard `CheckTx` pipeline (ante handlers, gas accounting and mempool interaction). The implementation of `CheckTxHandler` MUST be deterministic for a given `RequestCheckTx`.
2824

2925
```go
30-
type CheckTxHandler func(ctx sdk.Context, tx []byte) (Tx, error)
26+
type CheckTxHandler func(RunTx, *abci.RequestCheckTx) (*abci.ResponseCheckTx, error)
3127
```
3228

33-
Setting a custom `CheckTxHandler` is optional. It can be done from your app.go file:
29+
The provided `RunTx` function does not override ante handlers and does not allow changing the execution mode; it simply runs the transaction through the normal `CheckTx` path and returns the result that can be used to construct a `ResponseCheckTx`.
30+
31+
Setting a custom `CheckTxHandler` is optional. It can be done from your `app.go` file by setting the handler on `BaseApp`:
3432

3533
```go
3634
func NewSimApp(
@@ -41,10 +39,16 @@ func NewSimApp(
4139
appOpts servertypes.AppOptions,
4240
baseAppOptions ...func(*baseapp.BaseApp),
4341
) *SimApp {
44-
...
45-
// Create ChecktxHandler
46-
checktxHandler := abci.NewCustomCheckTxHandler(...)
47-
app.SetCheckTxHandler(checktxHandler)
48-
...
42+
...
43+
checkTxOpt := func(app *baseapp.BaseApp) {
44+
app.SetCheckTxHandler(func(runTx sdk.RunTx, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) {
45+
// custom pre- or post-processing logic can be added here
46+
return runTx(req.Tx, nil)
47+
})
48+
}
49+
baseAppOptions = append(baseAppOptions, checkTxOpt)
50+
...
4951
}
5052
```
53+
54+
When `RequestCheckTx.Type` is `abci.CheckTxType_New`, the transaction is evaluated for admission into the mempool; when it is `abci.CheckTxType_Recheck`, the existing mempool transaction is re-evaluated and may be removed if it no longer passes validation. Successful `CheckTx` executions update an internal CheckTx state, which is reset when a block is committed.

docs/build/architecture/adr-006-secret-store-replacement.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This is not desirable for a number of reasons. Perhaps the biggest reason is ins
1515

1616
All modern desktop computers OS (Ubuntu, Debian, MacOS, Windows) provide a built-in secret store that is designed to allow applications to store information that is isolated from all other applications and requires passphrase entry to access the data.
1717

18-
We are seeking solution that provides a common abstraction layer to the many different backends and reasonable fallback for minimal platforms that don’t provide a native secret store.
18+
We are seeking a solution that provides a common abstraction layer to the many different backends and reasonable fallback for minimal platforms that don’t provide a native secret store.
1919

2020
## Decision
2121

docs/build/architecture/adr-013-metrics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Proposed
1010

1111
## Context
1212

13-
Telemetry is paramount into debugging and understanding what the application is doing and how it is
13+
Telemetry is paramount to debugging and understanding what the application is doing and how it is
1414
performing. We aim to expose metrics from modules and other core parts of the Cosmos SDK.
1515

1616
In addition, we should aim to support multiple configurable sinks that an operator may choose from.
1717
By default, when telemetry is enabled, the application should track and expose metrics that are
1818
stored in-memory. The operator may choose to enable additional sinks, where we support only
19-
[Prometheus](https://prometheus.io/) for now, as it's battle-tested, simple to setup, open source,
19+
[Prometheus](https://prometheus.io/) for now, as it's battle-tested, simple to set up, open source,
2020
and is rich with ecosystem tooling.
2121

2222
We must also aim to integrate metrics into the Cosmos SDK in the most seamless way possible such that
@@ -41,7 +41,7 @@ We will add an additional configuration block to `app.toml` that defines telemet
4141
service-name = {{ .Telemetry.ServiceName }}
4242

4343
# Enabled enables the application telemetry functionality. When enabled,
44-
# an in-memory sink is also enabled by default. Operators may also enabled
44+
# an in-memory sink is also enabled by default. Operators may also enable
4545
# other sinks such as Prometheus.
4646
enabled = {{ .Telemetry.Enabled }}
4747

docs/build/architecture/adr-022-custom-panic-handling.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ It will also make `OutOfGas` case and `default` case one of the middlewares.
2626
`Default` case wraps recovery object to an error and logs it ([example middleware implementation](#recovery-middleware)).
2727

2828
Our project has a sidecar service running alongside the blockchain node (smart contracts virtual machine). It is
29-
essential that node <-> sidecar connectivity stays stable for TXs processing. So when the communication breaks we need
30-
to crash the node and reboot it once the problem is solved. That behaviour makes the node's state machine execution
29+
essential that node <-> sidecar connectivity stays stable for TXs processing. So when the communication breaks, we need
30+
to crash the node and reboot it once the problem is solved. That behavior makes the node's state machine execution
3131
deterministic. As all keeper panics are caught by runTx's `defer()` handler, we have to adjust the BaseApp code
3232
in order to customize it.
3333

@@ -97,7 +97,7 @@ Function receives a `recoveryObj` object and returns:
9797
* (next `recoveryMiddleware`, `nil`) if object wasn't handled (not a target type) by `RecoveryHandler`;
9898
* (`nil`, not nil `error`) if input object was handled and other middlewares in the chain should not be executed;
9999
* (`nil`, `nil`) in case of invalid behavior. Panic recovery might not have been properly handled;
100-
this can be avoided by always using a `default` as a rightmost middleware in the chain (always returns an `error`');
100+
this can be avoided by always using a `default` as a rightmost middleware in the chain (always returns an `error`);
101101

102102
`OutOfGas` middleware example:
103103

@@ -153,7 +153,7 @@ That way we can create a middleware chain which is executed from left to right,
153153

154154
##### BaseApp changes
155155

156-
The `default` middleware chain must exist in a `BaseApp` object. `Baseapp` modifications:
156+
The `default` middleware chain must exist in a `BaseApp` object. `BaseApp` modifications:
157157

158158
```go
159159
type BaseApp struct {

docs/build/architecture/adr-030-authz-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The concrete use cases which motivated this module include:
2525
delegated stake
2626
* "sub-keys" functionality, as originally proposed in [\#4480](https://github.com/cosmos/cosmos-sdk/issues/4480) which
2727
is a term used to describe the functionality provided by this module together with
28-
the `fee_grant` module from [ADR 029](./adr-029-fee-grant-module.md) and the [group module](https://github.com/cosmos/cosmos-sdk/tree/main/x/group).
28+
the `fee_grant` module from [ADR 029](./adr-029-fee-grant-module.md) and the [group module](https://github.com/cosmos/cosmos-sdk/tree/main/contrib/x/group).
2929

3030
The "sub-keys" functionality roughly refers to the ability for one account to grant some subset of its capabilities to
3131
other accounts with possibly less robust, but easier to use security measures. For instance, a master account representing

docs/build/architecture/adr-038-state-listening.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* 10/14/2022:
88
* Add `ListenCommit`, flatten the state writes in a block to a single batch.
99
* Remove listeners from cache stores, should only listen to `rootmulti.Store`.
10-
* Remove `HaltAppOnDeliveryError()`, the errors are propagated by default, the implementations should return nil if they don't want to propagate errors.
10+
* Remove `HaltAppOnDeliveryError()`, the errors are propagated by default, the implementations should return nil if don't want to propagate errors.
1111
* 26/05/2023: Update with ABCI 2.0
1212

1313
## Status
@@ -20,7 +20,7 @@ This ADR defines a set of changes to enable listening to state changes of indivi
2020

2121
## Context
2222

23-
Currently, KVStore data can be remotely accessed through [Queries](https://docs.cosmos.network/main/build/building-modules/messages-and-queries#queries)
23+
Currently, KVStore data can be remotely accessed through [Queries](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/messages-and-queries.md#queries)
2424
which proceed either through Tendermint and the ABCI, or through the gRPC server.
2525
In addition to these request/response queries, it would be beneficial to have a means of listening to state changes as they occur in real time.
2626

@@ -40,7 +40,7 @@ type MemoryListener struct {
4040
stateCache []StoreKVPair
4141
}
4242

43-
// NewMemoryListener creates a listener that accumulates the state writes in memory.
43+
// NewMemoryListener creates a listener that accumulate the state writes in memory.
4444
func NewMemoryListener() *MemoryListener {
4545
return &MemoryListener{}
4646
}
@@ -114,7 +114,7 @@ func (s *Store) Delete(key []byte) {
114114

115115
### MultiStore interface updates
116116

117-
We will update the `CommitMultiStore` interface to allow us to wrap a `MemoryListener` to a specific `KVStore`.
117+
We will update the `CommitMultiStore` interface to allow us to wrap a `Memorylistener` to a specific `KVStore`.
118118
Note that the `MemoryListener` will be attached internally by the concrete `rootmulti` implementation.
119119

120120
```go
@@ -224,9 +224,9 @@ so that the service can group the state changes with the ABCI requests.
224224
// ABCIListener is the interface that we're exposing as a streaming service.
225225
type ABCIListener interface {
226226
// ListenFinalizeBlock updates the streaming service with the latest FinalizeBlock messages
227-
ListenFinalizeBlock(ctx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) error
228-
// ListenCommit updates the streaming service with the latest Commit messages and state changes
229-
ListenCommit(ctx context.Context, res abci.CommitResponse, changeSet []*StoreKVPair) error
227+
ListenFinalizeBlock(ctx context.Context, req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error
228+
// ListenCommit updates the steaming service with the latest Commit messages and state changes
229+
ListenCommit(ctx context.Context, res abci.ResponseCommit, changeSet []*StoreKVPair) error
230230
}
231231
```
232232

@@ -267,16 +267,16 @@ We will modify the `FinalizeBlock` and `Commit` methods to pass ABCI requests an
267267
to any streaming service hooks registered with the `BaseApp`.
268268

269269
```go
270-
func (app *BaseApp) FinalizeBlock(req abci.FinalizeBlockRequest) abci.FinalizeBlockResponse {
270+
func (app *BaseApp) FinalizeBlock(req abci.RequestFinalizeBlock) abci.ResponseFinalizeBlock {
271271

272-
var abciRes abci.FinalizeBlockResponse
272+
var abciRes abci.ResponseFinalizeBlock
273273
defer func() {
274274
// call the streaming service hook with the FinalizeBlock messages
275275
for _, abciListener := range app.abciListeners {
276276
ctx := app.finalizeState.ctx
277277
blockHeight := ctx.BlockHeight()
278278
if app.abciListenersAsync {
279-
go func(req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) {
279+
go func(req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) {
280280
if err := app.abciListener.FinalizeBlock(blockHeight, req, res); err != nil {
281281
app.logger.Error("FinalizeBlock listening hook failed", "height", blockHeight, "err", err)
282282
}
@@ -299,11 +299,11 @@ func (app *BaseApp) FinalizeBlock(req abci.FinalizeBlockRequest) abci.FinalizeBl
299299
```
300300

301301
```go
302-
func (app *BaseApp) Commit() abci.CommitResponse {
302+
func (app *BaseApp) Commit() abci.ResponseCommit {
303303

304304
...
305305

306-
res := abci.CommitResponse{
306+
res := abci.ResponseCommit{
307307
Data: commitID.Hash,
308308
RetainHeight: retainHeight,
309309
}
@@ -314,7 +314,7 @@ func (app *BaseApp) Commit() abci.CommitResponse {
314314
blockHeight := ctx.BlockHeight()
315315
changeSet := app.cms.PopStateCache()
316316
if app.abciListenersAsync {
317-
go func(res abci.CommitResponse, changeSet []store.StoreKVPair) {
317+
go func(res abci.ResponseCommit, changeSet []store.StoreKVPair) {
318318
if err := app.abciListener.ListenCommit(ctx, res, changeSet); err != nil {
319319
app.logger.Error("ListenCommit listening hook failed", "height", blockHeight, "err", err)
320320
}
@@ -433,13 +433,13 @@ type GRPCClient struct {
433433
client ABCIListenerServiceClient
434434
}
435435

436-
func (m *GRPCClient) ListenFinalizeBlock(goCtx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) error {
436+
func (m *GRPCClient) ListenFinalizeBlock(goCtx context.Context, req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error {
437437
ctx := sdk.UnwrapSDKContext(goCtx)
438438
_, err := m.client.ListenDeliverTx(ctx, &ListenDeliverTxRequest{BlockHeight: ctx.BlockHeight(), Req: req, Res: res})
439439
return err
440440
}
441441

442-
func (m *GRPCClient) ListenCommit(goCtx context.Context, res abci.CommitResponse, changeSet []store.StoreKVPair) error {
442+
func (m *GRPCClient) ListenCommit(goCtx context.Context, res abci.ResponseCommit, changeSet []store.StoreKVPair) error {
443443
ctx := sdk.UnwrapSDKContext(goCtx)
444444
_, err := m.client.ListenCommit(ctx, &ListenCommitRequest{BlockHeight: ctx.BlockHeight(), Res: res, ChangeSet: changeSet})
445445
return err
@@ -471,11 +471,11 @@ And the pre-compiled Go plugin `Impl`(*this is only used for plugins that are wr
471471
// ABCIListener is the implementation of the baseapp.ABCIListener interface
472472
type ABCIListener struct{}
473473

474-
func (m *ABCIListenerPlugin) ListenFinalizeBlock(ctx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) error {
474+
func (m *ABCIListenerPlugin) ListenFinalizeBlock(ctx context.Context, req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error {
475475
// send data to external system
476476
}
477477

478-
func (m *ABCIListenerPlugin) ListenCommit(ctx context.Context, res abci.CommitResponse, changeSet []store.StoreKVPair) error {
478+
func (m *ABCIListenerPlugin) ListenCommit(ctx context.Context, res abci.ResponseCommit, changeSet []store.StoreKVPair) error {
479479
// send data to external system
480480
}
481481

@@ -529,7 +529,7 @@ func NewStreamingPlugin(name string, logLevel string) (interface{}, error) {
529529

530530
We propose a `RegisterStreamingPlugin` function for the App to register `NewStreamingPlugin`s with the App's BaseApp.
531531
Streaming plugins can be of `Any` type; therefore, the function takes in an interface vs a concrete type.
532-
For example, we could have plugins of `ABCIListener`, `WasmListener` or `IBCListener`. Note that `RegisterStreamingPlugin` function
532+
For example, we could have plugins of `ABCIListener`, `WasmListener` or `IBCListener`. Note that `RegisterStreamingPluing` function
533533
is helper function and not a requirement. Plugin registration can easily be moved from the App to the BaseApp directly.
534534

535535
```go
@@ -720,5 +720,5 @@ These changes will provide a means of subscribing to KVStore state changes in re
720720
721721
### Neutral
722722
723-
* Introduces additionalbut optionalcomplexity to configuring and running a cosmos application
723+
* Introduces additional- but optional- complexity to configuring and running a cosmos application
724724
* If an application developer opts to use these features to expose data, they need to be aware of the ramifications/risks of that data exposure as it pertains to the specifics of their application

0 commit comments

Comments
 (0)