1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use DataSize;
use Display;
use JsonSchema;
use ;
/// The state of the reactor.
/// ```mermaid
/// flowchart TD
/// %%{init: { 'flowchart': {'diagramPadding':100} }}%%
/// style Start fill:#66ccff,stroke:#333,stroke-width:4px
/// style End fill:#66ccff,stroke:#333,stroke-width:4px
///
/// Start --> Initialize
/// Initialize --> CatchUp
/// CatchUp --> KeepUp
/// KeepUp --> CatchUp
/// KeepUp --> Validate
/// Validate --> KeepUp
/// CatchUp --> ShutdownForUpgrade
/// CatchUp --> ShutdownAfterCatchingUp
/// KeepUp --> ShutdownForUpgrade
/// Validate --> ShutdownForUpgrade
/// CatchUp --> Upgrading
/// CatchUp -->|at genesis| Validate
/// Upgrading --> CatchUp
/// ShutdownForUpgrade --> End
/// ```
/// ```mermaid
/// flowchart TD
/// style Start fill:#66ccff,stroke:#333,stroke-width:4px
/// style End fill:#66ccff,stroke:#333,stroke-width:4px
/// style F fill:#ffcc66,stroke:#333,stroke-width:4px
/// style G fill:#ffcc66,stroke:#333,stroke-width:4px
/// title[CatchUp process]
/// title---Start
/// style title fill:#FFF,stroke:#FFF
/// linkStyle 0 stroke-width:0;
///
/// Start --> A["get sync identifier (sync starting point)"]
/// A --> BlockHash
/// A --> BlockIdentifier
/// A --> SyncedBlockIdentifier
/// A --> LocalTip
/// BlockHash --> E[process identifier in<br/>block accumulator]
/// BlockIdentifier --> E
/// SyncedBlockIdentifier --> E
/// LocalTip --> E
/// CaughtUp --> H[handle upgrade<br/>if needed]
/// H --> End
/// E -->|more data needed<br/>from network<br/>to let us sync near tip| Leap
/// E -->|block represented by<br/>identifier is not stored<br/>locally, sync it| BlockSync
/// E -->|we think we're close<br/>enough to the tip|CaughtUp
/// Leap --> F[initiate SyncLeap<br/>and retry later]
/// BlockSync --> G[initiate BlockSync<br/>and retry later]
/// ```