Wire HDHomeRun observations and recover Forge OP Stack

This commit is contained in:
every.channel 2026-05-03 20:24:04 -07:00
parent 8065860449
commit 0d86104762
No known key found for this signature in database
18 changed files with 1613 additions and 58 deletions

View file

@ -7,6 +7,8 @@ l1_rpc_url="${EVERY_CHANNEL_OP_STACK_L1_RPC_URL:-https://ethereum-sepolia-rpc.pu
l1_beacon_url="${EVERY_CHANNEL_OP_STACK_L1_BEACON_URL:-https://ethereum-sepolia-beacon-api.publicnode.com}"
chain_id="${EVERY_CHANNEL_OP_STACK_CHAIN_ID:-245245}"
p2p_advertise_ip="${EVERY_CHANNEL_OP_STACK_P2P_ADVERTISE_IP:-127.0.0.1}"
l2_rpc_url="${EVERY_CHANNEL_OP_STACK_L2_RPC_URL:-http://127.0.0.1:28545}"
rollup_rpc_url="${EVERY_CHANNEL_OP_STACK_ROLLUP_RPC_URL:-http://127.0.0.1:28547}"
op_deployer_bin="${EVERY_CHANNEL_OP_DEPLOYER_BIN:-${root}/bin/op-deployer}"
download_script="${EVERY_CHANNEL_OP_DEPLOYER_DOWNLOAD_SCRIPT:-}"
download_tag="${EVERY_CHANNEL_OP_DEPLOYER_TAG:-op-deployer/v0.6.0-rc.3}"
@ -36,14 +38,36 @@ trimmed_file_contents() {
tr -d '\r\n' <"$1"
}
normalize_rollup_config() {
local path="$1"
python - "$path" <<'PY'
import json
import sys
from pathlib import Path
path = Path(sys.argv[1])
data = json.loads(path.read_text())
system_config = data.setdefault("genesis", {}).setdefault("system_config", {})
system_config.pop("daFootprintGasScalar", None)
chain_op_config = data.get("chain_op_config", {})
denominator = chain_op_config.get("eip1559DenominatorCanyon") or chain_op_config.get("eip1559Denominator")
elasticity = chain_op_config.get("eip1559Elasticity")
if (
isinstance(denominator, int)
and isinstance(elasticity, int)
and system_config.get("eip1559Params") in (None, "0x", "0x0000000000000000")
):
system_config["eip1559Params"] = f"0x{denominator:08x}{elasticity:08x}"
path.write_text(json.dumps(data, indent=2, sort_keys=False) + "\n")
PY
}
set_toml_value() {
local key="$1"
local value="$2"
local file="$3"
if ! grep -q "^${key} = " "$file"; then
log "missing key ${key} in ${file}"
exit 1
fi
python - "$key" "$value" "$file" <<'PY'
import sys
from pathlib import Path
@ -53,13 +77,15 @@ needle = f"{key} = "
out = []
replaced = False
for line in text.splitlines():
if line.startswith(needle):
out.append(f'{key} = "{value}"')
stripped = line.lstrip()
if stripped.startswith(needle):
indent = line[:len(line) - len(stripped)]
out.append(f'{indent}{key} = "{value}"')
replaced = True
else:
out.append(line)
if not replaced:
raise SystemExit(f"failed to replace {key}")
raise SystemExit(f"missing key {key} in {path}")
Path(path).write_text("\n".join(out) + "\n")
PY
}
@ -133,24 +159,33 @@ if 'fundDevAccounts = false' not in text:
path.write_text(text)
PY
if [[ "${skip_apply}" != "true" && ! -f "${deployer_dir}/.deployer/state.json" ]]; then
"$op_deployer_bin" apply \
--workdir "${deployer_dir}/.deployer" \
--l1-rpc-url "${l1_rpc_url}" \
--private-key "${private_key}"
state_json="${deployer_dir}/.deployer/state.json"
if [[ "${skip_apply}" != "true" ]]; then
if [[ ! -f "${state_json}" ]] || ! jq -e \
'.appliedIntent != null and .opChainDeployments != null' \
<"${state_json}" >/dev/null 2>&1
then
"$op_deployer_bin" apply \
--workdir "${deployer_dir}/.deployer" \
--l1-rpc-url "${l1_rpc_url}" \
--private-key "${private_key}"
fi
fi
if [[ ! -f "${deployer_dir}/.deployer/state.json" ]]; then
log "state.json missing; bootstrap did not complete"
if [[ ! -f "${state_json}" ]] || ! jq -e \
'.appliedIntent != null and .opChainDeployments != null' \
<"${state_json}" >/dev/null 2>&1
then
log "state.json missing or unapplied; bootstrap did not complete"
exit 1
fi
"$op_deployer_bin" inspect genesis --workdir "${deployer_dir}/.deployer" "${chain_id_hex}" >"${sequencer_dir}/genesis.json"
"$op_deployer_bin" inspect rollup --workdir "${deployer_dir}/.deployer" "${chain_id_hex}" >"${sequencer_dir}/rollup.json"
normalize_rollup_config "${sequencer_dir}/rollup.json"
openssl rand -hex 32 >"${sequencer_dir}/jwt.txt"
chmod 0600 "${sequencer_dir}/jwt.txt"
state_json="${deployer_dir}/.deployer/state.json"
system_config_proxy="$(jq -r '.opChainDeployments[0].systemConfigProxyAddress // .opChainDeployments[0].SystemConfigProxy // empty' <"${state_json}")"
dispute_game_factory="$(jq -r '.opChainDeployments[0].disputeGameFactoryProxyAddress // .opChainDeployments[0].DisputeGameFactoryProxy // empty' <"${state_json}")"
l1_standard_bridge="$(jq -r '.opChainDeployments[0].l1StandardBridgeProxyAddress // .opChainDeployments[0].L1StandardBridgeProxy // empty' <"${state_json}")"
@ -184,15 +219,14 @@ EOF
cat > "${batcher_dir}/.env" <<EOF
L1_RPC_URL=${l1_rpc_url}
L2_RPC_URL=http://127.0.0.1:8545
ROLLUP_RPC_URL=http://127.0.0.1:8547
L2_RPC_URL=${l2_rpc_url}
ROLLUP_RPC_URL=${rollup_rpc_url}
PRIVATE_KEY=${private_key}
BATCH_INBOX_ADDRESS=${system_config_proxy}
EOF
cat > "${proposer_dir}/.env" <<EOF
L1_RPC_URL=${l1_rpc_url}
ROLLUP_RPC_URL=http://127.0.0.1:8547
ROLLUP_RPC_URL=${rollup_rpc_url}
GAME_FACTORY_ADDRESS=${dispute_game_factory}
PRIVATE_KEY=${private_key}
PROPOSAL_INTERVAL=3600s
@ -203,8 +237,8 @@ cp "${sequencer_dir}/rollup.json" "${challenger_dir}/rollup.json"
cat > "${challenger_dir}/.env" <<EOF
L1_RPC_URL=${l1_rpc_url}
L1_BEACON_URL=${l1_beacon_url}
L2_RPC_URL=http://127.0.0.1:8545
ROLLUP_RPC_URL=http://127.0.0.1:8547
L2_RPC_URL=${l2_rpc_url}
ROLLUP_RPC_URL=${rollup_rpc_url}
GAME_FACTORY_ADDRESS=${dispute_game_factory}
PRIVATE_KEY=${private_key}
EOF
@ -217,7 +251,7 @@ fi
cat > "${dispute_mon_dir}/.env" <<EOF
OP_DISPUTE_MON_L1_ETH_RPC=${l1_rpc_url}
OP_DISPUTE_MON_ROLLUP_RPC=http://127.0.0.1:8547
OP_DISPUTE_MON_ROLLUP_RPC=${rollup_rpc_url}
OP_DISPUTE_MON_HONEST_ACTORS=${operator_address}
OP_DISPUTE_MON_GAME_FACTORY_ADDRESS=${dispute_game_factory}
OP_DISPUTE_MON_MONITOR_INTERVAL=10s