mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 22:06:21 +00:00
0a4728a241
With checkpoint sync in particular, and state pruning in the future, loading states or state-dependent data may fail. This PR adjusts the code to allow this to be handled gracefully. In particular, the new availability assumption is that states are always available for the finalized checkpoint and newer, but may fail for anything older. The `tail` remains the point where state loading de-facto fails, meaning that between the tail and the finalized checkpoint, we can still get historical data (but code should be prepared to handle this as an error). However, to harden the code against long replays, several operations which are assumed to work only with non-final data (such as gossip verification and validator duties) now limit their search horizon to post-finalized data. * harden several state-dependent operations by logging an error instead of introducing a panic when state loading fails * `withState` -> `withUpdatedState` to differentiate from the other `withState` * `updateStateData` can now fail if no state is found in database - it is also hardened against excessively long replays * `getEpochRef` can now fail when replay fails * reject blocks with invalid target root - they would be ignored previously * fix recursion bug in `isProposed`
Introduction
ncli
is a set of low level / debugging tools to interact with the nimbus beacon chain specification implementation, simliar to zcli. With it, you explore SSZ, make state transitions and compute hash tree roots.
Tools
- transition: Perform state transition given a pre-state and a block to apply (both in SSZ format)
- hash_tree_root: Print tree root of an SSZ object
- pretty: Pretty-print SSZ object as JSON
Building
Follow the instructions from nimbus-eth2
git clone https://github.com/status-im/nimbus-eth2.git
cd nimbus-eth2
make
Usage
# Build with minimal config
../env.sh nim c -d:const_preset=minimal ncli_transition
# Build with mainnet config
../env.sh nim c -d:const_preset=mainnet ncli_transition
# Run..
./ncli_transition --help