ops: add chain138 and rpc diagnostic tooling
This commit is contained in:
72
scripts/maintenance/apply-2103-thirdweb-strict-tx-pool.sh
Executable file
72
scripts/maintenance/apply-2103-thirdweb-strict-tx-pool.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tighten Besu layered tx-pool on VMID 2103 (Thirdweb admin core) only, so a single
|
||||
# sender cannot fill the local pool with far-future / gap nonces (e.g. 15 when next is 1).
|
||||
#
|
||||
# - Sets tx-pool-max-future-by-sender=1 (do NOT use 0: Besu 24+ can log IndexOutOfBounds in
|
||||
# SparseTransactions on new blocks when 0 is set; observed 2026-04-22 on 2103).
|
||||
# - Restarts besu-rpc. Optional: purge local pool after restart (arg --purge) via clear-rpc-2103-txpool.
|
||||
#
|
||||
# Usage: ./scripts/maintenance/apply-2103-thirdweb-strict-tx-pool.sh [--purge] [--value N]
|
||||
# --value N default 1
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||||
|
||||
VAL="${VAL:-1}"
|
||||
PURGE=false
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--purge) PURGE=true; shift ;;
|
||||
--value) VAL="$2"; shift 2 ;;
|
||||
*) echo "Unknown: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
HOST="${PROXMOX_R630_01:-${PROXMOX_HOST_R630_01:-192.168.11.11}}"
|
||||
VMID=2103
|
||||
CFG_PCT="/etc/besu/config-rpc.toml"
|
||||
SSH="root@${HOST}"
|
||||
|
||||
echo "=== 2103 tx-pool: tx-pool-max-future-by-sender=$VAL (Thirdweb path only) ==="
|
||||
echo "Host: $HOST LXC: $VMID config: $CFG_PCT (inside LXC)"
|
||||
echo ""
|
||||
|
||||
if ! ssh -o ConnectTimeout=8 -o StrictHostKeyChecking=no "$SSH" "pct list | grep -q '$VMID'"; then
|
||||
echo "VMID $VMID not on $HOST" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$VAL" -le 0 ]]; then
|
||||
echo "Refusing: value 0 is unsafe on current Besu (SparseTransactions/IndexOutOfBounds). Use 1 or more." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$SSH" "pct exec $VMID -- bash -c '
|
||||
set -e
|
||||
cp -a $CFG_PCT ${CFG_PCT}.bak.\$(date +%Y%m%d%H%M%S)
|
||||
if ! grep -qE \"^tx-pool-max-future-by-sender=\" $CFG_PCT; then
|
||||
echo \"[ERROR] $CFG_PCT has no tx-pool-max-future-by-sender= line; add it manually.\" >&2
|
||||
exit 1
|
||||
fi
|
||||
sed -i \"s/^tx-pool-max-future-by-sender=.*/tx-pool-max-future-by-sender=$VAL/\" $CFG_PCT
|
||||
grep -E \"^tx-pool-max-future-by-sender=\" $CFG_PCT
|
||||
systemctl restart besu-rpc
|
||||
sleep 3
|
||||
systemctl is-active besu-rpc
|
||||
'"
|
||||
|
||||
if [[ "$PURGE" == "true" ]]; then
|
||||
echo ""
|
||||
echo "=== Purging 2103 local pool ==="
|
||||
"${PROJECT_ROOT}/scripts/clear-rpc-2103-txpool.sh"
|
||||
else
|
||||
echo "Done. Optional: --purge to also run clear-rpc-2103-txpool.sh"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Next: from Thirdweb, use the nonce returned by eth_getTransactionCount(deployer, 'pending'|'latest')."
|
||||
echo "A send at nonce 15 will be rejected (NONCE_TOO_FAR) until nonces 1,2,… are broadcast with the deployer key outside Thirdweb, if the chain is still behind."
|
||||
@@ -12,6 +12,7 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||||
[ -f "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" ] && source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" 2>/dev/null || true
|
||||
|
||||
DRY_RUN=false
|
||||
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true
|
||||
@@ -25,14 +26,24 @@ log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_ok() { echo -e "${GREEN}[✓]${NC} $1"; }
|
||||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
|
||||
validator_host() {
|
||||
local vmid="$1"
|
||||
if type get_host_for_vmid >/dev/null 2>&1; then
|
||||
get_host_for_vmid "$vmid"
|
||||
elif [[ "$vmid" -le 1002 ]]; then
|
||||
echo "${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
else
|
||||
echo "${PROXMOX_HOST_ML110:-192.168.11.10}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Order: restart one at a time; wait between so restarted node can sync from others
|
||||
# VMID : host
|
||||
VALIDATORS=(
|
||||
"1004:${PROXMOX_HOST_R630_03:-192.168.11.13}"
|
||||
"1003:${PROXMOX_HOST_R630_03:-192.168.11.13}"
|
||||
"1002:${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
"1001:${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
"1000:${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
"1004:$(validator_host 1004)"
|
||||
"1003:$(validator_host 1003)"
|
||||
"1002:$(validator_host 1002)"
|
||||
"1001:$(validator_host 1001)"
|
||||
"1000:$(validator_host 1000)"
|
||||
)
|
||||
WAIT_BETWEEN=90
|
||||
RPC="${RPC_URL_138:-http://192.168.11.211:8545}"
|
||||
|
||||
@@ -11,18 +11,28 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
[[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ]] && source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||||
[[ -f "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" ]] && source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh" 2>/dev/null || true
|
||||
|
||||
R630_01="${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
||||
ML110="${PROXMOX_ML110:-192.168.11.10}"
|
||||
SSH_OPTS="-o ConnectTimeout=15 -o StrictHostKeyChecking=accept-new"
|
||||
|
||||
# Validators: 1000,1001,1002 on r630-01; 1003,1004 on ml110
|
||||
validator_host() {
|
||||
local vmid="$1"
|
||||
if type get_host_for_vmid >/dev/null 2>&1; then
|
||||
get_host_for_vmid "$vmid"
|
||||
elif [[ "$vmid" -le 1002 ]]; then
|
||||
echo "$R630_01"
|
||||
else
|
||||
echo "${PROXMOX_HOST_ML110:-192.168.11.10}"
|
||||
fi
|
||||
}
|
||||
|
||||
VALIDATORS=(
|
||||
"1000:$R630_01"
|
||||
"1001:$R630_01"
|
||||
"1002:$R630_01"
|
||||
"1003:$ML110"
|
||||
"1004:$ML110"
|
||||
"1000:$(validator_host 1000)"
|
||||
"1001:$(validator_host 1001)"
|
||||
"1002:$(validator_host 1002)"
|
||||
"1003:$(validator_host 1003)"
|
||||
"1004:$(validator_host 1004)"
|
||||
)
|
||||
|
||||
DRY_RUN=false
|
||||
|
||||
Reference in New Issue
Block a user