Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 194 additions & 83 deletions scripts/node-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function start_mitmproxy() {
return 0
fi

tmux kill-window -t mitmproxy 2>/dev/null
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"
}

Expand Down Expand Up @@ -370,30 +371,62 @@ function eth-rpc() {
# Build and execute command with optional output redirection
if [ "$record_mode" = "true" ]; then
echo "recording requests to $record_path"
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path") |
lnav
{ set +x; } 2>/dev/null
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
fi
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 | lnav
{ set +x; } 2>/dev/null
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--rpc-port 8546 \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
fi
fi
;;
run)
Expand Down Expand Up @@ -431,28 +464,58 @@ function eth-rpc() {
# Build and execute command with optional output redirection
if [ "$record_mode" = "true" ]; then
echo "recording requests to $record_path"
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path") |
lnav
{ set +x; } 2>/dev/null
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
fi
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 | lnav
{ set +x; } 2>/dev/null
else
set -x
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
fi
fi
;;
*)
Expand Down Expand Up @@ -484,34 +547,70 @@ function eth-rpc() {

# Build and execute command with optional output redirection
if [ "$record_mode" = "true" ]; then
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path") |
lnav
{ set +x; } 2>/dev/null
else
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 |
tee /tmp/eth-rpc.log |
tee >(grep --line-buffered 'recv=' |
grep --line-buffered '\\"method\\":\\"eth_sendRawTransaction\\"' |
sed -u -E 's/.*recv="(.*)"/\1/' |
sed -u 's/\\"/"/g' >"$record_path")
{ set +x; } 2>/dev/null
fi
else
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
# Check if lnav is installed and pipe output to it if available
if command -v lnav &>/dev/null; then
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}" 2>&1 | lnav
{ set +x; } 2>/dev/null
else
set -x
cargo run \
--quiet \
--manifest-path "$POLKADOT_SDK_DIR/Cargo.toml" \
-p pallet-revive-eth-rpc -- \
--log="$RUST_LOG" \
--no-prometheus \
--dev \
--node-rpc-url "$NODE_RPC_URL" \
"${args[@]}"
{ set +x; } 2>/dev/null
fi
fi
;;
esac
Expand All @@ -535,8 +634,6 @@ function revive_dev_stack() {

# Kill existing 'servers' window if it exists
tmux kill-window -t servers 2>/dev/null
# Kill existing 'mitmproxy' window if it exists
tmux kill-window -t mitmproxy 2>/dev/null

# Parse arguments
use_proxy="false"
Expand Down Expand Up @@ -619,6 +716,26 @@ function retester_test() {
{ set +x; } 2>/dev/null
}

function retester_ci {

set -x
cargo run --quiet --release --manifest-path "$RETESTER_DIR/Cargo.toml" -- test \
--platform revive-dev-node-revm-solc \
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/simple" \
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/complex" \
--test "$RETESTER_DIR/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests" \
--concurrency.number-of-nodes 10 \
--concurrency.number-of-threads 10 \
--concurrency.number-of-concurrent-tasks 1000 \
--working-directory "$RETESTER_DIR/workdir" \
--revive-dev-node.consensus instant-seal \
--revive-dev-node.path "$POLKADOT_SDK_DIR/target/debug/revive-dev-node" \
--eth-rpc.path "$POLKADOT_SDK_DIR/target/debug/eth-rpc" \
--resolc.path "$HOME/.cargo/bin/resolc"

{ set +x; } 2>/dev/null
}

# Helper function to endow development accounts in chain spec
# This is shared between westend() and passet() functions
# Usage: endow_dev_accounts <input_spec_path> <output_spec_path>
Expand Down Expand Up @@ -730,7 +847,7 @@ function westend() {
polkadot-omni-node \
--tmp \
--log="$RUST_LOG" \
--dev-block-time 1000 \
--instant-seal \
--no-prometheus \
--chain ~/ah-westend-spec.json 2>&1 | lnav
{ set +x; } 2>/dev/null
Expand All @@ -739,7 +856,7 @@ function westend() {
polkadot-omni-node \
--tmp \
--log="$RUST_LOG" \
--dev-block-time 1000 \
--instant-seal \
--no-prometheus \
--chain ~/ah-westend-spec.json
{ set +x; } 2>/dev/null
Expand Down Expand Up @@ -860,7 +977,7 @@ function passet() {
polkadot-omni-node \
--dev \
--log="$RUST_LOG" \
--dev-block-time 1000 \
--instant-seal \
--no-prometheus \
--no-hardware-benchmarks \
--chain ~/passet-spec.json 2>&1 | lnav
Expand All @@ -870,7 +987,7 @@ function passet() {
polkadot-omni-node \
--dev \
--log="$RUST_LOG" \
--dev-block-time 1000 \
--instant-seal \
--no-prometheus \
--no-hardware-benchmarks \
--chain ~/passet-spec.json
Expand Down Expand Up @@ -1037,8 +1154,6 @@ function geth-dev() {
function geth_stack() {
# Kill existing 'servers' window if it exists
tmux kill-window -t servers 2>/dev/null
# Kill existing 'mitmproxy' window if it exists
tmux kill-window -t mitmproxy 2>/dev/null

# Parse arguments
mode="run"
Expand Down Expand Up @@ -1069,8 +1184,6 @@ function geth_stack() {
function passet_stack() {
# Kill existing 'servers' window if it exists
tmux kill-window -t servers 2>/dev/null
# Kill existing 'mitmproxy' window if it exists
tmux kill-window -t mitmproxy 2>/dev/null

# Parse arguments
use_proxy="false"
Expand Down Expand Up @@ -1109,8 +1222,6 @@ function passet_stack() {
function westend_stack() {
# Kill existing 'servers' window if it exists
tmux kill-window -t servers 2>/dev/null
# Kill existing 'mitmproxy' window if it exists
tmux kill-window -t mitmproxy 2>/dev/null

# Parse arguments
use_proxy="false"
Expand Down
Loading