Skip to content

Commit c979ba4

Browse files
committed
fixes
1 parent c979ca6 commit c979ba4

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ eth-rpc build
9494

9595
These commands will compile the binaries into `~/polkadot-sdk/target/debug/`. The build process may take some time on the first run.
9696

97+
> **Note**: The helper scripts use the `POLKADOT_SDK_DIR` environment variable to locate the Polkadot SDK repository. By default, it points to `~/polkadot-sdk`. If you cloned the repository to a different location, you can override this by setting the environment variable before sourcing the scripts:
98+
> ```sh
99+
> export POLKADOT_SDK_DIR=/path/to/your/polkadot-sdk
100+
> source scripts/node-env.sh
101+
> ```
102+
97103
# Testing Tips
98104
99105
## Running the Revive Stack

scripts/node-env.sh

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ else
1313
SHELL_RC="$HOME/.${CURRENT_SHELL}rc"
1414
fi
1515

16+
# Polkadot SDK directory path (can be overridden by environment variable)
17+
POLKADOT_SDK_DIR="${POLKADOT_SDK_DIR:-$HOME/polkadot-sdk}"
18+
1619
# Environment variables for Polkadot and Ethereum RPC URLs
1720
export ETH_MAINNET_HTTP_URL=https://eth.llamarpc.com
1821

@@ -173,9 +176,6 @@ function dev-node() {
173176
# Set default logging levels (can be overridden by environment variable)
174177
RUST_LOG="${RUST_LOG:-error,sc_rpc_server=info,runtime::revive=debug}"
175178

176-
# Define the polkadot-sdk directory path
177-
POLKADOT_SDK_DIR=~/polkadot-sdk
178-
179179
# Validate the polkadot-sdk directory
180180
if ! validate_polkadot_sdk_dir "$POLKADOT_SDK_DIR"; then
181181
return 1
@@ -255,9 +255,6 @@ function eth-rpc() {
255255
# Set default logging levels (can be overridden by environment variable)
256256
RUST_LOG="${RUST_LOG:-info,eth-rpc=debug,jsonrpsee-server=trace}"
257257

258-
# Define the polkadot-sdk directory path
259-
POLKADOT_SDK_DIR=~/polkadot-sdk
260-
261258
# Validate the polkadot-sdk directory
262259
if ! validate_polkadot_sdk_dir "$POLKADOT_SDK_DIR"; then
263260
return 1
@@ -316,8 +313,8 @@ function eth-rpc() {
316313

317314
# Build and execute command with optional output redirection
318315
PS4=' '
319-
set -x
320316
if [ "$record_mode" = "true" ]; then
317+
set -x
321318
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
322319
--log="$RUST_LOG" \
323320
--no-prometheus \
@@ -331,16 +328,18 @@ function eth-rpc() {
331328
sed -u -E 's/.*recv="(.*)"/\1/' |
332329
sed -u 's/\\"/"/g' \
333330
>/tmp/eth-rpc-requests.log)
331+
{ set +x; } 2>/dev/null
334332
else
333+
set -x
335334
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
336335
--log="$RUST_LOG" \
337336
--no-prometheus \
338337
--dev \
339338
--rpc-port 8546 \
340339
--node-rpc-url "$NODE_RPC_URL" \
341340
"${args[@]}"
341+
{ set +x; } 2>/dev/null
342342
fi
343-
{ set +x; } 2>/dev/null
344343
;;
345344
run)
346345
# Run pre-built binary from target/debug or target/release
@@ -371,8 +370,8 @@ function eth-rpc() {
371370

372371
# Build and execute command with optional output redirection
373372
PS4=' '
374-
set -x
375373
if [ "$record_mode" = "true" ]; then
374+
set -x
376375
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
377376
--log="$RUST_LOG" \
378377
--no-prometheus \
@@ -385,15 +384,17 @@ function eth-rpc() {
385384
sed -u -E 's/.*recv="(.*)"/\1/' |
386385
sed -u 's/\\"/"/g' \
387386
>/tmp/eth-rpc-requests.log)
387+
{ set +x; } 2>/dev/null
388388
else
389+
set -x
389390
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
390391
--log="$RUST_LOG" \
391392
--no-prometheus \
392393
--dev \
393394
--node-rpc-url "$NODE_RPC_URL" \
394395
"${args[@]}"
396+
{ set +x; } 2>/dev/null
395397
fi
396-
{ set +x; } 2>/dev/null
397398
;;
398399
*)
399400
# Default: build and run in one command using cargo run
@@ -419,8 +420,8 @@ function eth-rpc() {
419420

420421
# Build and execute command with optional output redirection
421422
PS4=' '
422-
set -x
423423
if [ "$record_mode" = "true" ]; then
424+
set -x
424425
cargo run \
425426
--quiet \
426427
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
@@ -436,7 +437,9 @@ function eth-rpc() {
436437
sed -u -E 's/.*recv="(.*)"/\1/' |
437438
sed -u 's/\\"/"/g' \
438439
>/tmp/eth-rpc-requests.log)
440+
{ set +x; } 2>/dev/null
439441
else
442+
set -x
440443
cargo run \
441444
--quiet \
442445
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
@@ -446,8 +449,8 @@ function eth-rpc() {
446449
--dev \
447450
--node-rpc-url "$NODE_RPC_URL" \
448451
"${args[@]}"
452+
{ set +x; } 2>/dev/null
449453
fi
450-
{ set +x; } 2>/dev/null
451454
;;
452455
esac
453456
}
@@ -461,9 +464,6 @@ function eth-rpc() {
461464
# revive_dev_stack no-proxy - Run both services with debug binaries without proxy
462465
# revive_dev_stack --release no-proxy - Run both services with release binaries without proxy
463466
function revive_dev_stack() {
464-
# Define the polkadot-sdk directory path
465-
POLKADOT_SDK_DIR=~/polkadot-sdk
466-
467467
# Validate the polkadot-sdk directory
468468
if ! validate_polkadot_sdk_dir "$POLKADOT_SDK_DIR"; then
469469
return 1
@@ -543,9 +543,6 @@ function westend() {
543543
# Capture the first argument as the command
544544
arg=$1
545545

546-
# Define the polkadot-sdk directory path
547-
POLKADOT_SDK_DIR=~/polkadot-sdk
548-
549546
# Validate the polkadot-sdk directory
550547
if ! validate_polkadot_sdk_dir "$POLKADOT_SDK_DIR"; then
551548
return 1

0 commit comments

Comments
 (0)