-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: update for 0.38 #16501
docs: update for 0.38 #16501
Changes from 9 commits
cf555a0
a82be41
84aa54a
2c0df57
f0dc363
314657d
f03601d
6e5134a
0418879
0dd673e
27c4956
1d39486
f7c24d1
cc4e2b3
25f8736
be1ad6c
49294b6
d5a44b3
d72df67
037805a
84171cf
6f197b5
f9778fe
ad85832
d91221b
31c3231
654465e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,37 +157,41 @@ must be in this proposer's mempool. | |
## State Changes | ||
|
||
The next step of consensus is to execute the transactions to fully validate them. All full-nodes | ||
that receive a block proposal from the correct proposer execute the transactions by calling the ABCI functions | ||
[`BeginBlock`](./00-app-anatomy.md#beginblocker-and-endblocker), `DeliverTx` for each transaction, | ||
and [`EndBlock`](./00-app-anatomy.md#beginblocker-and-endblocker). While each full-node runs everything | ||
locally, this process yields a single, unambiguous result, since the messages' state transitions are deterministic and transactions are | ||
that receive a block proposal from the correct proposer execute the transactions by calling the ABCI function `FinalizeBlock`. | ||
tac0turtle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
While each full-node runs everything locally, this process yields a single, unambiguous result, | ||
since the messages' state transitions are deterministic and transactions are | ||
explicitly ordered in the block proposal. | ||
tac0turtle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```text | ||
----------------------- | ||
|Receive Block Proposal| | ||
----------------------- | ||
| | ||
v | ||
------------------------- | ||
| FinalizeBlock | | ||
| | ||
v | ||
----------------------- | ||
| BeginBlock | | ||
----------------------- | ||
------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we get the pretty alignment back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you know an extension to do this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This diagram will suffice for now but I think we should get the icf designer to do a fancy version wyt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. im good with that |
||
| BeginBlock | | ||
------------------- | ||
| | ||
v | ||
----------------------- | ||
| DeliverTx(tx0) | | ||
| DeliverTx(tx1) | | ||
| DeliverTx(tx2) | | ||
| DeliverTx(tx3) | | ||
| . | | ||
| . | | ||
| . | | ||
----------------------- | ||
-------------------- | ||
| ExecuteTx(tx0) | | ||
| ExecuteTx(tx1) | | ||
| ExecuteTx(tx2) | | ||
| ExecuteTx(tx3) | | ||
| . | | ||
| . | | ||
| . | | ||
------------------- | ||
| | ||
v | ||
----------------------- | ||
| EndBlock | | ||
----------------------- | ||
-------------------- | ||
| EndBlock | | ||
-------------------- | ||
------------------------- | ||
| | ||
v | ||
----------------------- | ||
|
@@ -200,36 +204,36 @@ explicitly ordered in the block proposal. | |
----------------------- | ||
``` | ||
|
||
### DeliverTx | ||
### Transaction Execution | ||
|
||
The `DeliverTx` ABCI function defined in [`BaseApp`](../core/00-baseapp.md) does the bulk of the | ||
The `FinalizeBlock` ABCI function defined in [`BaseApp`](../core/00-baseapp.md) does the bulk of the | ||
state transitions: it is run for each transaction in the block in sequential order as committed | ||
to during consensus. Under the hood, `DeliverTx` is almost identical to `CheckTx` but calls the | ||
to during consensus. Under the hood, transaction execution is almost identical to `CheckTx` but calls the | ||
[`runTx`](../core/00-baseapp.md#runtx) function in deliver mode instead of check mode. | ||
Instead of using their `checkState`, full-nodes use `deliverState`: | ||
Instead of using their `checkState`, full-nodes use `finalizeblock`: | ||
|
||
* **Decoding:** Since `DeliverTx` is an ABCI call, `Tx` is received in the encoded `[]byte` form. | ||
Nodes first unmarshal the transaction, using the [`TxConfig`](./app-anatomy#register-codec) defined in the app, then call `runTx` in `runTxModeDeliver`, which is very similar to `CheckTx` but also executes and writes state changes. | ||
* **Decoding:** Since `FinalizeBlock` is an ABCI call, `Tx` is received in the encoded `[]byte` form. | ||
Nodes first unmarshal the transaction, using the [`TxConfig`](./app-anatomy#register-codec) defined in the app, then call `runTx` in `execModeFinalize`, which is very similar to `CheckTx` but also executes and writes state changes. | ||
|
||
* **Checks and `AnteHandler`:** Full-nodes call `validateBasicMsgs` and `AnteHandler` again. This second check | ||
happens because they may not have seen the same transactions during the addition to Mempool stage | ||
and a malicious proposer may have included invalid ones. One difference here is that the | ||
`AnteHandler` does not compare `gas-prices` to the node's `min-gas-prices` since that value is local | ||
to each node - differing values across nodes yield nondeterministic results. | ||
|
||
* **`MsgServiceRouter`:** After `CheckTx` exits, `DeliverTx` continues to run | ||
* **`MsgServiceRouter`:** After `CheckTx` exits, `FinalizeBlock` continues to run | ||
[`runMsgs`](../core/00-baseapp.md#runtx-antehandler-runmsgs-posthandler) to fully execute each `Msg` within the transaction. | ||
Since the transaction may have messages from different modules, `BaseApp` needs to know which module | ||
to find the appropriate handler. This is achieved using `BaseApp`'s `MsgServiceRouter` so that it can be processed by the module's Protobuf [`Msg` service](../building-modules/03-msg-services.md). | ||
For `LegacyMsg` routing, the `Route` function is called via the [module manager](../building-modules/01-module-manager.md) to retrieve the route name and find the legacy [`Handler`](../building-modules/03-msg-services.md#handler-type) within the module. | ||
|
||
* **`Msg` service:** Protobuf `Msg` service is responsible for executing each message in the `Tx` and causes state transitions to persist in `deliverTxState`. | ||
* **`Msg` service:** Protobuf `Msg` service is responsible for executing each message in the `Tx` and causes state transitions to persist in `FinalizeBlockState`. | ||
tac0turtle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* **PostHandlers:** [`PostHandler`](../core/00-baseapp.md#posthandler)s run after the execution of the message. If they fail, the state change of `runMsgs`, as well of `PostHandlers`, are both reverted. | ||
|
||
* **Gas:** While a `Tx` is being delivered, a `GasMeter` is used to keep track of how much | ||
gas is being used; if execution completes, `GasUsed` is set and returned in the | ||
`abci.ResponseDeliverTx`. If execution halts because `BlockGasMeter` or `GasMeter` has run out or something else goes | ||
`abci.ExecTxResult`. If execution halts because `BlockGasMeter` or `GasMeter` has run out or something else goes | ||
wrong, a deferred function at the end appropriately errors or panics. | ||
|
||
If there are any failed state changes resulting from a `Tx` being invalid or `GasMeter` running out, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the codeblocks here show the wrong code (it moved since v0.47, so the line must change too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can do the whole repo mainly did the things i touched but can do others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean in that file. Doing the whole repo should be a separate PR imho. It is really awful to do and verify 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did the whole repo lol