Skip to content
Open
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
26 changes: 13 additions & 13 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ services:
- ${GRAPH_NODE_STATUS_PORT}:8030
- ${GRAPH_NODE_METRICS_PORT}:8040
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
healthcheck:
Expand All @@ -79,7 +79,7 @@ services:
depends_on:
chain: { condition: service_healthy }
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config
environment:
Expand All @@ -96,7 +96,7 @@ services:
graph-contracts: { condition: service_completed_successfully }
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -121,7 +121,7 @@ services:
ports: ["${INDEXER_MANAGEMENT_PORT}:7600"]
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
healthcheck:
Expand All @@ -140,7 +140,7 @@ services:
graph-contracts: { condition: service_completed_successfully }
graph-node: { condition: service_healthy }
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro

Expand All @@ -151,7 +151,7 @@ services:
subgraph-deploy: { condition: service_completed_successfully }
indexer-agent: { condition: service_healthy }
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro

Expand Down Expand Up @@ -195,7 +195,7 @@ services:
ports: ["${TAP_AGGREGATOR_PORT}:7610"]
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -214,7 +214,7 @@ services:
redpanda: { condition: service_healthy }
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -234,7 +234,7 @@ services:
ports: ["${GATEWAY_PORT}:7700"]
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -257,7 +257,7 @@ services:
- "${INDEXER_SERVICE_PORT}:7601"
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -278,7 +278,7 @@ services:
subgraph-deploy: { condition: service_completed_successfully }
stop_signal: SIGKILL
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand All @@ -299,7 +299,7 @@ services:
redpanda: { condition: service_healthy }
gateway: { condition: service_healthy }
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand Down Expand Up @@ -366,7 +366,7 @@ services:
- "${DIPPER_ADMIN_RPC_PORT}:${DIPPER_ADMIN_RPC_PORT}"
- "${DIPPER_INDEXER_RPC_PORT}:${DIPPER_INDEXER_RPC_PORT}"
volumes:
- ./containers/shared:/opt/shared:ro
- ./shared:/opt/shared:ro
- ./.env:/opt/config/.env:ro
- config-local:/opt/config:ro
environment:
Expand Down
2 changes: 1 addition & 1 deletion docs/testing/reo/CurationSignal.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Small change (~20-30 lines) in `start-indexing/run.sh`. No new services, no new
| L2GraphToken | `horizon.json` | `.["1337"].L2GraphToken.address` |
| L2GNS | `subgraph-service.json` | `.["1337"].L2GNS.address` |

Addresses resolved via `contract_addr` helper in [containers/shared/lib.sh](../../../containers/shared/lib.sh).
Addresses resolved via `contract_addr` helper in [shared/lib.sh](../../../shared/lib.sh).

### Insertion Point

Expand Down
12 changes: 9 additions & 3 deletions scripts/add-subgraph.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
set -xe
source .env
[ -f .env.local ] && source .env.local
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

source "$REPO_ROOT/.env"
[ -f "$REPO_ROOT/.env.local" ] && source "$REPO_ROOT/.env.local"
source "$REPO_ROOT/shared/lib.sh"

name=$1
if [ -z "$name" ]; then
echo "Usage: $0 <name>"
Expand All @@ -23,7 +29,7 @@ deployment_hex="$(curl -s -X POST "http://${IPFS_HOST}:${IPFS_RPC_PORT}/api/v0/c
deployment_hex="${deployment_hex#f01701220}"

echo "deployment_hex=${deployment_hex}"
gns="$(jq -r '."1337".L2GNS.address' subgraph-service.json)"
gns="$(contract_addr L2GNS.address subgraph-service)"

# https://github.com/graphprotocol/contracts/blob/3eb16c80d4652c238d3e6b2c396da712af5072b4/packages/sdk/src/deployments/network/actions/gns.ts#L38
cast send --rpc-url="http://${CHAIN_HOST}:${CHAIN_RPC_PORT}" --confirmations=0 --mnemonic="${MNEMONIC}" \
Expand Down
12 changes: 8 additions & 4 deletions scripts/advance-epoch.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

source "$REPO_ROOT/.env"
[ -f "$REPO_ROOT/.env.local" ] && source "$REPO_ROOT/.env.local"
source "$REPO_ROOT/shared/lib.sh"

# Get number of epochs to advance (default to 1 if not provided)
EPOCHS_TO_ADVANCE=${1:-1}

# Get the EpochManager contract address from horizon.json
EPOCH_MANAGER_ADDRESS=$(jq -r '."1337".EpochManager.address' horizon.json)

EPOCH_MANAGER_ADDRESS=$(contract_addr EpochManager.address horizon)
RPC_URL="http://${CHAIN_HOST:-localhost}:${CHAIN_RPC_PORT:-8545}"

# Get current epoch
Expand Down Expand Up @@ -33,7 +37,7 @@ echo "Advancing by $EPOCHS_TO_ADVANCE epoch(s)"
echo "Blocks to mine: $BLOCKS_TO_MINE"

# Mine blocks until next epoch using mine-block.sh
./scripts/mine-block.sh $BLOCKS_TO_MINE
"$SCRIPT_DIR/mine-block.sh" $BLOCKS_TO_MINE

# Verify we're in the next epoch
NEW_EPOCH=$(cast call $EPOCH_MANAGER_ADDRESS "currentEpoch()(uint256)" --rpc-url "$RPC_URL")
Expand Down
11 changes: 8 additions & 3 deletions scripts/query_balance.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/bash
source .env
[ -f .env.local ] && source .env.local
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

source "$REPO_ROOT/.env"
[ -f "$REPO_ROOT/.env.local" ] && source "$REPO_ROOT/.env.local"
source "$REPO_ROOT/shared/lib.sh"

address_to_query="${ACCOUNT0_ADDRESS}"
token_address=$(jq -r '."1337".L2GraphToken.address' horizon.json)
token_address=$(contract_addr L2GraphToken.address horizon)
rpc_url="http://${CHAIN_HOST:-localhost}:${CHAIN_RPC_PORT}"
cast call --trace "$token_address" "balanceOf(address)(uint256)" "$address_to_query" --rpc-url "$rpc_url"
cast balance $address_to_query --rpc-url "$rpc_url"
5 changes: 3 additions & 2 deletions scripts/reo-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Load environment
# shellcheck source=../.env
. "$REPO_ROOT/.env"
# shellcheck source=../shared/lib.sh
. "$REPO_ROOT/shared/lib.sh"

RPC_URL="http://${CHAIN_HOST:-localhost}:${CHAIN_RPC_PORT}"

# Read REO contract address from config-local volume
REO_ADDRESS=$(docker exec graph-node cat /opt/config/issuance.json 2>/dev/null \
| jq -r '.["1337"].RewardsEligibilityOracle.address // empty' 2>/dev/null || true)
REO_ADDRESS=$(contract_addr RewardsEligibilityOracle.address issuance 2>/dev/null) || true
if [ -z "$REO_ADDRESS" ]; then
echo "ERROR: RewardsEligibilityOracle address not found."
echo " Is the local network running with the REO contract deployed?"
Expand Down
5 changes: 3 additions & 2 deletions scripts/test-baseline-state.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# shellcheck source=../.env
. "$REPO_ROOT/.env"
# shellcheck source=../shared/lib.sh
. "$REPO_ROOT/shared/lib.sh"

SUBGRAPH_URL="http://${GRAPH_NODE_HOST:-localhost}:${GRAPH_NODE_GRAPHQL_PORT}/subgraphs/name/graph-network"
AGENT_URL="http://${INDEXER_AGENT_HOST:-localhost}:${INDEXER_MANAGEMENT_PORT}"
Expand Down Expand Up @@ -225,8 +227,7 @@ echo ""
# ============================================================
# REO (if deployed)
# ============================================================
REO_ADDRESS=$(docker exec graph-node cat /opt/config/issuance.json 2>/dev/null \
| jq -r '.["1337"].RewardsEligibilityOracle.address // empty' 2>/dev/null || true)
REO_ADDRESS=$(contract_addr RewardsEligibilityOracle.address issuance 2>/dev/null) || true

if [ -n "$REO_ADDRESS" ]; then
echo "--- REO Contract ---"
Expand Down
8 changes: 4 additions & 4 deletions scripts/test-indexer-guide-queries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# shellcheck source=../.env
. "$REPO_ROOT/.env"
# shellcheck source=../shared/lib.sh
. "$REPO_ROOT/shared/lib.sh"

# Ensure cast is on PATH
export PATH="$HOME/.foundry/bin:$PATH"
Expand Down Expand Up @@ -82,8 +84,7 @@ echo " Indexer: $INDEXER"
echo ""

# -- Resolve REO contract address --
REO_ADDRESS=$(docker exec graph-node cat /opt/config/issuance.json 2>/dev/null \
| jq -r '.["1337"].RewardsEligibilityOracle.address // empty' 2>/dev/null || true)
REO_ADDRESS=$(contract_addr RewardsEligibilityOracle.address issuance 2>/dev/null) || true

if [ -z "$REO_ADDRESS" ]; then
echo " WARNING: REO contract not found. Skipping cast tests."
Expand All @@ -95,8 +96,7 @@ else
fi

# -- Resolve RewardsManager address --
REWARDS_MANAGER=$(docker exec graph-node cat /opt/config/horizon.json 2>/dev/null \
| jq -r '.["1337"].RewardsManager.address // empty' 2>/dev/null || true)
REWARDS_MANAGER=$(contract_addr RewardsManager.address horizon 2>/dev/null) || true

if [ -n "$REWARDS_MANAGER" ]; then
echo " RM: $REWARDS_MANAGER"
Expand Down
5 changes: 3 additions & 2 deletions scripts/test-reo-eligibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Load environment
# shellcheck source=../.env
. "$REPO_ROOT/.env"
# shellcheck source=../shared/lib.sh
. "$REPO_ROOT/shared/lib.sh"

# Host-side defaults (containers use internal hostnames)
RPC_URL="http://${CHAIN_HOST:-localhost}:${CHAIN_RPC_PORT}"
Expand All @@ -29,8 +31,7 @@ REO_POLL_TIMEOUT=150 # Max wait: 2.5 cycles (worst case: just missed a cycle)
REO_POLL_INTERVAL=10 # Check every 10s

# -- Read REO contract address from config-local volume --
REO_ADDRESS=$(docker exec graph-node cat /opt/config/issuance.json 2>/dev/null \
| jq -r '.["1337"].RewardsEligibilityOracle.address // empty' 2>/dev/null || true)
REO_ADDRESS=$(contract_addr RewardsEligibilityOracle.address issuance 2>/dev/null) || true
if [ -z "$REO_ADDRESS" ]; then
echo "ERROR: RewardsEligibilityOracle address not found."
echo " Is the local network running? Is the REO contract deployed (Phase 4)?"
Expand Down
17 changes: 13 additions & 4 deletions containers/shared/lib.sh → shared/lib.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
#!/bin/sh
# Shared shell utilities for local-network services
# Shared shell utilities for local-network (container services and host scripts)

require_jq() {
_val=$(jq -r "$1 // empty" "$2")
_val=$(jq -r "$1 // empty" ${2:+"$2"})
if [ -z "$_val" ]; then
echo "Error: $1 not found in $2" >&2
echo "Error: $1 not found in ${2:-stdin}" >&2
exit 1
fi
printf '%s' "$_val"
}

# contract_addr CONTRACT_NAME ADDRESS_BOOK
# Gets a contract address from a config file
# Supports both host and container execution contexts.
# Example: contract_addr L2GraphToken.address horizon
contract_addr() {
require_jq ".\"1337\".$1" "/opt/config/$2.json"
if [ -d "/opt/config" ]; then
require_jq ".\"1337\".$1" "/opt/config/$2.json"
else
docker exec graph-node cat "/opt/config/$2.json" \
| require_jq ".\"1337\".$1"
fi
}

# wait_for_gql URL QUERY JQ_FILTER [TIMEOUT]
Expand Down