Skip to content

Commit d254084

Browse files
authored
Merge pull request #27 from paritytech/pg/env-update
env script updates
2 parents fc5c394 + 9141e1a commit d254084

File tree

1 file changed

+58
-4
lines changed

1 file changed

+58
-4
lines changed

scripts/node-env.sh

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,15 @@ function eth-rpc() {
618618

619619
# Runs the complete Revive development stack (dev-node + eth-rpc) in tmux window
620620
# This starts both the development node and Ethereum RPC bridge in separate panes
621-
# Usage: revive_dev_stack [--release] [--retester] [--proxy] [--record[=path]]
621+
# Usage: revive_dev_stack [--release] [--retester] [--proxy] [--record[=path]] [--build]
622622
# Flags:
623623
# --release Use release binaries instead of debug
624624
# --retester Use retester chainspec
625625
# --proxy Enable mitmproxy for traffic inspection
626626
# --record[=path] Record eth_sendRawTransaction requests (default: /tmp/eth-rpc-requests.log)
627+
# --build Build dev-node and eth-rpc before starting
627628
# Example:
628-
# revive_dev_stack --release --proxy --retester --record=/my/custom/path.log
629+
# revive_dev_stack --release --proxy --retester --record=/my/custom/path.log --build
629630
function revive_dev_stack() {
630631
# Validate the polkadot-sdk directory
631632
if ! validate_polkadot_sdk_dir "$POLKADOT_SDK_DIR"; then
@@ -640,6 +641,7 @@ function revive_dev_stack() {
640641
build_type=""
641642
retester_flag=""
642643
record_arg=""
644+
build_flag="false"
643645

644646
for arg in "$@"; do
645647
case "$arg" in
@@ -658,9 +660,19 @@ function revive_dev_stack() {
658660
--record=*)
659661
record_arg="$arg"
660662
;;
663+
--build)
664+
build_flag="true"
665+
;;
661666
esac
662667
done
663668

669+
# Build binaries if requested
670+
if [ "$build_flag" = "true" ]; then
671+
echo "Building dev-node and eth-rpc..."
672+
dev-node build $build_type $retester_flag
673+
eth-rpc build $build_type
674+
fi
675+
664676
# Determine which mode to use for dev-node and eth-rpc
665677
if [ "$use_proxy" = "true" ]; then
666678
mode="proxy"
@@ -717,15 +729,47 @@ function retester_test() {
717729
}
718730

719731
function retester_ci {
732+
# Parse arguments
733+
local num_nodes=10
734+
local num_threads=10
735+
736+
while [[ $# -gt 0 ]]; do
737+
case "$1" in
738+
--nodes)
739+
if [[ -n "$2" && "$2" =~ ^[0-9]+$ ]]; then
740+
num_nodes="$2"
741+
shift 2
742+
else
743+
echo "Error: --nodes requires a numeric argument"
744+
return 1
745+
fi
746+
;;
747+
--threads)
748+
if [[ -n "$2" && "$2" =~ ^[0-9]+$ ]]; then
749+
num_threads="$2"
750+
shift 2
751+
else
752+
echo "Error: --threads requires a numeric argument"
753+
return 1
754+
fi
755+
;;
756+
*)
757+
echo "Unknown argument: $1"
758+
return 1
759+
;;
760+
esac
761+
done
762+
763+
find "$RETESTER_DIR/workdir" -maxdepth 1 -name "*.json" -type f -delete 2>/dev/null
720764

721765
set -x
722766
cargo run --quiet --release --manifest-path "$RETESTER_DIR/Cargo.toml" -- test \
723767
--platform revive-dev-node-revm-solc \
724768
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/simple" \
725769
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/complex" \
726770
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests" \
727-
--concurrency.number-of-nodes 10 \
728-
--concurrency.number-of-threads 10 \
771+
--concurrency.number-of-nodes "$num_nodes" \
772+
--concurrency.number-of-threads "$num_threads" \
729773
--concurrency.number-of-concurrent-tasks 1000 \
730774
--working-directory "$RETESTER_DIR/workdir" \
731775
--revive-dev-node.consensus instant-seal \
@@ -734,6 +778,16 @@ function retester_ci {
734778
--resolc.path "$HOME/.cargo/bin/resolc"
735779

736780
{ set +x; } 2>/dev/null
781+
782+
# Find the JSON report file and move it
783+
json_file=$(find "$RETESTER_DIR/workdir" -maxdepth 1 -name "*.json" -type f | head -n 1)
784+
if [ -n "$json_file" ]; then
785+
mv "$json_file" report.json
786+
python3 "$POLKADOT_SDK_DIR/.github/scripts/process-differential-tests-report.py" report.json revive-solc
787+
else
788+
echo "Error: No JSON report file found in $RETESTER_DIR/workdir"
789+
return 1
790+
fi
737791
}
738792

739793
# Helper function to endow development accounts in chain spec

0 commit comments

Comments
 (0)