Skip to content

Commit

Permalink
Move mermaid diagram of block production to docs directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Jan 2, 2024
1 parent c830bea commit 1ac7744
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
27 changes: 27 additions & 0 deletions docs/block_production/lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
The following diagram describes Leap block production, as implemented in `libraries/chain/controller.cpp`:

```mermaid
flowchart TD
pp[producer_plugin] --> D
A("`_replay()_`"):::fun --> B("`_replay_push_block()_`"):::fun
B --> E("`_maybe_switch_forks()_`"):::fun
C("`_init()_`"):::fun ---> E
C --> A
D("`_push_block()_`"):::fun ---> E
subgraph G["`**_apply_block()_**`"]
direction TB
start -- "stage = Ø" --> sb
sb("`_start_block()_`"):::fun -- stage = building_block --> et
et["execute transactions" ] -- stage = building_block --> fb("`_finalize_block()_`"):::fun
fb -- stage = assembled block --> cb["add transaction metadata and create completed block"]
cb -- stage = completed block --> commit("`_commit_block()_ where we [maybe] add to fork_db and mark valid`"):::fun
end
B ----> start
E --> G
D --> F("`_log_irreversible()_`"):::fun
commit -- stage = Ø --> F
F -- if in irreversible mode --> G
classDef fun fill:#f96
```
32 changes: 2 additions & 30 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,7 @@
#include <shared_mutex>
#include <utility>

/* ----------- Mermaid diagram -----------------------------------
flowchart TD
pp[producer_plugin] --> D
A("`_replay()_`"):::fun --> B("`_replay_push_block()_`"):::fun
B --> E("`_maybe_switch_forks()_`"):::fun
C("`_init()_`"):::fun ---> E
C --> A
D("`_push_block()_`"):::fun ---> E
subgraph G["`**_apply_block()_**`"]
direction TB
start -- "stage = &Oslash;" --> sb
sb("`_start_block()_`"):::fun -- stage = building_block --> et
et["execute transactions" ] -- stage = building_block --> fb("`_finalize_block()_`"):::fun
fb -- stage = assembled block --> cb["add transaction metadata and create completed block"]
cb -- stage = completed block --> commit("`_commit_block()_ where we [maybe] add to fork_db and mark valid`"):::fun
end
B ----> start
E --> G
D --> F("`_log_irreversible()_`"):::fun
commit -- stage = &Oslash; --> F
F -- if in irreversible mode --> G
classDef fun fill:#f96
------------------------------------------------------------------ */

namespace eosio { namespace chain {
namespace eosio::chain {

using resource_limits::resource_limits_manager;

Expand Down Expand Up @@ -4587,4 +4559,4 @@ void controller_impl::on_activation<builtin_protocol_feature_t::instant_finality

/// End of protocol feature activation handlers

} } /// eosio::chain
} /// eosio::chain

0 comments on commit 1ac7744

Please sign in to comment.