From ff1e07783c13a1c1ad3831342041b855f49c93ee Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 12 Dec 2022 12:12:39 +0200 Subject: [PATCH] Local simulation suitable for capturing light client syncing data --- Makefile | 22 +++++++++++----------- beacon_chain/spec/crypto.nim | 6 +++--- beacon_chain/spec/digest.nim | 2 +- scripts/launch_local_testnet.sh | 8 ++++++-- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 889e06603..769104547 100644 --- a/Makefile +++ b/Makefile @@ -201,20 +201,20 @@ local-testnet-minimal: ./scripts/launch_local_testnet.sh \ --data-dir $@ \ --preset minimal \ - --nodes 4 \ - --stop-at-epoch 6 \ + --nodes 1 \ --disable-htop \ --enable-logtrace \ - --base-port $$(( 6001 + EXECUTOR_NUMBER * 500 )) \ - --base-rest-port $$(( 6031 + EXECUTOR_NUMBER * 500 )) \ - --base-metrics-port $$(( 6061 + EXECUTOR_NUMBER * 500 )) \ - --base-vc-metrics-port $$(( 6161 + EXECUTOR_NUMBER * 500 )) \ - --base-remote-signer-port $$(( 6201 + EXECUTOR_NUMBER * 500 )) \ - --base-el-net-port $$(( 6301 + EXECUTOR_NUMBER * 500 )) \ - --base-el-http-port $$(( 6302 + EXECUTOR_NUMBER * 500 )) \ - --base-el-ws-port $$(( 6303 + EXECUTOR_NUMBER * 500 )) \ - --base-el-auth-rpc-port $$(( 6304 + EXECUTOR_NUMBER * 500 )) \ + --base-port $$(( 8001 + EXECUTOR_NUMBER * 500 )) \ + --base-rest-port $$(( 8031 + EXECUTOR_NUMBER * 500 )) \ + --base-metrics-port $$(( 8061 + EXECUTOR_NUMBER * 500 )) \ + --base-vc-metrics-port $$(( 8161 + EXECUTOR_NUMBER * 500 )) \ + --base-remote-signer-port $$(( 8201 + EXECUTOR_NUMBER * 500 )) \ + --base-el-net-port $$(( 8301 + EXECUTOR_NUMBER * 500 )) \ + --base-el-http-port $$(( 8302 + EXECUTOR_NUMBER * 500 )) \ + --base-el-ws-port $$(( 8303 + EXECUTOR_NUMBER * 500 )) \ + --base-el-auth-rpc-port $$(( 8304 + EXECUTOR_NUMBER * 500 )) \ --el-port-offset 5 \ + --disable-vc \ --timeout 648 \ --kill-old-processes \ $(TESTNET_EXTRA_FLAGS) \ diff --git a/beacon_chain/spec/crypto.nim b/beacon_chain/spec/crypto.nim index c4afdc6fc..c935459bd 100644 --- a/beacon_chain/spec/crypto.nim +++ b/beacon_chain/spec/crypto.nim @@ -450,18 +450,18 @@ template fromSszBytes*(T: type[ValidatorPubKey | ValidatorSig], bytes: openArray func shortLog*(x: ValidatorPubKey | ValidatorSig): string = ## Logging for wrapped BLS types ## that may contain valid or non-validated data - byteutils.toHex(x.blob.toOpenArray(0, 3)) + byteutils.toHex(x.blob) func shortLog*(x: CookedPubKey): string = let raw = x.toRaw() - byteutils.toHex(raw.toOpenArray(0, 3)) + byteutils.toHex(raw) func shortLog*(x: ValidatorPrivKey): string = ## Logging for raw unwrapped BLS types "" func shortLog*(x: TrustedSig): string = - byteutils.toHex(x.data.toOpenArray(0, 3)) + byteutils.toHex(x.data) # Initialization # ---------------------------------------------------------------------- diff --git a/beacon_chain/spec/digest.nim b/beacon_chain/spec/digest.nim index 77f1c075c..df6b0a480 100644 --- a/beacon_chain/spec/digest.nim +++ b/beacon_chain/spec/digest.nim @@ -80,7 +80,7 @@ func `$`*(x: Eth2Digest): string = x.data.toHex() func shortLog*(x: Eth2Digest): string = - x.data.toOpenArray(0, 3).toHex() + x.data.toHex() chronicles.formatIt Eth2Digest: shortLog(it) diff --git a/scripts/launch_local_testnet.sh b/scripts/launch_local_testnet.sh index caa904b8e..8ffa5300c 100755 --- a/scripts/launch_local_testnet.sh +++ b/scripts/launch_local_testnet.sh @@ -357,7 +357,7 @@ SECRETS_DIR="${DATA_DIR}/secrets" scripts/makedir.sh "${SECRETS_DIR}" USER_VALIDATORS=8 -TOTAL_VALIDATORS=1024 +TOTAL_VALIDATORS=128 # "Make" binary if [[ "${OS}" == "windows" ]]; then @@ -821,7 +821,7 @@ dump_logtrace() { fi } -NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-4} +NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-1} BOOTSTRAP_NODE=0 SYSTEM_VALIDATORS=$(( TOTAL_VALIDATORS - USER_VALIDATORS )) VALIDATORS_PER_NODE=$(( SYSTEM_VALIDATORS / NODES_WITH_VALIDATORS )) @@ -993,6 +993,10 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do --data-dir="${CONTAINER_NODE_DATA_DIR}" \ ${BOOTSTRAP_ARG} \ "${WEB3_ARG[@]}" \ + --dump:on \ + --light-client-data-serve=on \ + --light-client-data-import-mode=full \ + --light-client-data-max-periods=999999 \ ${STOP_AT_EPOCH_FLAG} \ ${KEYMANAGER_FLAG} \ --keymanager-token-file="${DATA_DIR}/keymanager-token" \