mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 05:52:45 +00:00
a086cf01ac
* fix stack overflow crash in REST/debug/getStateV2 * introduce `ForkyXxx` for generic type matching of `Xxx` across branches (SomeHashedBeaconState -> ForkyHashedBeaconState et al) - `Some` is already used for other types of type classes * consolidate function naming in BeaconChainDB, use some generics * import `forks.nim` from other spec modules and move `Forked*` helpers around to resolve circular imports * remove `ForkedBeaconState`, use `ForkedHashedBeaconState` throughout (less data shuffling between the types) * fix several cases of states being stored on stack in tests, causing random failures on some platforms * remove reading json support from ncli - this should be ported to the rest json reading instead (doesn't currently work because stack sizes)
25 lines
470 B
Nim
25 lines
470 B
Nim
import ../beacon_chain/spec/datatypes/phase0
|
|
|
|
import typetraits, strformat, strutils
|
|
|
|
proc print(t: auto, n: string, indent: int) =
|
|
echo fmt"{sizeof(t):>8} {spaces(indent)}{n}: {typeof(t).name}"
|
|
|
|
when t is object|tuple:
|
|
for n, p in t.fieldPairs:
|
|
print(p, n, indent + 1)
|
|
|
|
print((ref BeaconState)()[], "state", 0)
|
|
|
|
echo ""
|
|
|
|
print(SignedBeaconBlock(), "block", 0)
|
|
|
|
echo ""
|
|
|
|
print(Validator(), "validator", 0)
|
|
|
|
echo ""
|
|
|
|
print(Attestation(), "attestation", 0)
|