Skip to content

Commit f9727b9

Browse files
committed
node-env fixes
1 parent a1867b7 commit f9727b9

File tree

2 files changed

+359
-83
lines changed

2 files changed

+359
-83
lines changed

scripts/node-env.sh

Lines changed: 194 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function start_mitmproxy() {
171171
return 0
172172
fi
173173

174+
tmux kill-window -t mitmproxy 2>/dev/null
174175
tmux new-window -d -n mitmproxy "cd $HOME/mitmproxy; source venv/bin/activate; mitmproxy --listen-port $listen_port --mode reverse:http://localhost:${proxy_port} -s $HOME/mitmproxy/scripts/json-rpc.py; tmux wait-for -S mitmproxy-done"
175176
}
176177

@@ -370,30 +371,62 @@ function eth-rpc() {
370371
# Build and execute command with optional output redirection
371372
if [ "$record_mode" = "true" ]; then
372373
echo "recording requests to $record_path"
373-
set -x
374-
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
375-
--log="$RUST_LOG" \
376-
--no-prometheus \
377-
--dev \
378-
--rpc-port 8546 \
379-
--node-rpc-url "$NODE_RPC_URL" \
380-
"${args[@]}" 2>&1 |
381-
tee /tmp/eth-rpc.log |
382-
tee >(grep --line-buffered 'recv=' |
383-
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
384-
sed -u -E 's/.*recv="(.*)"/\1/' |
385-
sed -u 's/\\"/"/g' >"$record_path")
386-
{ set +x; } 2>/dev/null
374+
# Check if lnav is installed and pipe output to it if available
375+
if command -v lnav &>/dev/null; then
376+
set -x
377+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
378+
--log="$RUST_LOG" \
379+
--no-prometheus \
380+
--dev \
381+
--rpc-port 8546 \
382+
--node-rpc-url "$NODE_RPC_URL" \
383+
"${args[@]}" 2>&1 |
384+
tee /tmp/eth-rpc.log |
385+
tee >(grep --line-buffered 'recv=' |
386+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
387+
sed -u -E 's/.*recv="(.*)"/\1/' |
388+
sed -u 's/\\"/"/g' >"$record_path") |
389+
lnav
390+
{ set +x; } 2>/dev/null
391+
else
392+
set -x
393+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
394+
--log="$RUST_LOG" \
395+
--no-prometheus \
396+
--dev \
397+
--rpc-port 8546 \
398+
--node-rpc-url "$NODE_RPC_URL" \
399+
"${args[@]}" 2>&1 |
400+
tee /tmp/eth-rpc.log |
401+
tee >(grep --line-buffered 'recv=' |
402+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
403+
sed -u -E 's/.*recv="(.*)"/\1/' |
404+
sed -u 's/\\"/"/g' >"$record_path")
405+
{ set +x; } 2>/dev/null
406+
fi
387407
else
388-
set -x
389-
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
390-
--log="$RUST_LOG" \
391-
--no-prometheus \
392-
--dev \
393-
--rpc-port 8546 \
394-
--node-rpc-url "$NODE_RPC_URL" \
395-
"${args[@]}"
396-
{ set +x; } 2>/dev/null
408+
# Check if lnav is installed and pipe output to it if available
409+
if command -v lnav &>/dev/null; then
410+
set -x
411+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
412+
--log="$RUST_LOG" \
413+
--no-prometheus \
414+
--dev \
415+
--rpc-port 8546 \
416+
--node-rpc-url "$NODE_RPC_URL" \
417+
"${args[@]}" 2>&1 | lnav
418+
{ set +x; } 2>/dev/null
419+
else
420+
set -x
421+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
422+
--log="$RUST_LOG" \
423+
--no-prometheus \
424+
--dev \
425+
--rpc-port 8546 \
426+
--node-rpc-url "$NODE_RPC_URL" \
427+
"${args[@]}"
428+
{ set +x; } 2>/dev/null
429+
fi
397430
fi
398431
;;
399432
run)
@@ -431,28 +464,58 @@ function eth-rpc() {
431464
# Build and execute command with optional output redirection
432465
if [ "$record_mode" = "true" ]; then
433466
echo "recording requests to $record_path"
434-
set -x
435-
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
436-
--log="$RUST_LOG" \
437-
--no-prometheus \
438-
--dev \
439-
--node-rpc-url "$NODE_RPC_URL" \
440-
"${args[@]}" 2>&1 |
441-
tee /tmp/eth-rpc.log |
442-
tee >(grep --line-buffered 'recv=' |
443-
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
444-
sed -u -E 's/.*recv="(.*)"/\1/' |
445-
sed -u 's/\\"/"/g' >"$record_path")
446-
{ set +x; } 2>/dev/null
467+
# Check if lnav is installed and pipe output to it if available
468+
if command -v lnav &>/dev/null; then
469+
set -x
470+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
471+
--log="$RUST_LOG" \
472+
--no-prometheus \
473+
--dev \
474+
--node-rpc-url "$NODE_RPC_URL" \
475+
"${args[@]}" 2>&1 |
476+
tee /tmp/eth-rpc.log |
477+
tee >(grep --line-buffered 'recv=' |
478+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
479+
sed -u -E 's/.*recv="(.*)"/\1/' |
480+
sed -u 's/\\"/"/g' >"$record_path") |
481+
lnav
482+
{ set +x; } 2>/dev/null
483+
else
484+
set -x
485+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
486+
--log="$RUST_LOG" \
487+
--no-prometheus \
488+
--dev \
489+
--node-rpc-url "$NODE_RPC_URL" \
490+
"${args[@]}" 2>&1 |
491+
tee /tmp/eth-rpc.log |
492+
tee >(grep --line-buffered 'recv=' |
493+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
494+
sed -u -E 's/.*recv="(.*)"/\1/' |
495+
sed -u 's/\\"/"/g' >"$record_path")
496+
{ set +x; } 2>/dev/null
497+
fi
447498
else
448-
set -x
449-
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
450-
--log="$RUST_LOG" \
451-
--no-prometheus \
452-
--dev \
453-
--node-rpc-url "$NODE_RPC_URL" \
454-
"${args[@]}"
455-
{ set +x; } 2>/dev/null
499+
# Check if lnav is installed and pipe output to it if available
500+
if command -v lnav &>/dev/null; then
501+
set -x
502+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
503+
--log="$RUST_LOG" \
504+
--no-prometheus \
505+
--dev \
506+
--node-rpc-url "$NODE_RPC_URL" \
507+
"${args[@]}" 2>&1 | lnav
508+
{ set +x; } 2>/dev/null
509+
else
510+
set -x
511+
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
512+
--log="$RUST_LOG" \
513+
--no-prometheus \
514+
--dev \
515+
--node-rpc-url "$NODE_RPC_URL" \
516+
"${args[@]}"
517+
{ set +x; } 2>/dev/null
518+
fi
456519
fi
457520
;;
458521
*)
@@ -484,34 +547,70 @@ function eth-rpc() {
484547

485548
# Build and execute command with optional output redirection
486549
if [ "$record_mode" = "true" ]; then
487-
set -x
488-
cargo run \
489-
--quiet \
490-
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
491-
-p pallet-revive-eth-rpc -- \
492-
--log="$RUST_LOG" \
493-
--no-prometheus \
494-
--dev \
495-
--node-rpc-url "$NODE_RPC_URL" \
496-
"${args[@]}" 2>&1 |
497-
tee /tmp/eth-rpc.log |
498-
tee >(grep --line-buffered 'recv=' |
499-
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
500-
sed -u -E 's/.*recv="(.*)"/\1/' |
501-
sed -u 's/\\"/"/g' >"$record_path")
502-
{ set +x; } 2>/dev/null
550+
# Check if lnav is installed and pipe output to it if available
551+
if command -v lnav &>/dev/null; then
552+
set -x
553+
cargo run \
554+
--quiet \
555+
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
556+
-p pallet-revive-eth-rpc -- \
557+
--log="$RUST_LOG" \
558+
--no-prometheus \
559+
--dev \
560+
--node-rpc-url "$NODE_RPC_URL" \
561+
"${args[@]}" 2>&1 |
562+
tee /tmp/eth-rpc.log |
563+
tee >(grep --line-buffered 'recv=' |
564+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
565+
sed -u -E 's/.*recv="(.*)"/\1/' |
566+
sed -u 's/\\"/"/g' >"$record_path") |
567+
lnav
568+
{ set +x; } 2>/dev/null
569+
else
570+
set -x
571+
cargo run \
572+
--quiet \
573+
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
574+
-p pallet-revive-eth-rpc -- \
575+
--log="$RUST_LOG" \
576+
--no-prometheus \
577+
--dev \
578+
--node-rpc-url "$NODE_RPC_URL" \
579+
"${args[@]}" 2>&1 |
580+
tee /tmp/eth-rpc.log |
581+
tee >(grep --line-buffered 'recv=' |
582+
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
583+
sed -u -E 's/.*recv="(.*)"/\1/' |
584+
sed -u 's/\\"/"/g' >"$record_path")
585+
{ set +x; } 2>/dev/null
586+
fi
503587
else
504-
set -x
505-
cargo run \
506-
--quiet \
507-
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
508-
-p pallet-revive-eth-rpc -- \
509-
--log="$RUST_LOG" \
510-
--no-prometheus \
511-
--dev \
512-
--node-rpc-url "$NODE_RPC_URL" \
513-
"${args[@]}"
514-
{ set +x; } 2>/dev/null
588+
# Check if lnav is installed and pipe output to it if available
589+
if command -v lnav &>/dev/null; then
590+
set -x
591+
cargo run \
592+
--quiet \
593+
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
594+
-p pallet-revive-eth-rpc -- \
595+
--log="$RUST_LOG" \
596+
--no-prometheus \
597+
--dev \
598+
--node-rpc-url "$NODE_RPC_URL" \
599+
"${args[@]}" 2>&1 | lnav
600+
{ set +x; } 2>/dev/null
601+
else
602+
set -x
603+
cargo run \
604+
--quiet \
605+
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
606+
-p pallet-revive-eth-rpc -- \
607+
--log="$RUST_LOG" \
608+
--no-prometheus \
609+
--dev \
610+
--node-rpc-url "$NODE_RPC_URL" \
611+
"${args[@]}"
612+
{ set +x; } 2>/dev/null
613+
fi
515614
fi
516615
;;
517616
esac
@@ -535,8 +634,6 @@ function revive_dev_stack() {
535634

536635
# Kill existing 'servers' window if it exists
537636
tmux kill-window -t servers 2>/dev/null
538-
# Kill existing 'mitmproxy' window if it exists
539-
tmux kill-window -t mitmproxy 2>/dev/null
540637

541638
# Parse arguments
542639
use_proxy="false"
@@ -619,6 +716,26 @@ function retester_test() {
619716
{ set +x; } 2>/dev/null
620717
}
621718

719+
function retester_ci {
720+
721+
set -x
722+
cargo run --quiet --release --manifest-path "$RETESTER_DIR/Cargo.toml" -- test \
723+
--platform revive-dev-node-revm-solc \
724+
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/simple" \
725+
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/complex" \
726+
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests" \
727+
--concurrency.number-of-nodes 10 \
728+
--concurrency.number-of-threads 10 \
729+
--concurrency.number-of-concurrent-tasks 1000 \
730+
--working-directory "$RETESTER_DIR/workdir" \
731+
--revive-dev-node.consensus instant-seal \
732+
--revive-dev-node.path "$POLKADOT_SDK_DIR/target/debug/revive-dev-node" \
733+
--eth-rpc.path "$POLKADOT_SDK_DIR/target/debug/eth-rpc" \
734+
--resolc.path "$HOME/.cargo/bin/resolc"
735+
736+
{ set +x; } 2>/dev/null
737+
}
738+
622739
# Helper function to endow development accounts in chain spec
623740
# This is shared between westend() and passet() functions
624741
# Usage: endow_dev_accounts <input_spec_path> <output_spec_path>
@@ -730,7 +847,7 @@ function westend() {
730847
polkadot-omni-node \
731848
--tmp \
732849
--log="$RUST_LOG" \
733-
--dev-block-time 1000 \
850+
--instant-seal \
734851
--no-prometheus \
735852
--chain ~/ah-westend-spec.json 2>&1 | lnav
736853
{ set +x; } 2>/dev/null
@@ -739,7 +856,7 @@ function westend() {
739856
polkadot-omni-node \
740857
--tmp \
741858
--log="$RUST_LOG" \
742-
--dev-block-time 1000 \
859+
--instant-seal \
743860
--no-prometheus \
744861
--chain ~/ah-westend-spec.json
745862
{ set +x; } 2>/dev/null
@@ -860,7 +977,7 @@ function passet() {
860977
polkadot-omni-node \
861978
--dev \
862979
--log="$RUST_LOG" \
863-
--dev-block-time 1000 \
980+
--instant-seal \
864981
--no-prometheus \
865982
--no-hardware-benchmarks \
866983
--chain ~/passet-spec.json 2>&1 | lnav
@@ -870,7 +987,7 @@ function passet() {
870987
polkadot-omni-node \
871988
--dev \
872989
--log="$RUST_LOG" \
873-
--dev-block-time 1000 \
990+
--instant-seal \
874991
--no-prometheus \
875992
--no-hardware-benchmarks \
876993
--chain ~/passet-spec.json
@@ -1037,8 +1154,6 @@ function geth-dev() {
10371154
function geth_stack() {
10381155
# Kill existing 'servers' window if it exists
10391156
tmux kill-window -t servers 2>/dev/null
1040-
# Kill existing 'mitmproxy' window if it exists
1041-
tmux kill-window -t mitmproxy 2>/dev/null
10421157

10431158
# Parse arguments
10441159
mode="run"
@@ -1069,8 +1184,6 @@ function geth_stack() {
10691184
function passet_stack() {
10701185
# Kill existing 'servers' window if it exists
10711186
tmux kill-window -t servers 2>/dev/null
1072-
# Kill existing 'mitmproxy' window if it exists
1073-
tmux kill-window -t mitmproxy 2>/dev/null
10741187

10751188
# Parse arguments
10761189
use_proxy="false"
@@ -1109,8 +1222,6 @@ function passet_stack() {
11091222
function westend_stack() {
11101223
# Kill existing 'servers' window if it exists
11111224
tmux kill-window -t servers 2>/dev/null
1112-
# Kill existing 'mitmproxy' window if it exists
1113-
tmux kill-window -t mitmproxy 2>/dev/null
11141225

11151226
# Parse arguments
11161227
use_proxy="false"

0 commit comments

Comments
 (0)