77d843df17
- Updated foundry.toml with correct libs path and OpenZeppelin remappings. - Captured gas snapshot for Counter::test_Increment (30385 gas). - Created scripts/load_test.py (stdlib-only, 500 TPS target against any JSON-RPC). - Created scripts/run_smoke_tests.sh to orchestrate mock RPC + load test + Foundry build. - Installed forge-std and openzeppelin-contracts dependencies. Co-Authored-By: Paperclip <noreply@paperclip.ing>
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# run_smoke_tests.sh — quick validation suite for the JCC devnet stack.
|
|
# Requires: Python 3.x, nothing else (stdlib only).
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# 1. Start mock RPC gateway in background
|
|
python3 "${SCRIPT_DIR}/rpc_gateway_mock.py" --port 8545 --latency 5 &
|
|
RPC_PID=$!
|
|
function cleanup_rpc() {
|
|
kill "$RPC_PID" 2>/dev/null || true
|
|
}
|
|
trap cleanup_rpc EXIT
|
|
|
|
# Wait for mock to be ready
|
|
sleep 2
|
|
|
|
# 2. RPC gateway smoke (eth_getBalance, eth_sendTransaction)
|
|
echo "=== RPC Gateway Smoke ==="
|
|
curl -sf http://localhost:8545 -X POST -H "Content-Type: application/json" \
|
|
-d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x0000000000000000000000000000000000000000","latest"],"id":1}' || { echo "RPC getBalance failed"; exit 1; }
|
|
|
|
echo "eth_getBalance OK"
|
|
|
|
# 3. Load test against mock (short burst to prove harness)
|
|
echo "=== Load Test (mock, 10s) ==="
|
|
python3 "${SCRIPT_DIR}/load_test.py" --url http://localhost:8545 --method eth_getBalance --duration 10 --workers 4 --rps 500
|
|
|
|
# 4. Foundry compile + test
|
|
echo "=== Foundry Build + Test ==="
|
|
cd "${SCRIPT_DIR}/../contracts"
|
|
forge build
|
|
forge test
|
|
forge snapshot
|
|
|
|
echo "=== All smoke tests passed ==="
|