Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com>
This commit is contained in:
parent
2e961d3d7f
commit
85694fef2d
4
docs/docs/build/abci/01-prepare-proposal.md
vendored
4
docs/docs/build/abci/01-prepare-proposal.md
vendored
@ -29,7 +29,7 @@ selected DO NOT exceed the maximum block gas (if set) and the maximum bytes prov
|
||||
by `req.MaxBytes`.
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/baseapp/abci_utils.go
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/baseapp/abci_utils.go
|
||||
```
|
||||
|
||||
This default implementation can be overridden by the application developer in
|
||||
@ -42,4 +42,4 @@ prepareOpt := func(app *baseapp.BaseApp) {
|
||||
}
|
||||
|
||||
baseAppOptions = append(baseAppOptions, prepareOpt)
|
||||
```
|
||||
```
|
||||
|
||||
2
docs/docs/build/abci/03-vote-extensions.md
vendored
2
docs/docs/build/abci/03-vote-extensions.md
vendored
@ -8,7 +8,7 @@ defined in ABCI++.
|
||||
## Extend Vote
|
||||
|
||||
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
|
||||
validator process. The Cosmos SDK defines [`baseapp.ExtendVoteHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/types/abci.go#L32):
|
||||
validator process. The Cosmos SDK defines [`baseapp.ExtendVoteHandler`](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/types/abci.go#L32):
|
||||
|
||||
```go
|
||||
type ExtendVoteHandler func(Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error)
|
||||
|
||||
@ -25,7 +25,7 @@ When users want to interact with an application and make state changes (e.g. sen
|
||||
Transaction objects are Cosmos SDK types that implement the `Tx` interface
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/types/tx_msg.go#L53-L58
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/types/tx_msg.go#L53-L58
|
||||
```
|
||||
|
||||
It contains the following methods:
|
||||
@ -43,13 +43,13 @@ Every message in a transaction must be signed by the addresses specified by its
|
||||
The most used implementation of the `Tx` interface is the Protobuf `Tx` message, which is used in `SIGN_MODE_DIRECT`:
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/tx/v1beta1/tx.proto#L15-L28
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/proto/cosmos/tx/v1beta1/tx.proto#L15-L28
|
||||
```
|
||||
|
||||
Because Protobuf serialization is not deterministic, the Cosmos SDK uses an additional `TxRaw` type to denote the pinned bytes over which a transaction is signed. Any user can generate a valid `body` and `auth_info` for a transaction, and serialize these two messages using Protobuf. `TxRaw` then pins the user's exact binary representation of `body` and `auth_info`, called respectively `body_bytes` and `auth_info_bytes`. The document that is signed by all signers of the transaction is `SignDoc` (deterministically serialized using [ADR-027](../../build/architecture/adr-027-deterministic-protobuf-serialization.md)):
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/tx/v1beta1/tx.proto#L50-L67
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/proto/cosmos/tx/v1beta1/tx.proto#L50-L67
|
||||
```
|
||||
|
||||
Once signed by all signers, the `body_bytes`, `auth_info_bytes` and `signatures` are gathered into `TxRaw`, whose serialized bytes are broadcasted over the network.
|
||||
@ -59,13 +59,13 @@ Once signed by all signers, the `body_bytes`, `auth_info_bytes` and `signatures`
|
||||
The legacy implementation of the `Tx` interface is the `StdTx` struct from `x/auth`:
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/x/auth/migrations/legacytx/stdtx.go#L82-L89
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/x/auth/migrations/legacytx/stdtx.go#L82-L89
|
||||
```
|
||||
|
||||
The document signed by all signers is `StdSignDoc`:
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/x/auth/migrations/legacytx/stdsign.go#L30-L43
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/x/auth/migrations/legacytx/stdsign.go#L30-L43
|
||||
```
|
||||
|
||||
which is encoded into bytes using Amino JSON. Once all signatures are gathered into `StdTx`, `StdTx` is serialized using Amino JSON, and these bytes are broadcasted over the network.
|
||||
@ -80,7 +80,7 @@ The Cosmos SDK also provides a couple of other sign modes for particular use cas
|
||||
need to sign over the fees:
|
||||
|
||||
```protobuf reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/tx/v1beta1/tx.proto#L68-L93
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/proto/cosmos/tx/v1beta1/tx.proto#L68-L93
|
||||
```
|
||||
|
||||
The use case is a multi-signer transaction, where one of the signers is appointed to gather all signatures, broadcast the signature and pay for fees, and the others only care about the transaction body. This generally allows for a better multi-signing UX. If Alice, Bob and Charlie are part of a 3-signer transaction, then Alice and Bob can both use `SIGN_MODE_DIRECT_AUX` to sign over the `TxBody` and their own signer info (no need an additional step to gather other signers' ones, like in `SIGN_MODE_DIRECT`), without specifying a fee in their SignDoc. Charlie can then gather both signatures from Alice and Bob, and
|
||||
@ -99,7 +99,7 @@ If you wish to learn more, please refer to [ADR-050](../../build/architecture/ad
|
||||
|
||||
#### Custom Sign modes
|
||||
|
||||
There is the opportunity to add your own custom sign mode to the Cosmos-SDK. While we can not accept the implementation of the sign mode to the repository, we can accept a pull request to add the custom signmode to the SignMode enum located [here](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/tx/signing/v1beta1/signing.proto#L17)
|
||||
There is the opportunity to add your own custom sign mode to the Cosmos-SDK. While we can not accept the implementation of the sign mode to the repository, we can accept a pull request to add the custom signmode to the SignMode enum located [here](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/proto/cosmos/tx/signing/v1beta1/signing.proto#L17)
|
||||
|
||||
## Transaction Process
|
||||
|
||||
@ -131,7 +131,7 @@ While messages contain the information for state transition logic, a transaction
|
||||
The `TxBuilder` interface contains data closely related with the generation of transactions, which an end-user can set to generate the desired transaction:
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/client/tx_config.go#L39-L57
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/client/tx_config.go#L39-L57
|
||||
```
|
||||
|
||||
* `Msg`s, the array of [messages](#messages) included in the transaction.
|
||||
@ -145,13 +145,13 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/client/tx_config.go#L39-L
|
||||
|
||||
As there are currently two sign modes for signing transactions, there are also two implementations of `TxBuilder`:
|
||||
|
||||
* [wrapper](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/x/auth/tx/builder.go#L27-L44) for creating transactions for `SIGN_MODE_DIRECT`,
|
||||
* [StdTxBuilder](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/x/auth/migrations/legacytx/stdtx_builder.go#L14-L17) for `SIGN_MODE_LEGACY_AMINO_JSON`.
|
||||
* [wrapper](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/x/auth/tx/builder.go#L27-L44) for creating transactions for `SIGN_MODE_DIRECT`,
|
||||
* [StdTxBuilder](https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/x/auth/migrations/legacytx/stdtx_builder.go#L14-L17) for `SIGN_MODE_LEGACY_AMINO_JSON`.
|
||||
|
||||
However, the two implementations of `TxBuilder` should be hidden away from end-users, as they should prefer using the overarching `TxConfig` interface:
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/client/tx_config.go#L27-L37
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/client/tx_config.go#L27-L37
|
||||
```
|
||||
|
||||
`TxConfig` is an app-wide configuration for managing transactions. Most importantly, it holds the information about whether to sign each transaction with `SIGN_MODE_DIRECT` or `SIGN_MODE_LEGACY_AMINO_JSON`. By calling `txBuilder := txConfig.NewTxBuilder()`, a new `TxBuilder` will be created with the appropriate sign mode.
|
||||
@ -185,7 +185,7 @@ simd tx send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000stake
|
||||
[gRPC](https://grpc.io) is the main component for the Cosmos SDK's RPC layer. Its principal usage is in the context of modules' [`Query` services](../../build/building-modules/04-query-services.md). However, the Cosmos SDK also exposes a few other module-agnostic gRPC services, one of them being the `Tx` service:
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0-rc.2/proto/cosmos/tx/v1beta1/service.proto
|
||||
https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/proto/cosmos/tx/v1beta1/service.proto
|
||||
```
|
||||
|
||||
The `Tx` service exposes a handful of utility functions, such as simulating a transaction or querying a transaction, and also one method to broadcast transactions.
|
||||
@ -226,4 +226,4 @@ Senders must use a unique timestamp for each distinct transaction. The differenc
|
||||
|
||||
These unique timestamps serve as a one-shot nonce, and their lifespan in state is short-lived.
|
||||
Upon transaction inclusion, an entry consisting of timeout timestamp and account address will be recorded to state.
|
||||
Once the block time is passed the timeout timestamp value, the entry will be removed. This ensures that unordered nonces do not indefinitely fill up the chain's storage.
|
||||
Once the block time is passed the timeout timestamp value, the entry will be removed. This ensures that unordered nonces do not indefinitely fill up the chain's storage.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user