From af875e9dd87ca6c530a7614090834debb4ea48f0 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 12 Dec 2023 18:29:48 +0100 Subject: [PATCH 1/2] docs: add ante precision --- docs/learn/beginner/01-tx-lifecycle.md | 4 ++++ x/circuit/README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/learn/beginner/01-tx-lifecycle.md b/docs/learn/beginner/01-tx-lifecycle.md index 05938b16d88b..3f57ff9f6e82 100644 --- a/docs/learn/beginner/01-tx-lifecycle.md +++ b/docs/learn/beginner/01-tx-lifecycle.md @@ -112,6 +112,10 @@ A copy of the cached context is provided to the `AnteHandler`, which performs li For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) module `AnteHandler` checks and increments sequence numbers, checks signatures and account numbers, and deducts fees from the first signer of the transaction - all state changes are made using the `checkState`. +:::warning +Note that ante handlers only run on a transaction. If a transaction embed multiple messages (like some x/authz, x/gov txs for instance), the ante handlers will run on the outer message. Inner messages are mostly directly routed to the [message router](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router) and skip the ante handler. This is something to keep in mind when designing your own ante handler. +::: + ### Gas The [`Context`](../advanced/02-context.md), which keeps a `GasMeter` that tracks how much gas is used during the execution of `Tx`, is initialized. The user-provided amount of gas for `Tx` is known as `GasWanted`. If `GasConsumed`, the amount of gas consumed during execution, ever exceeds `GasWanted`, the execution stops and the changes made to the cached copy of the state are not committed. Otherwise, `CheckTx` sets `GasUsed` equal to `GasConsumed` and returns it in the result. After calculating the gas and fee values, validator-nodes check that the user-specified `gas-prices` is greater than their locally defined `min-gas-prices`. diff --git a/x/circuit/README.md b/x/circuit/README.md index a8fb8f4facc7..53752df32760 100644 --- a/x/circuit/README.md +++ b/x/circuit/README.md @@ -23,7 +23,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/baseapp/msg_service_router.go# ``` :::note -The `CircuitBreakerDecorator` works for most use cases, but does not check the inner messages of a transaction. This some transactions (such as `x/authz` transactions or some `x/gov` transactions) may pass the ante handler. **This does not affect the circuit breaker** as the message router check will still fail the transaction. +The `CircuitBreakerDecorator` works for most use cases, but [does not check the inner messages of a transaction](https://docs.cosmos.network/main/learn/beginner/tx-lifecycle#antehandler). This some transactions (such as `x/authz` transactions or some `x/gov` transactions) may pass the ante handler. **This does not affect the circuit breaker** as the message router check will still fail the transaction. This tradeoff is to avoid introducing more dependencies in the `x/circuit` module. Chains can re-define the `CircuitBreakerDecorator` to check for inner messages if they wish to do so. ::: From 6ab508ee8cf0b49302dd12bb99b240ad62cbe332 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 12 Dec 2023 22:02:59 +0100 Subject: [PATCH 2/2] updates --- docs/learn/beginner/01-tx-lifecycle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/learn/beginner/01-tx-lifecycle.md b/docs/learn/beginner/01-tx-lifecycle.md index 3f57ff9f6e82..8c8118fa384d 100644 --- a/docs/learn/beginner/01-tx-lifecycle.md +++ b/docs/learn/beginner/01-tx-lifecycle.md @@ -113,7 +113,7 @@ A copy of the cached context is provided to the `AnteHandler`, which performs li For example, the [`auth`](https://github.com/cosmos/cosmos-sdk/tree/main/x/auth) module `AnteHandler` checks and increments sequence numbers, checks signatures and account numbers, and deducts fees from the first signer of the transaction - all state changes are made using the `checkState`. :::warning -Note that ante handlers only run on a transaction. If a transaction embed multiple messages (like some x/authz, x/gov txs for instance), the ante handlers will run on the outer message. Inner messages are mostly directly routed to the [message router](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router) and skip the ante handler. This is something to keep in mind when designing your own ante handler. +Ante handlers only run on a transaction. If a transaction embed multiple messages (like some x/authz, x/gov transactions for instance), the ante handlers only have awareness of the outer message. Inner messages are mostly directly routed to the [message router](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router) and will skip the chain of ante handlers. Keep that in mind when designing your own ante handler. ::: ### Gas