mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
Fix bug in lcli transition-blocks and improve pretty-ssz (#4513)
## Proposed Changes - Fix bad `state_root` reuse in `lcli transition-blocks` that resulted in invalid results at skipped slots. - Modernise `lcli pretty-ssz` to include fork-generic decoders for `SignedBeaconBlock` and `BeaconState` which respect the `--network`/`--testnet-dir` flag. ## Additional Info Breaking change: the underscore names like `signed_block_merge` are removed in favour of the fork-generic name `SignedBeaconBlock`, and fork-specific names which match the superstruct variants, e.g. `SignedBeaconBlockMerge`.
This commit is contained in:
@@ -73,9 +73,10 @@ use eth2::{
|
||||
};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use ssz::Encode;
|
||||
use state_processing::state_advance::complete_state_advance;
|
||||
use state_processing::{
|
||||
block_signature_verifier::BlockSignatureVerifier, per_block_processing, per_slot_processing,
|
||||
BlockSignatureStrategy, ConsensusContext, StateProcessingStrategy, VerifyBlockRoot,
|
||||
block_signature_verifier::BlockSignatureVerifier, per_block_processing, BlockSignatureStrategy,
|
||||
ConsensusContext, StateProcessingStrategy, VerifyBlockRoot,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use std::fs::File;
|
||||
@@ -332,10 +333,8 @@ fn do_transition<T: EthSpec>(
|
||||
|
||||
// Transition the parent state to the block slot.
|
||||
let t = Instant::now();
|
||||
for i in pre_state.slot().as_u64()..block.slot().as_u64() {
|
||||
per_slot_processing(&mut pre_state, Some(state_root), spec)
|
||||
.map_err(|e| format!("Failed to advance slot on iteration {}: {:?}", i, e))?;
|
||||
}
|
||||
complete_state_advance(&mut pre_state, Some(state_root), block.slot(), spec)
|
||||
.map_err(|e| format!("Unable to perform complete advance: {e:?}"))?;
|
||||
debug!("Slot processing: {:?}", t.elapsed());
|
||||
|
||||
let t = Instant::now();
|
||||
|
||||
Reference in New Issue
Block a user