Skip to content

Commit d68ade9

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

Some content is hidden

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

45 files changed

+397
-392
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ABCI 2.0 (colloquially called ABCI++) allows an application to extend a pre-comm
1111
validator process. The Cosmos SDK defines [`baseapp.ExtendVoteHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/types/abci.go#L32):
1212

1313
```go
14-
type ExtendVoteHandler func(Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
14+
type ExtendVoteHandler func(Context, *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, 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.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error)
41+
type VerifyVoteExtensionHandler func(Context, *abci.VerifyVoteExtensionRequest) (*abci.VerifyVoteExtensionResponse, error)
4242
```
4343

4444
An application can set this handler in `app.go` via the `baseapp.SetVerifyVoteExtensionHandler`
@@ -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.RequestFinalizeBlock) error {
81+
app.SetPreBlocker(func(ctx sdk.Context, req *abci.FinalizeBlockRequest) 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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ We propose middleware-solution, which could help developers implement the follow
2323
* call panic for specific error cases;
2424

2525
It will also make `OutOfGas` case and `default` case one of the middlewares.
26-
`Default` case wraps recovery object to an error and logs it ([example middleware implementation](#Recovery-middleware)).
26+
`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
2929
essential that node <-> sidecar connectivity stays stable for TXs processing. So when the communication breaks we need

docs/build/architecture/adr-032-typed-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Currently in the Cosmos SDK, events are defined in the handlers for each message
2222

2323
Currently in the Cosmos SDK, events are defined in the handlers for each message, meaning each module doesn't have a cannonical set of types for each event. Above all else this makes these events difficult to consume as it requires a great deal of raw string matching and parsing. This proposal focuses on updating the events to use **typed events** defined in each module such that emiting and subscribing to events will be much easier. This workflow comes from the experience of the Akash Network team.
2424

25-
[Our platform](http://github.com/ovrclk/akash) requires a number of programatic on chain interactions both on the provider (datacenter - to bid on new orders and listen for leases created) and user (application developer - to send the app manifest to the provider) side. In addition the Akash team is now maintaining the IBC [`relayer`](https://github.com/ovrclk/relayer), another very event driven process. In working on these core pieces of infrastructure, and integrating lessons learned from Kubernetes developement, our team has developed a standard method for defining and consuming typed events in Cosmos SDK modules. We have found that it is extremely useful in building this type of event driven application.
25+
[Our platform](http://github.com/ovrclk/akash) requires a number of programatic on chain interactions both on the provider (datacenter - to bid on new orders and listen for leases created) and user (application developer - to send the app manifest to the provider) side. In addition the Akash team is now maintaining the IBC [`relayer`](https://github.com/ovrclk/relayer), another very event driven process. In working on these core pieces of infrastructure, and integrating lessons learned from Kubernetes development, our team has developed a standard method for defining and consuming typed events in Cosmos SDK modules. We have found that it is extremely useful in building this type of event driven application.
2626

2727
As the Cosmos SDK gets used more extensively for apps like `peggy`, other peg zones, IBC, DeFi, etc... there will be an exploding demand for event driven applications to support new features desired by users. We propose upstreaming our findings into the Cosmos SDK to enable all Cosmos SDK applications to quickly and easily build event driven apps to aid their core application. Wallets, exchanges, explorers, and defi protocols all stand to benefit from this work.
2828

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error
227+
ListenFinalizeBlock(ctx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) error
228228
// ListenCommit updates the steaming service with the latest Commit messages and state changes
229-
ListenCommit(ctx context.Context, res abci.ResponseCommit, changeSet []*StoreKVPair) error
229+
ListenCommit(ctx context.Context, res abci.CommitResponse, 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.RequestFinalizeBlock) abci.ResponseFinalizeBlock {
270+
func (app *BaseApp) FinalizeBlock(req abci.FinalizeBlockRequest) abci.FinalizeBlockResponse {
271271

272-
var abciRes abci.ResponseFinalizeBlock
272+
var abciRes abci.FinalizeBlockResponse
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.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) {
279+
go func(req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) {
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.RequestFinalizeBlock) abci.ResponseFi
299299
```
300300

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

304304
...
305305

306-
res := abci.ResponseCommit{
306+
res := abci.CommitResponse{
307307
Data: commitID.Hash,
308308
RetainHeight: retainHeight,
309309
}
@@ -314,7 +314,7 @@ func (app *BaseApp) Commit() abci.ResponseCommit {
314314
blockHeight := ctx.BlockHeight()
315315
changeSet := app.cms.PopStateCache()
316316
if app.abciListenersAsync {
317-
go func(res abci.ResponseCommit, changeSet []store.StoreKVPair) {
317+
go func(res abci.CommitResponse, 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.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error {
436+
func (m *GRPCClient) ListenFinalizeBlock(goCtx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) 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.ResponseCommit, changeSet []store.StoreKVPair) error {
442+
func (m *GRPCClient) ListenCommit(goCtx context.Context, res abci.CommitResponse, 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.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error {
474+
func (m *ABCIListenerPlugin) ListenFinalizeBlock(ctx context.Context, req abci.FinalizeBlockRequest, res abci.FinalizeBlockResponse) error {
475475
// send data to external system
476476
}
477477

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

docs/build/architecture/adr-040-storage-and-smt-state-commitments.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ A new database snapshot will be created in every `EndBlocker` and identified by
9292
NOTE: `Commit` must be called exactly once per block. Otherwise we risk going out of sync for the version number and block height.
9393
NOTE: For the Cosmos SDK storage, we may consider splitting that interface into `Committer` and `PruningCommitter` - only the multiroot should implement `PruningCommitter` (cache and prefix store don't need pruning).
9494

95-
Number of historical versions for `abci.RequestQuery` and state sync snapshots is part of a node configuration, not a chain configuration (configuration implied by the blockchain consensus). A configuration should allow to specify number of past blocks and number of past blocks modulo some number (eg: 100 past blocks and one snapshot every 100 blocks for past 2000 blocks). Archival nodes can keep all past versions.
95+
Number of historical versions for `abci.QueryRequest` and state sync snapshots is part of a node configuration, not a chain configuration (configuration implied by the blockchain consensus). A configuration should allow to specify number of past blocks and number of past blocks modulo some number (eg: 100 past blocks and one snapshot every 100 blocks for past 2000 blocks). Archival nodes can keep all past versions.
9696

9797
Pruning old snapshots is effectively done by a database. Whenever we update a record in `SC`, SMT won't update nodes - instead it creates new nodes on the update path, without removing the old one. Since we are snapshotting each block, we need to change that mechanism to immediately remove orphaned nodes from the database. This is a safe operation - snapshots will keep track of the records and make it available when accessing past versions.
9898

9999
To manage the active snapshots we will either use a DB _max number of snapshots_ option (if available), or we will remove DB snapshots in the `EndBlocker`. The latter option can be done efficiently by identifying snapshots with block height and calling a store function to remove past versions.
100100

101101
#### Accessing old state versions
102102

103-
One of the functional requirements is to access old state. This is done through `abci.RequestQuery` structure. The version is specified by a block height (so we query for an object by a key `K` at block height `H`). The number of old versions supported for `abci.RequestQuery` is configurable. Accessing an old state is done by using available snapshots.
104-
`abci.RequestQuery` doesn't need old state of `SC` unless the `prove=true` parameter is set. The SMT merkle proof must be included in the `abci.ResponseQuery` only if both `SC` and `SS` have a snapshot for requested version.
103+
One of the functional requirements is to access old state. This is done through `abci.QueryRequest` structure. The version is specified by a block height (so we query for an object by a key `K` at block height `H`). The number of old versions supported for `abci.QueryRequest` is configurable. Accessing an old state is done by using available snapshots.
104+
`abci.QueryRequest` doesn't need old state of `SC` unless the `prove=true` parameter is set. The SMT merkle proof must be included in the `abci.QueryResponse` only if both `SC` and `SS` have a snapshot for requested version.
105105

106106
Moreover, Cosmos SDK could provide a way to directly access a historical state. However, a state machine shouldn't do that - since the number of snapshots is configurable, it would lead to nondeterministic execution.
107107

docs/build/architecture/adr-047-extend-upgrade-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ All fields in the `UpgradeInstructions` are optional.
9595
| `30` | `pre-upgrade` command was executed but failed. This fails the entire upgrade. |
9696
| `31` | `pre-upgrade` command was executed but failed. But the command is retried until exit code `1` or `30` are returned. |
9797
If defined, then the app supervisors (e.g. Cosmovisor) MUST NOT run `app pre-run`.
98+
9899
* `post_run` is a command to run after the upgraded chain has been started. If defined, this command MUST be only executed at most once by an upgrading node.
99100
The output and exit code SHOULD be logged but SHOULD NOT affect the running of the upgraded chain.
100101
The working directory this command runs from MUST be `{DAEMON_HOME}/cosmovisor/{upgrade name}`.

docs/build/architecture/adr-050-sign-mode-textual-annex1.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ Messages that have a custom encoding, including `google.protobuf.Timestamp`, `go
195195
#### Examples
196196

197197
Message header screen is stripped, one-level of indentation removed:
198+
198199
```
199200
/cosmos.gov.v1.Vote
200201
> Proposal id: 4
@@ -210,6 +211,7 @@ Message header screen is stripped, one-level of indentation removed:
210211
```
211212

212213
Message with custom encoding:
214+
213215
```
214216
/cosmos.base.v1beta1.Coin
215217
> 10uatom
@@ -271,8 +273,9 @@ Examples:
271273
* The hexadecimal string is finally separated into groups of 4 digits, with a space `' '` as separator. If the bytes length is odd, the 2 remaining hexadecimal characters are at the end.
272274

273275
The number 35 was chosen because it is the longest length where the hashed-and-prefixed representation is longer than the original data directly formatted, using the 3 rules above. More specifically:
274-
- a 35-byte array will have 70 hex characters, plus 17 space characters, resulting in 87 characters.
275-
- byte arrays starting from length 36 will be be hashed to 32 bytes, which is 64 hex characters plus 15 spaces, and with the `SHA-256=` prefix, it takes 87 characters.
276+
277+
* a 35-byte array will have 70 hex characters, plus 17 space characters, resulting in 87 characters.
278+
* byte arrays starting from length 36 will be be hashed to 32 bytes, which is 64 hex characters plus 15 spaces, and with the `SHA-256=` prefix, it takes 87 characters.
276279
Also, secp256k1 public keys have length 33, so their Textual representation is not their hashed value, which we would like to avoid.
277280

278281
Note: Data longer than 35 bytes are not rendered in a way that can be inverted. See ADR-050's [section about invertability](./adr-050-sign-mode-textual.md#invertible-rendering) for a discussion.

docs/build/architecture/adr-054-semver-compatible-modules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ way that requires duplication and differing sets of design principles (protobuf
424424
while golang APIs would forbid it).
425425

426426
Other downsides to this approach are:
427+
427428
* no clear roadmap to supporting modules in other languages like Rust
428429
* doesn't get us any closer to proper object capability security (one of the goals of ADR 033)
429430
* ADR 033 needs to be done properly anyway for the set of use cases which do need it
@@ -447,6 +448,7 @@ languages, possibly executed within a WASM VM.
447448

448449
To declare minor API revisions of proto files, we propose the following guidelines (which were already documented
449450
in [cosmos.app.v1alpha module options](../proto/cosmos/app/v1alpha1/module.proto)):
451+
450452
* proto packages which are revised from their initial version (considered revision `0`) should include a `package`
451453
* comment in some .proto file containing the test `Revision N` at the start of a comment line where `N` is the current
452454
revision number.
@@ -522,6 +524,7 @@ func ProtoImage(protoImage []byte) Option {}
522524
```
523525

524526
This approach allows us to support several ways protobuf files might be generated:
527+
525528
* proto files generated internally to a module (use `ProtoFiles`)
526529
* the API module approach with pinned file descriptors (use `ProtoImage`)
527530
* gogo proto (use `GzippedProtoFiles`)

docs/build/architecture/adr-055-orm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ A code generator is included with the ORM which creates type safe wrappers aroun
6464
implementation and is the recommended way for modules to use the ORM.
6565

6666
The ORM tests provide a simplified bank module demonstration which illustrates:
67+
6768
* [ORM proto options](https://github.com/cosmos/cosmos-sdk/blob/0d846ae2f0424b2eb640f6679a703b52d407813d/orm/internal/testpb/bank.proto)
6869
* [Generated Code](https://github.com/cosmos/cosmos-sdk/blob/0d846ae2f0424b2eb640f6679a703b52d407813d/orm/internal/testpb/bank.cosmos_orm.go)
6970
* [Example Usage in a Module Keeper](https://github.com/cosmos/cosmos-sdk/blob/0d846ae2f0424b2eb640f6679a703b52d407813d/orm/model/ormdb/module_test.go)

docs/build/architecture/adr-057-app-wiring.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,17 @@ Code generation requires that all providers and invokers and their parameters ar
303303

304304
When we start creating semantically versioned SDK modules that are in standalone go modules, a state machine breaking
305305
change to a module should be handled as follows:
306-
- the semantic major version should be incremented, and
307-
- a new semantically versioned module config protobuf type should be created.
306+
307+
* the semantic major version should be incremented, and
308+
* a new semantically versioned module config protobuf type should be created.
308309

309310
For instance, if we have the SDK module for bank in the go module `github.com/cosmos/cosmos-sdk/x/bank` with the module config type
310311
`cosmos.bank.module.v1.Module`, and we want to make a state machine breaking change to the module, we would:
311-
- create a new go module `github.com/cosmos/cosmos-sdk/x/bank/v2`,
312-
- with the module config protobuf type `cosmos.bank.module.v2.Module`.
313312

314-
This _does not_ mean that we need to increment the protobuf API version for bank. Both modules can support
313+
* create a new go module `github.com/cosmos/cosmos-sdk/x/bank/v2`,
314+
* with the module config protobuf type `cosmos.bank.module.v2.Module`.
315+
316+
This *does not* mean that we need to increment the protobuf API version for bank. Both modules can support
315317
`cosmos.bank.v1`, but `github.com/cosmos/cosmos-sdk/x/bank/v2` will be a separate go module with a separate module config type.
316318

317319
This practice will eventually allow us to use appconfig to load new versions of a module via a configuration change.
@@ -320,7 +322,7 @@ Effectively, there should be a 1:1 correspondence between a semantically version
320322
versioned module config protobuf type, and major versioning bumps should occur whenever state machine breaking changes
321323
are made to a module.
322324

323-
NOTE: SDK modules that are standalone go modules _should not_ adopt semantic versioning until the concerns described in
325+
NOTE: SDK modules that are standalone go modules *should not* adopt semantic versioning until the concerns described in
324326
[ADR 054: Module Semantic Versioning](./adr-054-semver-compatible-modules.md) are
325327
addressed. The short-term solution for this issue was left somewhat unresolved. However, the easiest tactic is
326328
likely to use a standalone API go module and follow the guidelines described in this comment: https://github.com/cosmos/cosmos-sdk/pull/11802#issuecomment-1406815181. For the time-being, it is recommended that

0 commit comments

Comments
 (0)