2018-12-17 18:03:53 +00:00
|
|
|
import
|
2019-01-23 18:45:15 +00:00
|
|
|
confutils,
|
2018-12-27 23:40:22 +00:00
|
|
|
../beacon_chain/[extras, ssz],
|
2019-03-20 20:01:48 +00:00
|
|
|
../beacon_chain/spec/[beaconstate, bitfield, datatypes, digest, validator],
|
2019-01-23 18:45:15 +00:00
|
|
|
../tests/testutil
|
2018-12-17 18:03:53 +00:00
|
|
|
|
2018-12-27 20:14:37 +00:00
|
|
|
proc stateSize(deposits: int, maxContent = false) =
|
2019-02-22 09:56:45 +00:00
|
|
|
var state = get_genesis_beacon_state(
|
2019-02-28 21:21:29 +00:00
|
|
|
makeInitialDeposits(
|
|
|
|
deposits, {skipValidation}), 0, Eth1Data(), {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
|
2019-02-20 01:33:58 +00:00
|
|
|
state.latest_attestations.setLen(MAX_ATTESTATIONS * SLOTS_PER_EPOCH * 2)
|
2019-01-26 19:52:30 +00:00
|
|
|
let
|
2019-03-12 22:21:32 +00:00
|
|
|
crosslink_committees = get_crosslink_committees_at_slot(state, 0.Slot)
|
2019-01-26 19:52:30 +00:00
|
|
|
validatorsPerCommittee =
|
2019-02-06 19:37:25 +00:00
|
|
|
len(crosslink_committees[0].committee) # close enough..
|
2018-12-27 20:14:37 +00:00
|
|
|
for a in state.latest_attestations.mitems():
|
2019-03-20 20:01:48 +00:00
|
|
|
a.aggregation_bitfield = BitField.init(validatorsPerCommittee)
|
2019-03-12 13:38:58 +00:00
|
|
|
echo "Validators: ", deposits, ", total: ", SSZ.encode(state).len
|
2018-12-17 18:03:53 +00:00
|
|
|
|
2018-12-27 20:14:37 +00:00
|
|
|
dispatch(stateSize)
|