cleanups (#962)
* remove broken serialized_sizes * actually use sszdump module * avoid bitops * fix stack_sizes module name
This commit is contained in:
parent
2449d4b479
commit
01e9df97cb
2
Makefile
2
Makefile
|
@ -23,7 +23,7 @@ TOOLS := \
|
|||
ncli_pretty \
|
||||
ncli_transition \
|
||||
process_dashboard \
|
||||
stackSizes \
|
||||
stack_sizes \
|
||||
state_sim \
|
||||
block_sim
|
||||
# bench_bls_sig_agggregation TODO reenable after bls v0.10.1 changes
|
||||
|
|
|
@ -24,7 +24,7 @@ import
|
|||
attestation_pool, block_pool, eth2_network, eth2_discovery,
|
||||
beacon_node_types, mainchain_monitor, version, ssz, ssz/dynamic_navigator,
|
||||
sync_protocol, request_manager, validator_keygen, interop, statusbar,
|
||||
attestation_aggregation, sync_manager, state_transition
|
||||
attestation_aggregation, sync_manager, state_transition, sszdump
|
||||
|
||||
const
|
||||
genesisFile = "genesis.ssz"
|
||||
|
@ -373,10 +373,7 @@ proc sendAttestation(node: BeaconNode,
|
|||
getAttestationTopic(node.forkDigest, attestationData.index), attestation)
|
||||
|
||||
if node.config.dumpEnabled:
|
||||
SSZ.saveFile(
|
||||
node.config.dumpDir / "att-" & $attestationData.slot & "-" &
|
||||
$attestationData.index & "-" & validator.pubKey.shortLog &
|
||||
".ssz", attestation)
|
||||
dump(node.config.dumpDir, attestationData, validator.pubKey)
|
||||
|
||||
info "Attestation sent",
|
||||
attestation = shortLog(attestation),
|
||||
|
@ -452,15 +449,10 @@ proc proposeBlock(node: BeaconNode,
|
|||
cat = "consensus"
|
||||
|
||||
if node.config.dumpEnabled:
|
||||
SSZ.saveFile(
|
||||
node.config.dumpDir / "block-" & $newBlock.message.slot & "-" &
|
||||
shortLog(newBlockRef.root) & ".ssz", newBlock)
|
||||
dump(node.config.dumpDir, newBlock, newBlockRef)
|
||||
node.blockPool.withState(
|
||||
node.blockPool.tmpState, newBlockRef.atSlot(newBlockRef.slot)):
|
||||
SSZ.saveFile(
|
||||
node.config.dumpDir / "state-" & $state.slot & "-" &
|
||||
shortLog(newBlockRef.root) & "-" & shortLog(root()) & ".ssz",
|
||||
state)
|
||||
dump(node.config.dumpDir, hashedState, newBlockRef)
|
||||
|
||||
node.network.broadcast(node.topicBeaconBlocks, newBlock)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
{.push raises: [Defect].}
|
||||
|
||||
import
|
||||
bitops, chronicles, options, tables,
|
||||
stew/results, ssz, beacon_chain_db, state_transition, extras, eth/db/kvstore,
|
||||
chronicles, options, tables,
|
||||
stew/[bitops2, results], ssz, beacon_chain_db, state_transition, extras, eth/db/kvstore,
|
||||
beacon_node_types, metrics,
|
||||
spec/[crypto, datatypes, digest, helpers, validator]
|
||||
|
||||
|
@ -638,7 +638,7 @@ func checkMissing*(pool: var BlockPool): seq[FetchRecord] =
|
|||
|
||||
# simple (simplistic?) exponential backoff for retries..
|
||||
for k, v in pool.missing.pairs():
|
||||
if v.tries.popcount() == 1:
|
||||
if countOnes(v.tries.uint64) == 1:
|
||||
result.add(FetchRecord(root: k, historySlots: v.slots))
|
||||
|
||||
proc skipAndUpdateState(
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
import
|
||||
os,
|
||||
os, strformat,
|
||||
ssz,
|
||||
serialization,
|
||||
beacon_node_types,
|
||||
./spec/[crypto, datatypes, digest]
|
||||
|
||||
proc dump*(dir: string, v: AttestationData, validator: ValidatorPubKey) =
|
||||
SSZ.saveFile(
|
||||
dir / "att-" & $v.slot & "-" &
|
||||
$v.index & "-" & validator.shortLog &
|
||||
".ssz", v)
|
||||
SSZ.saveFile(dir / &"att-{v.slot}-{v.index}-{shortLog(validator)}.ssz", v)
|
||||
|
||||
proc dump*(dir: string, v: SignedBeaconBlock, blck: BlockRef) =
|
||||
SSZ.saveFile(
|
||||
dir / "block-" & $v.message.slot & "-" &
|
||||
shortLog(blck.root) & ".ssz", v)
|
||||
SSZ.saveFile(dir / &"block-{v.message.slot}-{shortLog(blck.root)}.ssz", v)
|
||||
|
||||
proc dump*(dir: string, v: HashedBeaconState, blck: BlockRef) =
|
||||
SSZ.saveFile(
|
||||
dir / "state-" & $v.data.slot & "-" &
|
||||
shortLog(blck.root) & "-" & shortLog(v.root) & ".ssz",
|
||||
dir / &"state-{v.data.slot}-{shortLog(blck.root)}-{shortLog(v.root)}.ssz",
|
||||
v.data)
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
import
|
||||
confutils,
|
||||
../beacon_chain/[extras, ssz],
|
||||
../beacon_chain/spec/[beaconstate, datatypes, digest],
|
||||
../tests/testblockutil
|
||||
|
||||
proc stateSize(deposits: int, maxContent = false) =
|
||||
var state = initialize_beacon_state_from_eth1(
|
||||
Eth2Digest(), 0,
|
||||
makeInitialDeposits(deposits, {skipBLSValidation}), {skipBLSValidation})
|
||||
|
||||
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 = BitSeq.init(validatorsPerCommittee)
|
||||
echo "Validators: ", deposits, ", total: ", SSZ.encode(state).len
|
||||
|
||||
dispatch(stateSize)
|
|
@ -1 +0,0 @@
|
|||
-d:debugFieldSizes
|
|
@ -0,0 +1 @@
|
|||
-u:metrics
|
Loading…
Reference in New Issue