Skip to content

Commit 8048557

Browse files
committed
docs: address comments
1 parent aca8474 commit 8048557

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

Diff for: docs/learn/advanced/18-syncing.md

+33-30
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,33 @@ sidebar_position: 1
66

77
Syncing is the process of downloading the blockchain and state from a remote node.
88

9-
There are two types of syncing:
9+
There are the following types of syncing:
10+
11+
1. Genesis Sync: operator downloads genesis, sets peers and syncs the blockchain by executing all blocks since genesis.
12+
> **NOTE:** requires a peer node that doesn't prune blocks (CometBFT state).
13+
14+
2. State Sync: operator need to set `trust_height` and `trust_hash` of a block that s/he trusts as well as `trust_period` - the time how long the operator will trust the given block height. The app will query peer nodes to stream state from that blocks as well as all following blocks. Once the state is downloaded, the node will start executing all blocks since the `trust_height`.
15+
> **NOTE:** requires a peer node that provides a state sync and is trusted by the validator.
16+
17+
3. Snapshot Sync: operator downloads a snapshot from snapshot provider (usually validators) s/he trusts. From there the operator needs to unpack the snapshot to the node directory, update config, set peers, set moniker, setup validator keys. Once the data directory is properly configured, the validator can start a node. The node will query blocks since the snapshot and execute them.
18+
> **NOTE:** requires a snapshot directory that is trusted by the validator.
19+
20+
Genesis Sync has zero trust assumptions, but it's the most resource heavy. It also requires a node with all blocks - many validators prune the blocks to optimize space.
1021

11-
1. Blockchain syncing.
12-
With block sync a node is downloading all of the data of an application from genesis and verifying it.
13-
2. State syncing.
14-
With state sync your node will download data related to the head or near the head of the chain and verify the data. This leads to drastically shorter times for joining a network.
1522

1623

1724
## Observing syncing progress
1825

19-
> ### Note: This section applies to comet users.
26+
> ### Note: This section applies to comet users
27+
>
28+
> To enable the Prometheus metrics, set `instrumentation.prometheus=true` in your config file. Metrics will be served under `/metrics` on `26660` port by default. Listen address can be changed in the config file (see `instrumentation.prometheus_listen_addr`).
29+
>
30+
> More [here](https://github.com/cometbft/cometbft/blob/main/docs/explanation/core/metrics.md).
2031
2132
### Block Sync Metrics
2233

34+
They are defined [here](https://github.com/cometbft/cometbft/blob/main/internal/blocksync/metrics.go) and are accessible from the node's metrics endpoint.
35+
2336
- `blocksync_syncing`: Indicates whether a node is currently block syncing.
2437
- `blocksync_num_txs`: Number of transactions in the latest block.
2538
- `blocksync_total_txs`: Total number of transactions.
@@ -29,41 +42,31 @@ There are two types of syncing:
2942
### Block sync configuration
3043

3144
```toml
32-
blocksync:
33-
version: "v0"
45+
[blocksync]
46+
version = "v0" # version of the block sync protocol to use
3447
```
3548

36-
- `version`: The version of the block sync protocol to use.
37-
3849
### State Sync Metrics
3950

51+
They are defined [here](https://github.com/cometbft/cometbft/blob/main/internal/statesync/metrics.go) and are accessible from the node's metrics endpoint.
52+
4053
- `statesync_syncing`: Indicates whether a node is currently state syncing.
4154

4255
### State sync configuration
4356

4457
```toml
45-
statesync:
46-
enable: true
47-
rpc_servers: ""
48-
trust_height: 0
49-
trust_hash: ""
50-
trust_period: 168h0m0s
51-
discovery_time: 15s
52-
temp_dir: ""
53-
chunk_request_timeout: 10s
54-
chunk_fetchers: "4"
58+
[statesync]
59+
enable = true # set to true to enable state sync
60+
rpc_servers = "" # comma-separated list of RPC servers for state sync
61+
trust_height = 0 # block height to trust for state sync
62+
trust_hash = "" # block hash to trust for state sync
63+
trust_period = "168h0m0s" # trust period for light client verification
64+
discovery_time = "15s" # time to spend discovering snapshots before picking one
65+
temp_dir = "" # directory for temporary state sync files
66+
chunk_request_timeout = "10s" # timeout for chunk requests
67+
chunk_fetchers = "4" # number of concurrent chunk fetchers
5568
```
5669

57-
- `enable`: Set to true to enable state sync.
58-
- `rpc_servers`: Comma-separated list of RPC servers for state sync.
59-
- `trust_height`: Block height to trust for state sync.
60-
- `trust_hash`: Block hash to trust for state sync.
61-
- `trust_period`: Trust period for light client verification.
62-
- `discovery_time`: Time to spend discovering snapshots before picking one.
63-
- `temp_dir`: Directory for temporary state sync files.
64-
- `chunk_request_timeout`: Timeout for chunk requests.
65-
- `chunk_fetchers`: Number of concurrent chunk fetchers.
66-
6770
### Checking if sync is complete
6871

6972
Query for the node status using the REST or GRPC API:

0 commit comments

Comments
 (0)