nimbus-eth2/research/stack_sizes.nim
Jacek Sieka a086cf01ac
altair fork handling cleanups (#3050)
* 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)
2021-11-05 08:34:34 +01:00

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)