mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 05:52:45 +00:00
2b2846b468
* implement forked state/block support * merge support for containsOrphan; import cleanup; 80-column lines * add merge block header operations and slot sanity fixture * add epoch state transition tests; implement is_valid_gas_limit(), is_merge_block(), is_execution_enabled(), and compute_timestamp_at_slot() * implement process_execution_payload() and add merge deposit operations tests * add merge block sanity tests * add merge case to syncCommitteeParticipants * v1.1.0-beta.5 updates * reduce getTestStates-based memory usage; don't try to REST-serialize ExecutionPayload transactions without underlying support * add execution payload tests; switch var to let in tests/official/
66 lines
2.3 KiB
Nim
66 lines
2.3 KiB
Nim
# beacon_chain
|
|
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
|
# Licensed and distributed under either of
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
import
|
|
std/[os, strformat],
|
|
chronicles,
|
|
./spec/[eth2_ssz_serialization, eth2_merkleization],
|
|
./spec/datatypes/[phase0, altair, merge],
|
|
./consensus_object_pools/block_pools_types
|
|
|
|
# Dump errors are generally not fatal where used currently - the code calling
|
|
# these functions, like most code, is not exception safe
|
|
template logErrors(body: untyped) =
|
|
try:
|
|
body
|
|
except CatchableError as err:
|
|
notice "Failed to write SSZ", dir, msg = err.msg
|
|
|
|
proc dump*(dir: string, v: AttestationData, validator: ValidatorPubKey) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"att-{v.slot}-{v.index}-{shortLog(validator)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: phase0.TrustedSignedBeaconBlock) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(v.root)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: altair.TrustedSignedBeaconBlock) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(v.root)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: phase0.SignedBeaconBlock) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(v.root)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: altair.SignedBeaconBlock) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(v.root)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: merge.SignedBeaconBlock) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(v.root)}.ssz", v)
|
|
|
|
proc dump*(dir: string, v: SomeHashedBeaconState, blck: BlockRef) =
|
|
mixin saveFile
|
|
logErrors:
|
|
SSZ.saveFile(
|
|
dir / &"state-{v.data.slot}-{shortLog(blck.root)}-{shortLog(v.root)}.ssz",
|
|
v.data)
|
|
|
|
proc dump*(dir: string, v: SomeHashedBeaconState) =
|
|
mixin saveFile
|
|
logErrors:
|
|
SSZ.saveFile(
|
|
dir / &"state-{v.data.slot}-{shortLog(v.root)}.ssz",
|
|
v.data)
|
|
|
|
proc dump*(dir: string, v: SyncCommitteeMessage, validator: ValidatorPubKey) =
|
|
logErrors:
|
|
SSZ.saveFile(dir / &"sync-committee-msg-{v.slot}-{shortLog(validator)}.ssz", v)
|