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
13 changes: 13 additions & 0 deletions containers/core/graph-contracts/contracts.run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -eu
# shellcheck source=/dev/null
. /opt/config/.env
# shellcheck source=/dev/null
. /opt/shared/lib.sh

# -- Ensure config files exist (empty JSON on first run) --
Expand Down Expand Up @@ -71,6 +73,17 @@ if [ "$skip" = "false" ]; then
cd /opt/contracts/packages/subgraph-service
npx hardhat deploy:protocol --network localNetwork --subgraph-service-config localNetwork

# Network subgraph mustache template still references
# subgraphService.LegacyServiceRegistry.address and
# subgraphService.LegacyDisputeManager.address. Hardhat doesn't deploy
# those legacy contracts, so write zero-address placeholders into the
# address book to satisfy graph-cli's address validation.
TEMP_JSON=$(jq '.["1337"] += {
"LegacyServiceRegistry": {"address": "0x0000000000000000000000000000000000000000"},
"LegacyDisputeManager": {"address": "0x0000000000000000000000000000000000000000"}
}' /opt/config/subgraph-service.json)
printf '%s\n' "$TEMP_JSON" > /opt/config/subgraph-service.json

ensure_dispute_manager_registered
fi

Expand Down
27 changes: 20 additions & 7 deletions containers/core/graph-contracts/issuance.run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -eu
# shellcheck source=/dev/null
. /opt/config/.env
# shellcheck source=/dev/null
. /opt/shared/lib.sh

# ============================================================
Expand Down Expand Up @@ -78,11 +80,11 @@ if [ "$phase_skip" = "false" ]; then
"GIP-0088:upgrade,transfer" \
"GIP-0088:upgrade,upgrade"; do
echo " --- Running: --tags ${step} ---"
for attempt in 1 2 3; do
for _ in 1 2 3; do
if pnpm exec hardhat deploy --tags "${step}" --network localNetwork --skip-prompts; then
break
fi
if ls /opt/contracts/packages/deployment/txs/localNetwork/*.json 2>/dev/null | grep -qv executed; then
if find /opt/contracts/packages/deployment/txs/localNetwork -maxdepth 1 -name '*.json' ! -name '*executed*' -print -quit 2>/dev/null | grep -q .; then
echo " Executing pending governance TXs..."
pnpm exec hardhat deploy:execute-governance --network localNetwork || true
else
Expand All @@ -91,7 +93,7 @@ if [ "$phase_skip" = "false" ]; then
fi
done
# Execute any governance TXs generated by this step
if ls /opt/contracts/packages/deployment/txs/localNetwork/*.json 2>/dev/null | grep -qv executed; then
if find /opt/contracts/packages/deployment/txs/localNetwork -maxdepth 1 -name '*.json' ! -name '*executed*' -print -quit 2>/dev/null | grep -q .; then
echo " Executing governance TXs..."
pnpm exec hardhat deploy:execute-governance --network localNetwork || true
fi
Expand All @@ -104,19 +106,30 @@ if [ "$phase_skip" = "false" ]; then
"GIP-0088:issuance-connect" \
"GIP-0088:issuance-allocate"; do
echo " --- Running: --tags ${goal} ---"
succeeded=false
for attempt in 1 2 3; do
if pnpm exec hardhat deploy --tags "${goal}" --network localNetwork --skip-prompts; then
succeeded=true
break
fi
if ls /opt/contracts/packages/deployment/txs/localNetwork/*.json 2>/dev/null | grep -qv executed; then
if find /opt/contracts/packages/deployment/txs/localNetwork -maxdepth 1 -name '*.json' ! -name '*executed*' -print -quit 2>/dev/null | grep -q .; then
echo " Executing pending governance TXs..."
pnpm exec hardhat deploy:execute-governance --network localNetwork || true
else
echo " Activation goal failed (no governance TXs pending)"
exit 1
# No pending TXs = deploy aborted before writing any (typically
# NonceTooLowError from a parallel tx wallet collision with another
# contract-deploy container). The connect/integrate/allocate scripts
# gate every tx behind an on-chain pre-check, so re-running is safe:
# any tx that did land before the abort gets skipped on the next pass.
echo " Deploy failed with no pending TXs (attempt ${attempt}/3); retrying..."
sleep 2
fi
done
if ls /opt/contracts/packages/deployment/txs/localNetwork/*.json 2>/dev/null | grep -qv executed; then
if [ "$succeeded" = false ]; then
echo " ERROR: --tags ${goal} failed after 3 attempts"
exit 1
fi
if find /opt/contracts/packages/deployment/txs/localNetwork -maxdepth 1 -name '*.json' ! -name '*executed*' -print -quit 2>/dev/null | grep -q .; then
echo " Executing governance TXs..."
pnpm exec hardhat deploy:execute-governance --network localNetwork || true
fi
Expand Down