Skip to content

Commit 6409a32

Browse files
authored
Add a guide to partially reconstruct historic states to Lighthouse book (#7679)
The main change is adding a guide to partially reconstruct historic states to the FAQ. Other changes: - Update the database scheme info - Delete the Homebrew issue as it has been solved in Homebrew/homebrew-core#225877 - Update default gas limit in: [7cbf7f1](7cbf7f1) - Updated the binary installation page [8076ca7](8076ca7) as Lighthouse now supports aarch-apple binary built since v7.1.0
1 parent 90ff643 commit 6409a32

File tree

5 files changed

+41
-7
lines changed

5 files changed

+41
-7
lines changed

book/src/advanced_builders.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Each field is optional.
114114
```json
115115
{
116116
"builder_proposals": true,
117-
"gas_limit": 30000001
117+
"gas_limit": 45000001
118118
}
119119
```
120120

@@ -127,7 +127,7 @@ curl -X PATCH "http://localhost:5062/lighthouse/validators/0xb0148e6348264131bf4
127127
-H "Content-Type: application/json" \
128128
-d '{
129129
"builder_proposals": true,
130-
"gas_limit": 30000001
130+
"gas_limit": 45000001
131131
}' | jq
132132
```
133133

@@ -161,7 +161,7 @@ You can also directly configure these fields in the `validator_definitions.yml`
161161
voting_keystore_path: /home/paul/.lighthouse/validators/0x87a580d31d7bc69069b55f5a01995a610dd391a26dc9e36e81057a17211983a79266800ab8531f21f1083d7d84085007/voting-keystore.json
162162
voting_keystore_password_path: /home/paul/.lighthouse/secrets/0x87a580d31d7bc69069b55f5a01995a610dd391a26dc9e36e81057a17211983a79266800ab8531f21f1083d7d84085007
163163
suggested_fee_recipient: "0x6cc8dcbca744a6e4ffedb98e1d0df903b10abd21"
164-
gas_limit: 30000001
164+
gas_limit: 45000001
165165
builder_proposals: true
166166
builder_boost_factor: 50
167167
- enabled: false

book/src/faq.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [My beacon node logs `WARN Error signalling fork choice waiter`, what should I do?](#bn-fork-choice)
1515
- [My beacon node logs `ERRO Aggregate attestation queue full`, what should I do?](#bn-queue-full)
1616
- [My beacon node logs `WARN Failed to finalize deposit cache`, what should I do?](#bn-deposit-cache)
17+
- [How can I construct only partial state history?](#bn-partial-history)
1718

1819
## [Validator](#validator-1)
1920

@@ -190,6 +191,40 @@ If the node is syncing or downloading historical blocks, the error should disapp
190191

191192
This is a known [bug](https://github.com/sigp/lighthouse/issues/3707) that will fix by itself.
192193

194+
### <a name="bn-partial-history"></a> How can I construct only partial state history?
195+
196+
Lighthouse prunes finalized states by default. Nevertheless, it is quite often that users may be interested in the state history of a few epochs before finalization. To have access to these pruned states, Lighthouse typically requires a full reconstruction of states using the flag `--reconstruct-historic-states` (which will usually take a week). Partial state history can be achieved with some "tricks". Here are the general steps:
197+
198+
1. Delete the current database. You can do so with `--purge-db-force` or manually deleting the database from the data directory: `$datadir/beacon`.
199+
200+
1. If you are interested in the states from the current slot and beyond, perform a checkpoint sync with the flag `--reconstruct-historic-states`, then you can skip the following and jump straight to Step 5 to check the database.
201+
202+
If you are interested in the states before the current slot, identify the slot to perform a manual checkpoint sync. With the default configuration, this slot should be divisible by 2<sup>21</sup>, as this is where a full state snapshot is stored. With the flag `--reconstruct-historic-states`, the state upper limit will be adjusted to the next full snapshot slot, a slot that satisfies: `slot % 2**21 == 0`. In other words, to have the state history available before the current slot, we have to checkpoint sync 2<sup>21</sup> slots before the next full snapshot slot.
203+
204+
Example: Say the current mainnet is at slot `12000000`. As the next full state snapshot is at slot `12582912`, the slot that we want is slot `10485760`. You can calculate this (in Python) using `12000000 // 2**21 * 2**21`.
205+
206+
1. [Export](./advanced_checkpoint_sync.md#manual-checkpoint-sync) the blobs, block and state data for the slot identified in Step 2. This can be done from another beacon node that you have access to, or you could use any available public beacon API, e.g., [QuickNode](https://www.quicknode.com/docs/ethereum).
207+
208+
1. Perform a [manual checkpoint sync](./advanced_checkpoint_sync.md#manual-checkpoint-sync) using the data from the previous step, and provide the flag `--reconstruct-historic-states`.
209+
210+
1. Check the database:
211+
212+
```bash
213+
curl "http://localhost:5052/lighthouse/database/info" | jq '.anchor'
214+
```
215+
216+
and look for the field `state_upper_limit`. It should show the slot of the snapshot:
217+
218+
```json
219+
"state_upper_limit": "10485760",
220+
```
221+
222+
Lighthouse will now start to reconstruct historic states from slot `10485760`. At this point, if you do not want a full state reconstruction, you may remove the flag `--reconstruct-historic-states` (and restart). When the process is completed, you will have the state data from slot `10485760`. Going forward, Lighthouse will continue retaining all historical states newer than the snapshot. Eventually this can lead to increased disk usage, which presently can only be reduced by repeating the process starting from a more recent snapshot.
223+
224+
> Note: You may only be interested in very recent historic states. To do so, you may configure the full snapshot to be, for example, every 2<sup>11</sup> slots, see [database configuration](./advanced_database.md#hierarchical-state-diffs) for more details. This can be configured with the flag `--hierarchy-exponents 5,7,11` together with the flag `--reconstruct-historic-states`. This will affect the slot number in Step 2, while other steps remain the same. Note that this comes at the expense of a higher storage requirement.
225+
226+
> With `--hierarchy-exponents 5,7,11`, using the same example as above, the next full state snapshot is at slot `12001280`. So the slot to checkpoint sync from is: slot `11999232`.
227+
193228
## Validator
194229

195230
### <a name="vc-redundancy"></a> Can I use redundancy in my staking setup?

book/src/installation_binaries.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on Github](https://github.com/sigp/lighthouse/releases).
66

77
## Platforms
88

9-
Binaries are supplied for four platforms:
9+
Binaries are supplied for five platforms:
1010

1111
- `x86_64-unknown-linux-gnu`: AMD/Intel 64-bit processors (most desktops, laptops, servers)
1212
- `aarch64-unknown-linux-gnu`: 64-bit ARM processors (Raspberry Pi 4)
1313
- `x86_64-apple-darwin`: macOS with Intel chips
14+
- `aarch64-apple-darwin`: macOS with ARM chips
1415
- `x86_64-windows`: Windows with 64-bit processors
1516

1617
## Usage

book/src/installation_homebrew.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ Lighthouse is available on Linux and macOS via the [Homebrew package manager](ht
55
Please note that this installation method is maintained by the Homebrew community.
66
It is not officially supported by the Lighthouse team.
77

8-
> Note: There is a [compilation error](https://github.com/Homebrew/homebrew-core/pull/220922) for Lighthouse v7.0.0 and above that remains unresolved. Users are recommended to download the binary from [the release
9-
page](https://github.com/sigp/lighthouse/releases) or build from source.
10-
118
## Installation
129

1310
Install the latest version of the [`lighthouse`][formula] formula with:

wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Proto
7575
PRs
7676
Prysm
7777
QUIC
78+
QuickNode
7879
RasPi
7980
README
8081
RESTful

0 commit comments

Comments
 (0)