nimbus-eth2/research/serialized_sizes.nim
Dustin Brody dfa062db7d 0.8.0, continued (#315)
* rename get_genesis_beacon_state(...) to initialize_beacon_state_from_eth1(...); remove unused vestiges get_temporary_block_header(...) and get_empty_block(...); partly align initialize_beacon_state_from_eth1(...) with 0.8.0 version; implement CompactCommittee object type; update process_final_updates(...) to 0.8.0

* mark get_shard_delta(...) as 0.8.0

* mark get_total_active_balance(...) and epoch transition helper functions as 0.8.0

* move FORK_CHOICE_BALANCE_INCREMENT, not in spec anymore, to sole user in fork_choice
2019-07-10 14:23:02 +02:00

30 lines
1.2 KiB
Nim

import
confutils,
../beacon_chain/[extras, ssz],
../beacon_chain/spec/[beaconstate, bitfield, datatypes, digest, validator],
../tests/testutil
proc stateSize(deposits: int, maxContent = false) =
var state = initialize_beacon_state_from_eth1(
makeInitialDeposits(
deposits, {skipValidation}), 0, Eth1Data(), {skipValidation})
if maxContent:
# TODO: state.latest_attestations was removed
# in https://github.com/status-im/nim-beacon-chain/pull/195
raise newException(ValueError, "Not supported at the moment")
# # TODO verify this is correct, but generally we collect up to two epochs
# # of attestations, and each block has a cap on the number of
# # attestations it may hold, so we'll just add so many of them
# state.latest_attestations.setLen(MAX_ATTESTATIONS * SLOTS_PER_EPOCH * 2)
# let
# crosslink_committees = get_crosslink_committees_at_slot(state, 0.Slot)
# validatorsPerCommittee =
# len(crosslink_committees[0].committee) # close enough..
# for a in state.latest_attestations.mitems():
# a.aggregation_bits = BitField.init(validatorsPerCommittee)
echo "Validators: ", deposits, ", total: ", SSZ.encode(state).len
dispatch(stateSize)