Skip to content

Commit 1a29d05

Browse files
committed
docs/node/run-your-node: Fix state sync documentation
Add new `oasis network trust` command. Also removed the part that suggested taking latest height as a trust, which won't work for the stateful nodes.
1 parent 97467f0 commit 1a29d05

1 file changed

Lines changed: 21 additions & 77 deletions

File tree

docs/node/run-your-node/advanced/sync-node-using-state-sync.md

Lines changed: 21 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,23 @@ penalized for their misbehaviour and you may be tricked into following the wrong
9898

9999
:::
100100

101-
We recommend using `trust_period=288h` (12 days). This way the time required
102-
to verify headers, submit possible misbehavior evidence and penalize nodes
103-
is still less than the debonding period, giving nodes strong incentive not to lie.
101+
To obtain recommended trust period run Oasis CLI's [trust command][oasis-network-trust].
104102

105-
### Obtaining Trusted Height and Hash
103+
With current consensus parameters, setting `trust_period` to any value between `220-290h`
104+
(9-12 days) is optimal. This way the time required to verify headers, submit possible misbehavior evidence
105+
and penalize nodes is still less than the debonding period, giving remote peers strong incentive not to lie.
106+
Moreover, it enables configuring sufficiently old trust as will be explained in the next section.
106107

107-
:::caution
108+
[oasis-network-trust]: https://github.com/oasisprotocol/cli/blob/master/docs/network.md#trust
108109

109-
Currently, checkpoints happen approximately once per week. It is important to set
110-
sufficiently old trusted height and hash, so that the network has at least one
111-
checkpoint that is more recent than the configured trust.
110+
### Obtaining Trusted Height and Hash
112111

113-
:::
112+
It is important to set sufficiently old trust, so that the network has at least one
113+
checkpoint that is more recent than the configured trust. At the same time, for the trust to be valid,
114+
it should not be older than the trust period obtained above.
114115

115-
We recommend configuring trusted header that is around 10 days old. This way
116-
there will be checkpoints available and the trust will still be shorter than
117-
the debonding period.
116+
Currently, checkpoints happen approximately once per week. E.g. assuming a trust period
117+
of 12 days, a 10 days old trust is recommended.
118118

119119
To obtain the trusted height and the corresponding block header's hash, use one
120120
of the following options.
@@ -126,49 +126,24 @@ fetch and compare data from multiple sources.
126126

127127
:::
128128

129+
#### Oasis CLI
130+
131+
If you have Oasis CLI conected to an existing node that you trust, or if your
132+
trust assumptions are fine with using (default) public grpc endpoints (e.g. testnet)
133+
run CLI's [trust command][oasis-network-trust].
134+
129135
#### Block Explorers
130136

131137
Browse to one of our block explorers (e.g. [Oasis Explorer], [Oasis Scan]) and
132138
obtain the trusted height and hash there:
133139

134-
1. Obtain the block height (10 days old) from the main page, e.g. 4819139.
140+
1. Assuming a trust period of 12 days, obtain the block height that is 10 days old from the main page, e.g. 4819139.
135141
2. Click on block height's number to view the block's details and obtain its
136142
hash, e.g. `377520acaf7b8011b95686b548504a973aa414abba2db070b6a85725dec7bd21`.
137143

138144
[Oasis Explorer]: https://explorer.oasis.io/
139145
[Oasis Scan]: https://www.oasisscan.com
140146

141-
#### A Trusted Node
142-
143-
If you have an existing node that you trust, you can use its status output to
144-
retrieve the current block height and hash by running:
145-
146-
```bash
147-
oasis-node control status -a unix:/node/data/internal.sock
148-
```
149-
150-
This will give you output like the following (non-relevant fields omitted):
151-
152-
```json
153-
{
154-
"software_version": "23.0.5",
155-
"identity": {
156-
...
157-
},
158-
"consensus": {
159-
...
160-
"latest_height": 18466200,
161-
"latest_hash": "9611c81c7e231a281f1de491047a833364f97c38142a80abd65ce41bce123378",
162-
"latest_time": "2023-11-27T08:31:15Z",
163-
"latest_epoch": 30760,
164-
...
165-
},
166-
...
167-
}
168-
```
169-
170-
the values you need are `latest_height` and `latest_hash`.
171-
172147
#### Public Rosetta Gateway
173148

174149
First obtain the network's Genesis document's hash (e.g. from the Networks Parameters Page):
@@ -206,8 +181,8 @@ This will give you output like the following (non-relevant fields omitted):
206181
}
207182
```
208183

209-
Assuming blocks happen every 6 seconds, subtract around `140_000` blocks to
210-
get the height that is around 10 days old and query again:
184+
Assuming a trust period of 12 days and blocks happening every 6 seconds,
185+
subtract around `140_000` blocks (cca 10 days) and query again:
211186

212187
```bash
213188
curl -X POST https://rosetta.oasis.io/api/block \
@@ -236,34 +211,3 @@ The values you need are `index` and `hash`:
236211
}
237212
}
238213
```
239-
240-
#### Oasis CLI
241-
242-
Query our public Oasis node's endpoint using the Oasis CLI and obtain the
243-
trusted height and hash there:
244-
245-
```bash
246-
oasis network status
247-
```
248-
249-
This will give you output like the following (non-relevant fields omitted):
250-
251-
```json
252-
{
253-
"software_version": "23.0.5",
254-
"identity": {
255-
...
256-
},
257-
"consensus": {
258-
...
259-
"latest_height": 18466200,
260-
"latest_hash": "9611c81c7e231a281f1de491047a833364f97c38142a80abd65ce41bce123378",
261-
"latest_time": "2023-11-27T08:31:15Z",
262-
"latest_epoch": 30760,
263-
...
264-
},
265-
...
266-
}
267-
```
268-
269-
The values you need are `latest_height` and `latest_hash` .

0 commit comments

Comments
 (0)