Skip to content

Commit

Permalink
docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Sep 21, 2023
1 parent a506ebb commit 67e8ba3
Show file tree
Hide file tree
Showing 69 changed files with 1,090 additions and 539 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dependencies
/node_modules
/cosmos-sdk
./cosmos-sdk

# production
/build
Expand Down
2 changes: 1 addition & 1 deletion docs/build/architecture/PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Copy the `adr-template.md` file. Use the following filename pattern: `adr-next_number-title.md`
2. Create a draft Pull Request if you want to get an early feedback.
3. Make sure the context and a solution is clear and well documented.
4. Add an entry to a list in the [README](README.md) file.
4. Add an entry to a list in the [README](./README.md) file.
5. Create a Pull Request to propose a new ADR.

## What is an ADR?
Expand Down
90 changes: 46 additions & 44 deletions docs/build/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If recorded decisions turned out to be lacking, convene a discussion, record the

## Creating new ADR

Read about the [PROCESS](PROCESS.md).
Read about the [PROCESS](./PROCESS.md).

### Use RFC 2119 Keywords

Expand All @@ -42,53 +42,55 @@ When writing ADRs, follow the same best practices for writing RFCs. When writing

### Accepted

* [ADR 002: SDK Documentation Structure](adr-002-docs-structure.md)
* [ADR 004: Split Denomination Keys](adr-004-split-denomination-keys.md)
* [ADR 006: Secret Store Replacement](adr-006-secret-store-replacement.md)
* [ADR 009: Evidence Module](adr-009-evidence-module.md)
* [ADR 010: Modular AnteHandler](adr-010-modular-antehandler.md)
* [ADR 019: Protocol Buffer State Encoding](adr-019-protobuf-state-encoding.md)
* [ADR 020: Protocol Buffer Transaction Encoding](adr-020-protobuf-transaction-encoding.md)
* [ADR 021: Protocol Buffer Query Encoding](adr-021-protobuf-query-encoding.md)
* [ADR 023: Protocol Buffer Naming and Versioning](adr-023-protobuf-naming.md)
* [ADR 029: Fee Grant Module](adr-029-fee-grant-module.md)
* [ADR 030: Message Authorization Module](adr-030-authz-module.md)
* [ADR 031: Protobuf Msg Services](adr-031-msg-service.md)
* [ADR 055: ORM](adr-055-orm.md)
* [ADR 058: Auto-Generated CLI](adr-058-auto-generated-cli.md)
* [ADR 002: SDK Documentation Structure](./adr-002-docs-structure.md)
* [ADR 004: Split Denomination Keys](./adr-004-split-denomination-keys.md)
* [ADR 006: Secret Store Replacement](./adr-006-secret-store-replacement.md)
* [ADR 009: Evidence Module](./adr-009-evidence-module.md)
* [ADR 010: Modular AnteHandler](./adr-010-modular-antehandler.md)
* [ADR 019: Protocol Buffer State Encoding](./adr-019-protobuf-state-encoding.md)
* [ADR 020: Protocol Buffer Transaction Encoding](./adr-020-protobuf-transaction-encoding.md)
* [ADR 021: Protocol Buffer Query Encoding](./adr-021-protobuf-query-encoding.md)
* [ADR 023: Protocol Buffer Naming and Versioning](./adr-023-protobuf-naming.md)
* [ADR 024: Coin Metadata](./adr-024-coin-metadata.md)
* [ADR 029: Fee Grant Module](./adr-029-fee-grant-module.md)
* [ADR 030: Message Authorization Module](./adr-030-authz-module.md)
* [ADR 031: Protobuf Msg Services](./adr-031-msg-service.md)
* [ADR 046: Module Params](./adr-046-module-params.md)
* [ADR 055: ORM](./adr-055-orm.md)
* [ADR 058: Auto-Generated CLI](./adr-058-auto-generated-cli.md)
* [ADR 060: ABCI 1.0 (Phase I)](adr-060-abci-1.0.md)
* [ADR 061: Liquid Staking](adr-061-liquid-staking.md)
* [ADR 061: Liquid Staking](./adr-061-liquid-staking.md)

### Proposed

* [ADR 003: Dynamic Capability Store](adr-003-dynamic-capability-store.md)
* [ADR 011: Generalize Genesis Accounts](adr-011-generalize-genesis-accounts.md)
* [ADR 012: State Accessors](adr-012-state-accessors.md)
* [ADR 013: Metrics](adr-013-metrics.md)
* [ADR 016: Validator Consensus Key Rotation](adr-016-validator-consensus-key-rotation.md)
* [ADR 017: Historical Header Module](adr-017-historical-header-module.md)
* [ADR 018: Extendable Voting Periods](adr-018-extendable-voting-period.md)
* [ADR 022: Custom baseapp panic handling](adr-022-custom-panic-handling.md)
* [ADR 024: Coin Metadata](adr-024-coin-metadata.md)
* [ADR 027: Deterministic Protobuf Serialization](adr-027-deterministic-protobuf-serialization.md)
* [ADR 028: Public Key Addresses](adr-028-public-key-addresses.md)
* [ADR 032: Typed Events](adr-032-typed-events.md)
* [ADR 033: Inter-module RPC](adr-033-protobuf-inter-module-comm.md)
* [ADR 035: Rosetta API Support](adr-035-rosetta-api-support.md)
* [ADR 037: Governance Split Votes](adr-037-gov-split-vote.md)
* [ADR 038: State Listening](adr-038-state-listening.md)
* [ADR 039: Epoched Staking](adr-039-epoched-staking.md)
* [ADR 040: Storage and SMT State Commitments](adr-040-storage-and-smt-state-commitments.md)
* [ADR 046: Module Params](adr-046-module-params.md)
* [ADR 054: Semver Compatible SDK Modules](adr-054-semver-compatible-modules.md)
* [ADR 057: App Wiring](adr-057-app-wiring.md)
* [ADR 059: Test Scopes](adr-059-test-scopes.md)
* [ADR 062: Collections State Layer](adr-062-collections-state-layer.md)
* [ADR 063: Core Module API](adr-063-core-module-api.md)
* [ADR 065: Store V2](adr-065-store-v2.md)
* [ADR 003: Dynamic Capability Store](./adr-003-dynamic-capability-store.md)
* [ADR 011: Generalize Genesis Accounts](./adr-011-generalize-genesis-accounts.md)
* [ADR 012: State Accessors](./adr-012-state-accessors.md)
* [ADR 013: Metrics](./adr-013-metrics.md)
* [ADR 016: Validator Consensus Key Rotation](./adr-016-validator-consensus-key-rotation.md)
* [ADR 017: Historical Header Module](./adr-017-historical-header-module.md)
* [ADR 018: Extendable Voting Periods](./adr-018-extendable-voting-period.md)
* [ADR 022: Custom baseapp panic handling](./adr-022-custom-panic-handling.md)
* [ADR 027: Deterministic Protobuf Serialization](./adr-027-deterministic-protobuf-serialization.md)
* [ADR 028: Public Key Addresses](./adr-028-public-key-addresses.md)
* [ADR 032: Typed Events](./adr-032-typed-events.md)
* [ADR 033: Inter-module RPC](./adr-033-protobuf-inter-module-comm.md)
* [ADR 035: Rosetta API Support](./adr-035-rosetta-api-support.md)
* [ADR 037: Governance Split Votes](./adr-037-gov-split-vote.md)
* [ADR 038: State Listening](./adr-038-state-listening.md)
* [ADR 039: Epoched Staking](./adr-039-epoched-staking.md)
* [ADR 040: Storage and SMT State Commitments](./adr-040-storage-and-smt-state-commitments.md)
* [ADR 054: Semver Compatible SDK Modules](./adr-054-semver-compatible-modules.md)
* [ADR 057: App Wiring](./adr-057-app-wiring.md)
* [ADR 059: Test Scopes](./adr-059-test-scopes.md)
* [ADR 062: Collections State Layer](./adr-062-collections-state-layer.md)
* [ADR 063: Core Module API](./adr-063-core-module-api.md)
* [ADR 065: Store v2](./adr-065-store-v2.md)
* [ADR 067: Simulator v2](./adr-067-simulator-v2.md)

### Draft

* [ADR 044: Guidelines for Updating Protobuf Definitions](adr-044-protobuf-updates-guidelines.md)
* [ADR 047: Extend Upgrade Plan](adr-047-extend-upgrade-plan.md)
* [ADR 053: Go Module Refactoring](adr-053-go-module-refactoring.md)
* [ADR 044: Guidelines for Updating Protobuf Definitions](./adr-044-protobuf-updates-guidelines.md)
* [ADR 047: Extend Upgrade Plan](./adr-047-extend-upgrade-plan.md)
* [ADR 053: Go Module Refactoring](./adr-053-go-module-refactoring.md)
* [ADR 068: Preblock](./adr-068-preblock.md)
2 changes: 1 addition & 1 deletion docs/build/architecture/adr-007-specialization-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ type SpecializationGroup interface {

## References

* [dCERT ADR](adr-008-dCERT-group.md)
* [dCERT ADR](./adr-008-dCERT-group.md)
4 changes: 2 additions & 2 deletions docs/build/architecture/adr-008-dCERT-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ vulnerability being patched on the live network.
## Decision

The dCERT group is proposed to include an implementation of a `SpecializationGroup`
as defined in [ADR 007](adr-007-specialization-groups.md). This will include the
as defined in [ADR 007](./adr-007-specialization-groups.md). This will include the
implementation of:

* continuous voting
Expand Down Expand Up @@ -168,4 +168,4 @@ they should all be severely slashed.

## References

[Specialization Groups ADR](adr-007-specialization-groups.md)
[Specialization Groups ADR](./adr-007-specialization-groups.md)
2 changes: 1 addition & 1 deletion docs/build/architecture/adr-013-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and is rich with ecosystem tooling.

We must also aim to integrate metrics into the Cosmos SDK in the most seamless way possible such that
metrics may be added or removed at will and without much friction. To do this, we will use the
[go-metrics](https://github.com/armon/go-metrics) library.
[go-metrics](https://github.com/hashicorp/go-metrics) library.

Finally, operators may enable telemetry along with specific configuration options. If enabled, metrics
will be exposed via `/metrics?format={text|prometheus}` via the API server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Accepted
## Context

This ADR is a continuation of the motivation, design, and context established in
[ADR 019](adr-019-protobuf-state-encoding.md), namely, we aim to design the
[ADR 019](./adr-019-protobuf-state-encoding.md), namely, we aim to design the
Protocol Buffer migration path for the client-side of the Cosmos SDK.

Specifically, the client-side migration path primarily includes tx generation and
Expand Down Expand Up @@ -205,7 +205,7 @@ message SignDoc {
In order to sign in the default mode, clients take the following steps:

1. Serialize `TxBody` and `AuthInfo` using any valid protobuf implementation.
2. Create a `SignDoc` and serialize it using [ADR 027](adr-027-deterministic-protobuf-serialization.md).
2. Create a `SignDoc` and serialize it using [ADR 027](./adr-027-deterministic-protobuf-serialization.md).
3. Sign the encoded `SignDoc` bytes.
4. Build a `TxRaw` and serialize it for broadcasting.

Expand All @@ -221,7 +221,7 @@ Signature verifiers do:
3. For each required signer:
* Pull account number and sequence from the state.
* Obtain the public key either from state or `AuthInfo`'s `signer_infos`.
* Create a `SignDoc` and serialize it using [ADR 027](adr-027-deterministic-protobuf-serialization.md).
* Create a `SignDoc` and serialize it using [ADR 027](./adr-027-deterministic-protobuf-serialization.md).
* Verify the signature at the same list position against the serialized `SignDoc`.

#### `SIGN_MODE_LEGACY_AMINO`
Expand Down Expand Up @@ -312,7 +312,7 @@ enforce this.

Currently, the REST and CLI handlers encode and decode types and txs via Amino
JSON encoding using a concrete Amino codec. Being that some of the types dealt with
in the client can be interfaces, similar to how we described in [ADR 019](adr-019-protobuf-state-encoding.md),
in the client can be interfaces, similar to how we described in [ADR 019](./adr-019-protobuf-state-encoding.md),
the client logic will now need to take a codec interface that knows not only how
to handle all the types, but also knows how to generate transactions, signatures,
and messages.
Expand Down
6 changes: 3 additions & 3 deletions docs/build/architecture/adr-021-protobuf-query-encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Accepted
## Context

This ADR is a continuation of the motivation, design, and context established in
[ADR 019](adr-019-protobuf-state-encoding.md) and
[ADR 020](adr-020-protobuf-transaction-encoding.md), namely, we aim to design the
[ADR 019](./adr-019-protobuf-state-encoding.md) and
[ADR 020](./adr-020-protobuf-transaction-encoding.md), namely, we aim to design the
Protocol Buffer migration path for the client-side of the Cosmos SDK.

This ADR continues from [ADD 020](adr-020-protobuf-transaction-encoding.md)
This ADR continues from [ADD 020](./adr-020-protobuf-transaction-encoding.md)
to specify the encoding of queries.

## Decision
Expand Down
2 changes: 1 addition & 1 deletion docs/build/architecture/adr-022-custom-panic-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We propose middleware-solution, which could help developers implement the follow
* call panic for specific error cases;

It will also make `OutOfGas` case and `default` case one of the middlewares.
`Default` case wraps recovery object to an error and logs it ([example middleware implementation](#recovery-middleware)).
`Default` case wraps recovery object to an error and logs it ([example middleware implementation](#Recovery-middleware)).

Our project has a sidecar service running alongside the blockchain node (smart contracts virtual machine). It is
essential that node <-> sidecar connectivity stays stable for TXs processing. So when the communication breaks we need
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ other cases as well.

For signature verification in Cosmos SDK, the signer and verifier need to agree on
the same serialization of a `SignDoc` as defined in
[ADR-020](adr-020-protobuf-transaction-encoding.md) without transmitting the
[ADR-020](./adr-020-protobuf-transaction-encoding.md) without transmitting the
serialization.

Currently, for block signatures we are using a workaround: we create a new [TxRaw](https://github.com/cosmos/cosmos-sdk/blob/9e85e81e0e8140067dd893421290c191529c148c/proto/cosmos/tx/v1beta1/tx.proto#L30)
Expand Down
2 changes: 1 addition & 1 deletion docs/build/architecture/adr-030-authz-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The concrete use cases which motivated this module include:
delegated stake
* "sub-keys" functionality, as originally proposed in [\#4480](https://github.com/cosmos/cosmos-sdk/issues/4480) which
is a term used to describe the functionality provided by this module together with
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).
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).

The "sub-keys" functionality roughly refers to the ability for one account to grant some subset of its capabilities to
other accounts with possibly less robust, but easier to use security measures. For instance, a master account representing
Expand Down
10 changes: 5 additions & 5 deletions docs/build/architecture/adr-031-msg-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ One consequence of this convention is that each `Msg` type can be the request pa

### Encoding

Encoding of transactions generated with `Msg` services do not differ from current Protobuf transaction encoding as defined in [ADR-020](adr-020-protobuf-transaction-encoding.md). We are encoding `Msg` types (which are exactly `Msg` service methods' request parameters) as `Any` in `Tx`s which involves packing the
Encoding of transactions generated with `Msg` services do not differ from current Protobuf transaction encoding as defined in [ADR-020](./adr-020-protobuf-transaction-encoding.md). We are encoding `Msg` types (which are exactly `Msg` service methods' request parameters) as `Any` in `Tx`s which involves packing the
binary-encoded `Msg` with its type URL.

### Decoding

Since `Msg` types are packed into `Any`, decoding transactions messages are done by unpacking `Any`s into `Msg` types. For more information, please refer to [ADR-020](adr-020-protobuf-transaction-encoding.md#transactions).
Since `Msg` types are packed into `Any`, decoding transactions messages are done by unpacking `Any`s into `Msg` types. For more information, please refer to [ADR-020](./adr-020-protobuf-transaction-encoding.md#transactions).

### Routing

Expand All @@ -122,7 +122,7 @@ For backward compatability, the old handlers are not removed yet. If BaseApp rec

### Module Configuration

In [ADR 021](adr-021-protobuf-query-encoding.md), we introduced a method `RegisterQueryService`
In [ADR 021](./adr-021-protobuf-query-encoding.md), we introduced a method `RegisterQueryService`
to `AppModule` which allows for modules to register gRPC queriers.

To register `Msg` services, we attempt a more extensible approach by converting `RegisterQueryService`
Expand Down Expand Up @@ -198,5 +198,5 @@ Finally, closing a module to client API opens desirable OCAP patterns discussed
* [Initial Github Issue \#7122](https://github.com/cosmos/cosmos-sdk/issues/7122)
* [proto 3 Language Guide: Defining Services](https://developers.google.com/protocol-buffers/docs/proto3#services)
* [Initial pre-`Any` `Msg` designs](https://docs.google.com/document/d/1eEgYgvgZqLE45vETjhwIw4VOqK-5hwQtZtjVbiXnIGc)
* [ADR 020](adr-020-protobuf-transaction-encoding.md)
* [ADR 021](adr-021-protobuf-query-encoding.md)
* [ADR 020](./adr-020-protobuf-transaction-encoding.md)
* [ADR 021](./adr-021-protobuf-query-encoding.md)
22 changes: 11 additions & 11 deletions docs/build/architecture/adr-033-protobuf-inter-module-comm.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Proposed
## Abstract

This ADR introduces a system for permissioned inter-module communication leveraging the protobuf `Query` and `Msg`
service definitions defined in [ADR 021](adr-021-protobuf-query-encoding.md) and
[ADR 031](adr-031-msg-service.md) which provides:
service definitions defined in [ADR 021](./adr-021-protobuf-query-encoding.md) and
[ADR 031](./adr-031-msg-service.md) which provides:

* stable protobuf based module interfaces to potentially later replace the keeper paradigm
* stronger inter-module object capabilities (OCAPs) guarantees
Expand Down Expand Up @@ -48,7 +48,7 @@ just a simple string. So the `x/upgrade` module could mint tokens for the `x/sta

## Decision

Based on [ADR-021](adr-021-protobuf-query-encoding.md) and [ADR-031](adr-031-msg-service.md), we introduce the
Based on [ADR-021](./adr-021-protobuf-query-encoding.md) and [ADR-031](./adr-031-msg-service.md), we introduce the
Inter-Module Communication framework for secure module authorization and OCAPs.
When implemented, this could also serve as an alternative to the existing paradigm of passing keepers between
modules. The approach outlined here-in is intended to form the basis of a Cosmos SDK v1.0 that provides the necessary
Expand All @@ -60,8 +60,8 @@ addressed as amendments to this ADR.

### New "Keeper" Paradigm

In [ADR 021](adr-021-protobuf-query-encoding.md), a mechanism for using protobuf service definitions to define queriers
was introduced and in [ADR 31](adr-031-msg-service.md), a mechanism for using protobuf service to define `Msg`s was added.
In [ADR 021](./adr-021-protobuf-query-encoding.md), a mechanism for using protobuf service definitions to define queriers
was introduced and in [ADR 31](./adr-031-msg-service.md), a mechanism for using protobuf service to define `Msg`s was added.
Protobuf service definitions generate two golang interfaces representing the client and server sides of a service plus
some helper code. Here is a minimal example for the bank `cosmos.bank.Msg/Send` message type:

Expand All @@ -77,7 +77,7 @@ type MsgServer interface {
}
```

[ADR 021](adr-021-protobuf-query-encoding.md) and [ADR 31](adr-031-msg-service.md) specifies how modules can implement the generated `QueryServer`
[ADR 021](./adr-021-protobuf-query-encoding.md) and [ADR 31](./adr-031-msg-service.md) specifies how modules can implement the generated `QueryServer`
and `MsgServer` interfaces as replacements for the legacy queriers and `Msg` handlers respectively.

In this ADR we explain how modules can make queries and send `Msg`s to other modules using the generated `QueryClient`
Expand Down Expand Up @@ -161,7 +161,7 @@ denom prefix being restricted to certain modules (as discussed in
### `ModuleKey`s and `ModuleID`s

A `ModuleKey` can be thought of as a "private key" for a module account and a `ModuleID` can be thought of as the
corresponding "public key". From the [ADR 028](adr-028-public-key-addresses.md), modules can have both a root module account and any number of sub-accounts
corresponding "public key". From the [ADR 028](./adr-028-public-key-addresses.md), modules can have both a root module account and any number of sub-accounts
or derived accounts that can be used for different pools (ex. staking pools) or managed accounts (ex. group
accounts). We can also think of module sub-accounts as similar to derived keys - there is a root key and then some
derivation path. `ModuleID` is a simple struct which contains the module name and optional "derivation" path,
Expand Down Expand Up @@ -248,7 +248,7 @@ func (key RootModuleKey) Invoke(ctx context.Context, method string, args, reply

### `AppModule` Wiring and Requirements

In [ADR 031](adr-031-msg-service.md), the `AppModule.RegisterService(Configurator)` method was introduced. To support
In [ADR 031](./adr-031-msg-service.md), the `AppModule.RegisterService(Configurator)` method was introduced. To support
inter-module communication, we extend the `Configurator` interface to pass in the `ModuleKey` and to allow modules to
specify their dependencies on other modules using `RequireServer()`:

Expand Down Expand Up @@ -393,8 +393,8 @@ replacing `Keeper` interfaces altogether.

## References

* [ADR 021](adr-021-protobuf-query-encoding.md)
* [ADR 031](adr-031-msg-service.md)
* [ADR 028](adr-028-public-key-addresses.md)
* [ADR 021](./adr-021-protobuf-query-encoding.md)
* [ADR 031](./adr-031-msg-service.md)
* [ADR 028](./adr-028-public-key-addresses.md)
* [ADR 030 draft](https://github.com/cosmos/cosmos-sdk/pull/7105)
* [Object-Capability Model](https://docs.network.com/main/core/ocap)
Loading

0 comments on commit 67e8ba3

Please sign in to comment.