docs: fixes the documentation build (#11542)
* docs: fixes the documentation build * add cname Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
parent
dc66ddd282
commit
6fa9252f3d
2
.github/workflows/deploy-docs.yml
vendored
2
.github/workflows/deploy-docs.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Deploy Documentation
|
||||
name: Deploy docs
|
||||
# This job builds and deploys documenation to github pages.
|
||||
# It runs on every push to master with a change in the docs folder.
|
||||
on:
|
||||
|
||||
@ -4,20 +4,17 @@ order: 3
|
||||
|
||||
# Middlewares
|
||||
|
||||
|
||||
`Middlewares` are objects that the developer can create to add logic before or after the transaction handler in a composable manner.
|
||||
{synopsis}
|
||||
|
||||
## Pre-requisite Readings
|
||||
|
||||
* [Anatomy of a Cosmos SDK Application](../basics/app-anatomy.md) {prereq}
|
||||
* [Transactons](transactions.md){prereq}
|
||||
|
||||
* [Transactons](transactions.md) {prereq}
|
||||
|
||||
## Middlewares
|
||||
|
||||
The SDK Baseapp's implementation of ABCI CheckTx, DeliverTx, and Baseapp's own Simulate methods use a middleware-based design. Middlewares can add logic to be executed before or after a transaction handler execution. Middlewares are like an `antehandler` with the added feature of being able to add post-transaction handler execution. Middlewares allow us to solve use cases like transaction Tips and refund unused gas (issue [#2150](https://github.com/cosmos/cosmos-sdk/issues/2150)).
|
||||
|
||||
The SDK Baseapp's implementation of ABCI CheckTx, DeliverTx, and Baseapp's own Simulate methods use a middleware-based design. Middlewares can add logic to be executed before or after a transaction handler execution. Middlewares are like an `antehandler` with the added feature of being able to add post-transaction handler execution. Middlewares allow us to solve use cases like transaction Tips and refund unused gas (issue [#2150](https://github.com/cosmos/cosmos-sdk/issues/2150)).
|
||||
|
||||
### Type Definition
|
||||
|
||||
@ -38,12 +35,11 @@ type BaseApp struct {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Implementing a Middleware
|
||||
|
||||
To implement a middleware is done simply by a Go function that takes as arguments and some parameters and returns a `tx.Middleware`.
|
||||
|
||||
For example, we can create a Generic middleware.
|
||||
For example, we can create a Generic middleware.
|
||||
|
||||
```go
|
||||
// myTxHandler is the tx.Handler of this middleware. Note that it holds a
|
||||
@ -144,17 +140,14 @@ The app developer can define their own middlewares, or use the Cosmos SDK's pre-
|
||||
|
||||
While the app developer can define and compose the middlewares of their choice, the Cosmos SDK provides a set of middlewares that caters to the ecosystem's most common use cases. These middlewares are:
|
||||
|
||||
| Middleware | Description |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| RunMsgsTxHandler | This is the base `tx.Handler`. It replaces the old baseapp's `runMsgs`, and executes a transaction's `Msg`s. |
|
||||
| TxDecoderMiddleware | This middleware takes in transaction raw bytes, and decodes them into a `sdk.Tx`. It replaces the `baseapp.txDecoder` field, so that BaseApp stays as thin as possible. Since most middlewares read the contents of the `sdk.Tx`, the TxDecoderMiddleware should be run first in the middelware stack. |
|
||||
| {Antehandlers} | Each antehandler is converted to its own middleware. These middlewares perform signature verification, fee deductions and other validations on the incoming transaction. |
|
||||
| IndexEventsTxMiddleware | This is a simple middleware that chooses which events to index in Tendermint. Replaces `baseapp.indexEvents` (which unfortunately still exists in baseapp too, because it's used to index Begin/EndBlock events) |
|
||||
| RecoveryTxMiddleware | This index recovers from panics. It replaces baseapp.runTx's panic recovery described in [ADR-022](./adr-022-custom-panic-handling.md). |
|
||||
| GasTxMiddleware | This replaces the [`Setup`](https://github.com/cosmos/cosmos-sdk/blob/v0.43.0/x/auth/ante/setup.go) Antehandler. It sets a GasMeter on sdk.Context. Note that before, GasMeter was set on sdk.Context inside the antehandlers, and there was some mess around the fact that antehandlers had their own panic recovery system so that the GasMeter could be read by baseapp's recovery system. Now, this mess is all removed: one middleware sets GasMeter, another one handles recovery.
|
||||
| TipMiddleware | This pays for transaction fees using another denom than the native fee denom of the chain. [`docs`](tips.md)
|
||||
| SigGasConsumeMiddleware | SigGasConsumeMiddleware consumes parameter-defined amount of gas for each signature.
|
||||
| SigVerificationMiddleware | verifies all signatures for a tx and return an error if any are invalid
|
||||
|
||||
|
||||
|
||||
| Middleware | Description |
|
||||
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| RunMsgsTxHandler | This is the base `tx.Handler`. It replaces the old baseapp's `runMsgs`, and executes a transaction's `Msg`s. |
|
||||
| TxDecoderMiddleware | This middleware takes in transaction raw bytes, and decodes them into a `sdk.Tx`. It replaces the `baseapp.txDecoder` field, so that BaseApp stays as thin as possible. Since most middlewares read the contents of the `sdk.Tx`, the TxDecoderMiddleware should be run first in the middelware stack. |
|
||||
| {Antehandlers} | Each antehandler is converted to its own middleware. These middlewares perform signature verification, fee deductions and other validations on the incoming transaction. |
|
||||
| IndexEventsTxMiddleware | This is a simple middleware that chooses which events to index in Tendermint. Replaces `baseapp.indexEvents` (which unfortunately still exists in baseapp too, because it's used to index Begin/EndBlock events) |
|
||||
| RecoveryTxMiddleware | This index recovers from panics. It replaces baseapp.runTx's panic recovery described in [ADR-022](./adr-022-custom-panic-handling.md). |
|
||||
| GasTxMiddleware | This replaces the [`Setup`](https://github.com/cosmos/cosmos-sdk/blob/v0.43.0/x/auth/ante/setup.go) Antehandler. It sets a GasMeter on sdk.Context. Note that before, GasMeter was set on sdk.Context inside the antehandlers, and there was some mess around the fact that antehandlers had their own panic recovery system so that the GasMeter could be read by baseapp's recovery system. Now, this mess is all removed: one middleware sets GasMeter, another one handles recovery. |
|
||||
| TipMiddleware | This pays for transaction fees using another denom than the native fee denom of the chain. [`docs`](tips.md) |
|
||||
| SigGasConsumeMiddleware | SigGasConsumeMiddleware consumes parameter-defined amount of gas for each signature. |
|
||||
| SigVerificationMiddleware | verifies all signatures for a tx and return an error if any are invalid |
|
||||
|
||||
1
docs/output/CNAME
Normal file
1
docs/output/CNAME
Normal file
@ -0,0 +1 @@
|
||||
docs.cosmos.network
|
||||
Loading…
Reference in New Issue
Block a user