Skip to content

Commit 152329f

Browse files
authored
[Nodes] Quick pass over nodes section. (#166)
1 parent 886b163 commit 152329f

14 files changed

+452
-292
lines changed

docs/guides/state-sync.md

+82-51
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,81 @@ title: "State Synchronization"
55
import ThemedImage from '@theme/ThemedImage';
66
import useBaseUrl from '@docusaurus/useBaseUrl';
77

8-
Nodes in an Aptos network (e.g., validator nodes and fullnodes) must always be synchronized to the latest Aptos blockchain state. The [state synchronization](https://medium.com/aptoslabs/the-evolution-of-state-sync-the-path-to-100k-transactions-per-second-with-sub-second-latency-at-52e25a2c6f10) (state sync) component that runs on each node is responsible for this. State sync identifies and fetches new blockchain data from the peers, validates the data and persists it to the local storage.
8+
Nodes in an Aptos network must always be synchronized to the latest Aptos blockchain state, e.g., validators, validator
9+
fullnodes (VFNs) and public fullnodes (PFNs). The [state synchronization](https://medium.com/aptoslabs/the-evolution-of-state-sync-the-path-to-100k-transactions-per-second-with-sub-second-latency-at-52e25a2c6f10) (state sync) component that runs on each
10+
node is responsible for this. State sync identifies and fetches new blockchain data from the peers, validates the data
11+
and persists it to local storage.
912

1013
:::tip Need to start a node quickly?
11-
If you need to start a node quickly, here's what we recommend by use case:
14+
If you need to start a node quickly, here's what we recommend (by use case):
1215

13-
- **Devnet public fullnode**: To sync the entire blockchain history, use [intelligent syncing](state-sync.md#intelligent-syncing). Otherwise, use [fast sync](state-sync.md#fast-syncing).
14-
- **Testnet public fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, download [a snapshot](../nodes/full-node/bootstrap-fullnode.md) or use [fast sync](state-sync.md#fast-syncing).
15-
- **Mainnet public fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
16-
- **Mainnet validator or validator fullnode**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
16+
- **Devnet PFN**: To sync the entire blockchain history, use [intelligent syncing](state-sync.md#intelligent-syncing). Otherwise, use [fast sync](state-sync.md#fast-syncing).
17+
- **Testnet PFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, download [a snapshot](../nodes/full-node/bootstrap-fullnode.md) or use [fast sync](state-sync.md#fast-syncing).
18+
- **Mainnet PFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
19+
- **Mainnet validator or VFN**: To sync the entire blockchain history, restore from a [backup](../nodes/full-node/aptos-db-restore.md). Otherwise, use [fast sync](state-sync.md#fast-syncing).
1720
:::
1821

19-
## State sync modes
20-
21-
State sync runs in two modes. All nodes will first bootstrap (in bootstrapping mode) on startup, and then continuously synchronize (in continuous sync mode).
22-
23-
### Bootstrapping mode
22+
## State sync phases
23+
24+
State sync runs in two phases. All nodes will first bootstrap on startup (in the **bootstrapping phase**), and then
25+
continuously synchronize (in the **continuous syncing phase**).
26+
27+
### Bootstrapping phase
28+
29+
When the node starts, state sync will perform bootstrapping by using the configured bootstrapping mode. This allows the
30+
node to catch up to the latest state in the Aptos blockchain. There are several bootstrapping modes:
31+
32+
- **Execute all the transactions since genesis**. In this mode, the node will retrieve from the Aptos network all the
33+
transactions since genesis, i.e., since the start of the blockchain's history, and re-execute those transactions.
34+
Naturally, this mode takes the longest amount of time because it must process all transactions since the network began.
35+
- **Apply transaction outputs since genesis**. In this mode, the node will retrieve all the transactions since genesis,
36+
but it will skip transaction re-execution and instead apply the outputs of the transactions that were previously
37+
produced by validator execution. This mode reduces the amount of CPU time required, but still processes all transactions
38+
since the network began.
39+
- **Intelligent syncing since genesis**. In this mode, the node will retrieve all the transactions
40+
since genesis and will either execute the transactions, or apply the transaction outputs, depending on whichever is
41+
faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently.
42+
This mode is the default mode for devnet and other testing environments.
43+
- **Fast syncing**. In this mode, the node will skip the transaction history in the blockchain and will download only
44+
the latest blockchain state directly. As a result, the node will not have the historical transaction data, but it will
45+
be able to catch up to the Aptos network much more rapidly. This mode is the default mode for testnet and mainnet.
46+
47+
:::tip Bootstrapping defaults?
48+
The default bootstrapping mode depends on the network type:
49+
50+
- **Testnet and Mainnet**: The default bootstrapping mode is fast sync, because these networks are long-lived
51+
and have a large amount of historical data.
52+
- **Devnet and other networks**: The default bootstrapping mode is intelligent syncing, because these networks are
53+
typically short-lived and have a small amount of historical data.
54+
:::
2455

25-
When the node starts, state sync will perform bootstrapping by using the specified bootstrapping mode configuration. This allows the node to catch up to the Aptos blockchain. There are several bootstrapping modes:
56+
### Continuous syncing phase
2657

27-
- **Execute all the transactions since genesis**. In this state sync mode the node will retrieve from the Aptos network all the transactions since genesis, i.e., since the start of the blockchain's history, and re-execute those transactions. Naturally, this synchronization mode takes the longest amount of time.
28-
- **Apply transaction outputs since genesis**. In this state sync mode the node will retrieve all the transactions since genesis, but it will skip the transaction execution and will only apply the outputs of the transactions that were previously produced by validator execution. This mode reduces the amount of CPU time required.
29-
- **(Default) Intelligent syncing since genesis**. In this state sync mode the node will retrieve all the transactions since genesis and will either execute the transactions, or apply the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently. This mode is the default mode.
30-
- **Fast syncing**. In this state sync mode the node will skip the transaction history in the blockchain and will download only the latest blockchain state directly. As a result, the node will not have the historical transaction data, but it will be able to catch up to the Aptos network much more rapidly.
58+
After the node has bootstrapped and caught up to the Aptos network initially, state sync will then move into
59+
the continuous syncing phase to stay up-to-date with the blockchain. There are several continuous syncing modes:
3160

32-
### Continuous syncing mode
61+
- **Executing transactions**. This mode will keep the node up-to-date by executing new transactions as they are
62+
committed to the blockchain.
63+
- **Applying transaction outputs**. This mode will keep the node up-to-date by skipping the transaction execution
64+
and only applying the outputs of the transactions as previously produced by validator execution.
65+
- **Intelligent syncing**. This mode will keep the node up-to-date by either executing the transactions, or applying
66+
the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and
67+
network resource constraints more efficiently. This is the default mode for all environments.
3368

34-
After the node has bootstrapped and caught up to the Aptos network initially, state sync will then move into continuous syncing mode to stay up-to-date with the blockchain. There are several continuous syncing modes:
69+
:::tip Continuous syncing defaults?
70+
The default continuous syncing mode is always intelligent syncing, because this mode is the most performant.
71+
:::
3572

36-
- **Executing transactions**. This state sync mode will keep the node up-to-date by executing new transactions as they are committed to the blockchain.
37-
- **Applying transaction outputs**. This state sync mode will keep the node up-to-date by skipping the transaction execution and only applying the outputs of the transactions as previously produced by validator execution.
38-
- **(Default) Intelligent syncing**. This state sync mode will keep the node up-to-date by either executing the transactions, or applying the transaction outputs, depending on whichever is faster, per data chunk. This allows the node to adapt to CPU and network resource constraints more efficiently. This mode is the default mode.
73+
## Configuring state sync
3974

40-
## Configuring the state sync modes
75+
The configuration snippets below provide instructions for configuring state sync on your nodes for different use cases.
76+
These configurations can be added to your node's configuration file, e.g., `fullnode.yaml` or `validator.yaml`.
4177

42-
The below sections provide instructions for how to configure your node for different use cases.
78+
:::danger Manual configuration
79+
State sync is tuned to automatically select the best mode for your node, depending on the network.
80+
Be aware that if you manually configure your node to use a different mode, it may not be the most
81+
optimal, and you could experience slower syncing times and degraded performance.
82+
:::
4383

4484
### Executing all transactions
4585

@@ -90,32 +130,22 @@ state_sync:
90130
continuous_syncing_mode: ExecuteTransactionsOrApplyOutputs
91131
```
92132

93-
This is the default syncing mode on all nodes, as it allows the node to adapt to CPU and network resource constraints more efficiently.
94-
95133
:::tip Verify node syncing
96134
While your node is syncing, you'll be able to see the
97135
[`aptos_state_sync_version{type="synced"}`](../nodes/full-node/fullnode-source-code-or-docker.md#verify-initial-synchronization) metric gradually increase.
98136
:::
99137

100138
### Fast syncing
101139

102-
:::tip Fastest and cheapest method
103-
This is the fastest and cheapest method of syncing your node. It
104-
requires the node to start from an empty state (i.e., not have any existing
105-
storage data).
106-
:::
107-
108140
:::caution Proceed with caution
109-
Fast sync should only be used as a last resort for validators and
110-
validator fullnodes. This is because fast sync skips all the blockchain
111-
history and as a result: (i) reduces the data availability in the network;
112-
and (ii) may hinder validator consensus performance if too much data has
113-
been skipped. Thus, validator and validator fullnode operators should be
114-
careful to consider alternate ways of syncing before resorting to fast sync.
141+
Fast sync should only be used as a last resort for validators and VFNs. This is because fast sync skips the
142+
blockchain history, and: (i) reduces data availability in the network (as the blockchain history is truncated on
143+
the fast synced nodes); and (ii) hinders validator consensus performance (if too much data has been skipped).
144+
Validators that fast sync may require additional running time before they are eligible to participate in consensus.
115145
:::
116146

117-
To download the latest blockchain state and continue to apply new
118-
transaction outputs as transactions are committed, add the following to your
147+
To download the latest blockchain state and continue to process new
148+
transactions as they are committed, add the following to your
119149
node configuration file:
120150

121151
```yaml
@@ -125,6 +155,7 @@ state_sync:
125155
continuous_syncing_mode: ExecuteTransactionsOrApplyOutputs
126156
```
127157

158+
:::tip Verify node syncing
128159
While your node is syncing, you'll be able to see the
129160
`aptos_state_sync_version{type="synced_states"}` metric gradually increase.
130161
However, `aptos_state_sync_version{type="synced"}` will only increase once
@@ -137,40 +168,40 @@ increase then do the following:
137168
1. Double-check the node configuration file has correctly been updated.
138169
2. Make sure that the node is starting up with an empty storage database
139170
(i.e., that it has not synced any state previously).
171+
:::
140172

141-
## Running archival nodes
173+
## Running archival PFNs
142174

143-
To operate an archival node, which is a fullnode that contains all blockchain data
144-
since the start of the blockchain's history (that is, genesis), you should:
175+
To operate an archival PFN (which is a PFN that contains all blockchain data
176+
since the start of the network, i.e., genesis), you should:
145177

146-
1. Run a fullnode and configure it to either: (i) execute all transactions; (ii) apply all transaction outputs; or (iii)
147-
use intelligent syncing (see above). Do not select fast syncing, as the fullnode will not contain all data since genesis.
178+
1. Configure the PFN _not to use_ fast syncing, e.g., select intelligent syncing in your node configuration file.
148179
2. Disable the ledger pruner, as described in the [Data Pruning document](data-pruning.md#disabling-the-ledger-pruner).
149-
This will ensure that no data is pruned and the fullnode contains all blockchain data.
180+
This will ensure that no data is deleted and the PFN contains all blockchain data.
150181

151-
:::caution Proceed with caution
182+
:::danger Archival nodes have ever-growing storage
152183
Running and maintaining archival nodes is likely to be expensive and slow
153-
as the amount of data being stored on the fullnode will continuously grow.
184+
as the amount of data being stored on the fullnode will grow unbounded.
154185
:::
155186

156187
## Security implications and data integrity
157188

158-
Each of the different syncing modes perform data integrity verifications to
189+
Each of the different state sync syncing modes perform data integrity verifications to
159190
ensure that the data being synced to the node has been correctly produced
160191
and signed by the validators. This occurs slightly differently for
161192
each syncing mode:
162193

163-
1. Executing transactions from genesis is the most secure syncing mode. It will
194+
1. **Executing transactions**: Executing transactions from genesis is the most secure syncing mode. It will
164195
verify that all transactions since the beginning of time were correctly agreed
165196
upon by consensus and that all transactions were correctly executed by the
166197
validators. All resulting blockchain state will thus be re-verified by the
167198
syncing node.
168-
2. Applying transaction outputs from genesis is faster than executing all
199+
2. **Applying transaction outputs**: Applying transaction outputs from genesis is faster than executing all
169200
transactions, but it requires that the syncing node trusts the validators to
170201
have executed the transactions correctly. However, all other
171202
blockchain state is still manually re-verified, e.g., consensus messages,
172203
the transaction history and the state hashes are still verified.
173-
3. Fast syncing skips the transaction history and downloads the latest
204+
3. **Fast syncing**: Fast syncing skips the transaction history and downloads the latest
174205
blockchain state before continuously syncing. To do this, it requires that the
175206
syncing node trust the validators to have correctly agreed upon all
176207
transactions in the transaction history as well as trust that all transactions

docs/nodes/full-node/fullnode-network-connections.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ When running a fullnode on an Aptos network, you can configure your node's
99
network connections for a few different purposes. For example, you can add
1010
a seed peer to your node's configuration YAML to connect your node to a
1111
specific peer of your choosing. Or you can create a static network identity
12-
for your node to allow other nodes to connect to you, as described in [Network Identity For Fullnode](./network-identity-fullnode.md).
12+
for your node to allow other nodes to connect to you, as described in [Network Identity For PFNs](./network-identity-fullnode.md).
1313

1414
This document describes how to configure the network of your fullnode for
1515
different networks and requirements, including:
@@ -25,7 +25,7 @@ different networks and requirements, including:
2525
:::tip Before you proceed
2626

2727
Before allowing other fullnodes to connect to your fullnode,
28-
be sure to create a fullnode identity. See [Network Identity For Fullnode](./network-identity-fullnode.md).
28+
be sure to create a fullnode identity. See [Network Identity For PFNs](./network-identity-fullnode.md).
2929

3030
:::
3131

0 commit comments

Comments
 (0)