From 30510b15b56c446245f39defbc2dfed9635e8f33 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Thu, 21 Nov 2024 00:01:35 -0500 Subject: [PATCH 1/4] =?UTF-8?q?fix=20=F0=9F=90=9B:=20Changed=20the=20sheba?= =?UTF-8?q?ngs=20to=20a=20more=20generic=20implementation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed the shebang lines in various shell scripts from `#!/usr/bin/bash` to `#!/usr/bin/env bash` for better portability and compatibility across different environments. This ensures that the scripts will use the bash interpreter found in the user's PATH. This change improves the flexibility of the scripts, allowing them to run correctly on systems where bash is not located in `/usr/bin/bash`. ISSUE: 41 --- etc/generate-jwt.sh | 2 +- scripts/regtest_pegout.sh | 2 +- scripts/start_full_node.sh | 2 +- scripts/start_geth.sh | 2 +- scripts/start_network.sh | 2 +- scripts/start_reth.sh | 2 +- scripts/tests/1_produce_signed_blocks.sh | 2 +- scripts/tests/2_merged_mining.sh | 2 +- scripts/tests/3_peg_in.sh | 2 +- scripts/tests/4_evm.sh | 2 +- scripts/tests/5_peg_out.sh | 2 +- scripts/tests/6_network_e2e.sh | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/etc/generate-jwt.sh b/etc/generate-jwt.sh index 5dcc906..ed2845b 100755 --- a/etc/generate-jwt.sh +++ b/etc/generate-jwt.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # Borrowed from EthStaker's prepare for the merge guide # See https://github.com/remyroy/ethstaker/blob/main/prepare-for-the-merge.md#configuring-a-jwt-token-file diff --git a/scripts/regtest_pegout.sh b/scripts/regtest_pegout.sh index 082b2a7..ec6c54a 100755 --- a/scripts/regtest_pegout.sh +++ b/scripts/regtest_pegout.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/utils/shared.sh diff --git a/scripts/start_full_node.sh b/scripts/start_full_node.sh index a4b7c47..a797bdc 100755 --- a/scripts/start_full_node.sh +++ b/scripts/start_full_node.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/utils/shared.sh diff --git a/scripts/start_geth.sh b/scripts/start_geth.sh index 5c3d40b..d97e194 100755 --- a/scripts/start_geth.sh +++ b/scripts/start_geth.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # Load utility functions from geth.sh SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) BASE_DIR=$(realpath "$SCRIPT_DIR/../") diff --git a/scripts/start_network.sh b/scripts/start_network.sh index 572de81..9b6cd6a 100755 --- a/scripts/start_network.sh +++ b/scripts/start_network.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/utils/shared.sh diff --git a/scripts/start_reth.sh b/scripts/start_reth.sh index eb96fcf..c834562 100755 --- a/scripts/start_reth.sh +++ b/scripts/start_reth.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) diff --git a/scripts/tests/1_produce_signed_blocks.sh b/scripts/tests/1_produce_signed_blocks.sh index 020d6b1..35d4d29 100755 --- a/scripts/tests/1_produce_signed_blocks.sh +++ b/scripts/tests/1_produce_signed_blocks.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh diff --git a/scripts/tests/2_merged_mining.sh b/scripts/tests/2_merged_mining.sh index 474ddb5..d678482 100755 --- a/scripts/tests/2_merged_mining.sh +++ b/scripts/tests/2_merged_mining.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh diff --git a/scripts/tests/3_peg_in.sh b/scripts/tests/3_peg_in.sh index 0b49025..a7ef4b4 100755 --- a/scripts/tests/3_peg_in.sh +++ b/scripts/tests/3_peg_in.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh diff --git a/scripts/tests/4_evm.sh b/scripts/tests/4_evm.sh index 2b41992..4ce226a 100755 --- a/scripts/tests/4_evm.sh +++ b/scripts/tests/4_evm.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh diff --git a/scripts/tests/5_peg_out.sh b/scripts/tests/5_peg_out.sh index c2616b1..0046de6 100755 --- a/scripts/tests/5_peg_out.sh +++ b/scripts/tests/5_peg_out.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh diff --git a/scripts/tests/6_network_e2e.sh b/scripts/tests/6_network_e2e.sh index 981e503..3469cc7 100755 --- a/scripts/tests/6_network_e2e.sh +++ b/scripts/tests/6_network_e2e.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # includes SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . $SCRIPT_DIR/../utils/shared.sh From 3bb3c258d4a9f51a6f79cf07068c8b18a4b07572 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Thu, 21 Nov 2024 00:03:18 -0500 Subject: [PATCH 2/4] =?UTF-8?q?chore=20=F0=9F=8E=AB:=20Removed=20branch=20?= =?UTF-8?q?27=20from=20the=20github=20build=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUE: 41 --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0dc3884..d388a8d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,7 +7,7 @@ name: Docker on: push: - branches: [ "master", "development", "27-btc-sync-optimizations" ] + branches: [ "master", "development" ] # Publish semver tags as releases. tags: [ 'v*.*.*' ] pull_request: From 170c87f9cbbea3cb9ba8d4571c469e249828d47b Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Thu, 21 Nov 2024 00:45:36 -0500 Subject: [PATCH 3/4] =?UTF-8?q?fix=20=F0=9F=90=9B:=20Changed=20logging=20t?= =?UTF-8?q?o=20default=20and=20changed=20levels=20>=3D=20DEBUG=20to=20incl?= =?UTF-8?q?ude=20the=20file=20and=20line=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUE: #43 --- app/src/app.rs | 34 +++++++++++++++++----------------- commit.sh | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/src/app.rs b/app/src/app.rs index 9b9dbdf..704a49a 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -129,29 +129,29 @@ impl App { } fn init_tracing(&self) { - // let rust_log_level = Level::from_str( - // std::env::var("RUST_LOG") - // .unwrap_or("info".to_string()) - // .as_str(), - // ) - // .unwrap(); + let rust_log_level = Level::from_str( + std::env::var("RUST_LOG") + .unwrap_or("info".to_string()) + .as_str(), + ) + .unwrap(); - let filter = EnvFilter::builder().from_env_lossy(); + let filter = EnvFilter::builder().parse_lossy(rust_log_level.as_str()); let main_layer = tracing_subscriber::fmt::layer().with_target(true); - // let layers = if rust_log_level == Level::DEBUG || rust_log_level == Level::TRACE { - // vec![main_layer - // .with_file(true) - // .with_line_number(true) - // .with_filter(filter) - // .boxed()] - // } else { - // vec![main_layer.with_filter(filter).boxed()] - // }; + let layers = if rust_log_level == Level::DEBUG || rust_log_level == Level::TRACE { + vec![main_layer + .with_file(true) + .with_line_number(true) + .with_filter(filter) + .boxed()] + } else { + vec![main_layer.with_filter(filter).boxed()] + }; tracing_subscriber::registry() - .with(vec![main_layer.with_filter(filter).boxed()]) + .with(layers) .init(); } diff --git a/commit.sh b/commit.sh index 092a4d5..beac55b 100755 --- a/commit.sh +++ b/commit.sh @@ -154,7 +154,7 @@ while true; do fi done -COMMIT_BODY=$(echo -e "$GIT_COMMIT_TYPE$BREAKING_CHANGE: $GIT_COMMIT_MESSAGE\n\n$BODY\n\nISSUE: $GITHUB_ISSUE\n") +COMMIT_BODY=$(echo -e "$GIT_COMMIT_TYPE$BREAKING_CHANGE: $GIT_COMMIT_MESSAGE\n\n$BODY\n\nISSUE: #$GITHUB_ISSUE\n") echo -e "\n============================================================\n" From c3f4d046c5dc944f9eab4bf7d684587d3fa87809 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Thu, 21 Nov 2024 00:49:40 -0500 Subject: [PATCH 4/4] =?UTF-8?q?fix=20=F0=9F=90=9B:=20Nodekey=20is=20first?= =?UTF-8?q?=20checked=20for=20existence=20prior=20to=20being=20included=20?= =?UTF-8?q?in=20the=20arguments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUE: #45 --- scripts/utils/geth.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/utils/geth.sh b/scripts/utils/geth.sh index 756ab92..84618b5 100644 --- a/scripts/utils/geth.sh +++ b/scripts/utils/geth.sh @@ -21,6 +21,17 @@ function start_geth() { local LOG_FILE=$(get_log_path $NUM) + # Define the file path + FILE_PATH="${BASE_DIR}/etc/data/execution/node_${NUM}/bootnode.key" + + # Check if the file exists + if [ -f "$FILE_PATH" ]; then + # File exists, include the argument + ARGUMENT="--nodekey \"${BASE_DIR}/etc/data/execution/node_${NUM}/bootnode.key\"" + else + # File does not exist, do not include the argument + ARGUMENT="" + fi # rm -rf "${BASE_DIR}/etc/data/execution/node_${NUM}" # mkdir -p "${BASE_DIR}/etc/data/execution/node_${NUM}" "${BASE_DIR}/etc/data/logs" # touch "$LOG_FILE" @@ -63,7 +74,7 @@ function start_geth() { --metrics.expensive \ --miner.gasprice 1 \ --history.state 0 \ - --nodekey "${BASE_DIR}/etc/data/execution/node_0/bootnode.key" + $ARGUMENT & GETH_PIDS[$NUM]=$! }