mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 05:52:45 +00:00
save ssz dummps during processing (#471)
This commit is contained in:
parent
c457904a61
commit
afc0686b36
@ -373,6 +373,12 @@ proc sendAttestation(node: BeaconNode,
|
|||||||
|
|
||||||
node.network.broadcast(topicAttestations, attestation)
|
node.network.broadcast(topicAttestations, attestation)
|
||||||
|
|
||||||
|
if node.config.dump:
|
||||||
|
SSZ.saveFile(
|
||||||
|
node.config.dumpDir / "att-" & $attestationData.slot & "-" &
|
||||||
|
$attestationData.index & "-" & validator.pubKey.shortLog &
|
||||||
|
".ssz", attestation)
|
||||||
|
|
||||||
info "Attestation sent",
|
info "Attestation sent",
|
||||||
attestationData = shortLog(attestationData),
|
attestationData = shortLog(attestationData),
|
||||||
validator = shortLog(validator),
|
validator = shortLog(validator),
|
||||||
@ -482,6 +488,15 @@ proc proposeBlock(node: BeaconNode,
|
|||||||
validator = shortLog(validator),
|
validator = shortLog(validator),
|
||||||
cat = "consensus"
|
cat = "consensus"
|
||||||
|
|
||||||
|
if node.config.dump:
|
||||||
|
SSZ.saveFile(
|
||||||
|
node.config.dumpDir / "block-" & $newBlock.slot & "-" &
|
||||||
|
shortLog(newBlockRef.root) & ".ssz", newBlock)
|
||||||
|
SSZ.saveFile(
|
||||||
|
node.config.dumpDir / "state-" & $tmpState.data.slot & "-" &
|
||||||
|
shortLog(newBlockRef.root) & "-" & shortLog(tmpState.root) & ".ssz",
|
||||||
|
tmpState.data)
|
||||||
|
|
||||||
node.network.broadcast(topicBeaconBlocks, newBlock)
|
node.network.broadcast(topicBeaconBlocks, newBlock)
|
||||||
|
|
||||||
beacon_blocks_proposed.inc()
|
beacon_blocks_proposed.inc()
|
||||||
|
@ -136,6 +136,11 @@ type
|
|||||||
desc: "Listening HTTP port of the metrics server."
|
desc: "Listening HTTP port of the metrics server."
|
||||||
name: "metrics-server-port" }: uint16
|
name: "metrics-server-port" }: uint16
|
||||||
|
|
||||||
|
dump* {.
|
||||||
|
defaultValue: false
|
||||||
|
desc: "Write SSZ dumps of blocks, attestations and states to data dir"
|
||||||
|
.}: bool
|
||||||
|
|
||||||
of createTestnet:
|
of createTestnet:
|
||||||
validatorsDir* {.
|
validatorsDir* {.
|
||||||
desc: "Directory containing validator descriptors named 'vXXXXXXX.deposit.json'."
|
desc: "Directory containing validator descriptors named 'vXXXXXXX.deposit.json'."
|
||||||
@ -243,3 +248,6 @@ proc defaultDataDir*(conf: BeaconNodeConf): string =
|
|||||||
proc validatorFileBaseName*(validatorIdx: int): string =
|
proc validatorFileBaseName*(validatorIdx: int): string =
|
||||||
# there can apparently be tops 4M validators so we use 7 digits..
|
# there can apparently be tops 4M validators so we use 7 digits..
|
||||||
fmt"v{validatorIdx:07}"
|
fmt"v{validatorIdx:07}"
|
||||||
|
|
||||||
|
func dumpDir*(conf: BeaconNodeConf): string =
|
||||||
|
conf.dataDir / "dump"
|
||||||
|
@ -56,6 +56,7 @@ cli do (testnetName {.argument.}: string):
|
|||||||
dataDirName = testnetName.replace("/", "_")
|
dataDirName = testnetName.replace("/", "_")
|
||||||
dataDir = buildDir / "data" / dataDirName
|
dataDir = buildDir / "data" / dataDirName
|
||||||
validatorsDir = dataDir / "validators"
|
validatorsDir = dataDir / "validators"
|
||||||
|
dumpDir = dataDir / "dump"
|
||||||
beaconNodeBinary = buildDir / "beacon_node_" & dataDirName
|
beaconNodeBinary = buildDir / "beacon_node_" & dataDirName
|
||||||
nimFlags = "-d:chronicles_log_level=DEBUG " & getEnv("NIM_PARAMS")
|
nimFlags = "-d:chronicles_log_level=DEBUG " & getEnv("NIM_PARAMS")
|
||||||
|
|
||||||
@ -75,6 +76,8 @@ cli do (testnetName {.argument.}: string):
|
|||||||
cd rootDir
|
cd rootDir
|
||||||
exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim"""
|
exec &"""nim c {nimFlags} -d:"const_preset={preset}" -o:"{beaconNodeBinary}" beacon_chain/beacon_node.nim"""
|
||||||
|
|
||||||
|
mkDir dumpDir
|
||||||
|
|
||||||
if depositContractOpt.len > 0 and not system.dirExists(validatorsDir):
|
if depositContractOpt.len > 0 and not system.dirExists(validatorsDir):
|
||||||
mode = Silent
|
mode = Silent
|
||||||
echo "Would you like to become a validator (you'll need access to 32 GoETH)? [Yn]"
|
echo "Would you like to become a validator (you'll need access to 32 GoETH)? [Yn]"
|
||||||
@ -101,6 +104,7 @@ cli do (testnetName {.argument.}: string):
|
|||||||
mode = Verbose
|
mode = Verbose
|
||||||
exec replace(&"""{beaconNodeBinary}
|
exec replace(&"""{beaconNodeBinary}
|
||||||
--data-dir="{dataDir}"
|
--data-dir="{dataDir}"
|
||||||
|
--dump=true
|
||||||
--bootstrap-file="{testnetDir/bootstrapFile}"
|
--bootstrap-file="{testnetDir/bootstrapFile}"
|
||||||
--state-snapshot="{testnetDir/genesisFile}" """ & depositContractOpt, "\n", " ")
|
--state-snapshot="{testnetDir/genesisFile}" """ & depositContractOpt, "\n", " ")
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ if [[ $NODE_ID -lt $TOTAL_NODES ]]; then
|
|||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "$DATA_DIR/dump"
|
||||||
|
mkdir -p "$DATA_DIR/dump"
|
||||||
|
|
||||||
$BEACON_NODE_BIN \
|
$BEACON_NODE_BIN \
|
||||||
--bootstrap-file=$BOOTSTRAP_ADDRESS_FILE \
|
--bootstrap-file=$BOOTSTRAP_ADDRESS_FILE \
|
||||||
--data-dir=$DATA_DIR \
|
--data-dir=$DATA_DIR \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user