2018-12-17 18:03:53 +00:00
|
|
|
import
|
2018-12-27 23:40:22 +00:00
|
|
|
../beacon_chain/[extras, ssz],
|
2018-12-27 20:14:37 +00:00
|
|
|
../beacon_chain/spec/[beaconstate, datatypes, digest],
|
|
|
|
../tests/testutil,
|
|
|
|
cligen
|
2018-12-17 18:03:53 +00:00
|
|
|
|
2018-12-27 20:14:37 +00:00
|
|
|
proc stateSize(deposits: int, maxContent = false) =
|
|
|
|
var state = get_initial_beacon_state(
|
2018-12-27 23:40:22 +00:00
|
|
|
makeInitialDeposits(deposits), 0, Eth2Digest(), {skipValidation})
|
2018-12-17 18:03:53 +00:00
|
|
|
|
2018-12-27 20:14:37 +00:00
|
|
|
if maxContent:
|
|
|
|
# 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 * EPOCH_LENGTH * 2)
|
|
|
|
let validatorsPerCommittee =
|
|
|
|
len(state.shard_committees_at_slots[0][0].committee) # close enough..
|
|
|
|
for a in state.latest_attestations.mitems():
|
|
|
|
a.participation_bitfield.setLen(validatorsPerCommittee)
|
2018-12-17 18:03:53 +00:00
|
|
|
echo "Validators: ", deposits, ", total: ", state.serialize().len
|
|
|
|
|
2018-12-27 20:14:37 +00:00
|
|
|
dispatch(stateSize)
|