Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a81fbc1
chore: remove legacy contracts-task package and verifydeployed workflow
Maikol Oct 22, 2026
c0d3c9e
test(token-distribution): use IStaking ABI from interfaces instead of…
Maikol Oct 22, 2026
896599d
ci: add bytecode equivalence check for the contracts package migration
Maikol Oct 22, 2026
1ded9c9
test: record contracts-test line coverage baseline for the Foundry ports
Maikol Oct 22, 2026
aae4615
test: record covered functions in the contracts-test coverage baseline
Maikol Oct 23, 2026
80d26fd
test: add ManagedMock for the graph-core Foundry tests
Maikol Oct 23, 2026
e7d309a
test(graph-core): port governance and proxy tests to Foundry
Maikol Oct 23, 2026
889cc5e
test: add TokenUtilsMock for the graph-token Foundry tests
Maikol Oct 26, 2026
1b79322
test(graph-token): port token, escrow and token utils tests to Foundry
Maikol Oct 26, 2026
325aa9e
test(graph-token): port gateway tests to Foundry
Maikol Oct 26, 2026
0906961
test(subgraph-discovery): port L2Curation tests to Foundry
Maikol Oct 26, 2026
38c8b81
test(subgraph-discovery): port L2GNS tests to Foundry
Maikol Oct 26, 2026
00c080e
test(horizon): port EpochManager tests to Foundry
Maikol Oct 26, 2026
3b2a00a
test(issuance): add RewardsManager Foundry fixture and port interface…
Maikol Oct 26, 2026
47f8a8a
test(issuance): port RewardsManager calculations and distribution tes…
Maikol Oct 26, 2026
7dbe58a
test(issuance): port RewardsManager issuance allocator and subgraph s…
Maikol Oct 26, 2026
b75038d
test(issuance): port RewardsManager eligibility and reclaim tests to …
Maikol Oct 26, 2026
168bc53
test(issuance): port RewardsManager accounting and snapshot inversion…
Maikol Oct 26, 2026
39196ef
test(issuance): port legacy RewardsManager suite to Foundry
Maikol Oct 27, 2026
d58b97a
test(issuance): close pre-denial undeny case one block after undeny
Maikol Oct 30, 2026
db2cc4f
chore: remove contracts-test and the sdk
Maikol Oct 30, 2026
4cbcd06
feat(legacy): archive verified mainnet implementations
Maikol Oct 30, 2026
85c8054
feat(legacy): add address book and historical audits
Maikol Oct 30, 2026
d1467a7
chore(ignition): read unchanged artifacts from published contracts 7.3.0
Maikol Oct 30, 2026
e16182a
refactor(contracts): delete dead contracts
Maikol Oct 30, 2026
f46a371
test(subgraph-service): exclude the service itself from fuzzed indexers
Maikol Oct 30, 2026
968e50a
refactor(graph-core): move governance and proxy contracts
Maikol Nov 2, 2026
8631858
refactor(graph-token): move token and bridge contracts
Maikol Nov 2, 2026
a4c3c06
refactor(graph-token): move curation token and subgraph NFT contracts
Maikol Nov 3, 2026
509197e
refactor(graph-core): move EpochManager
Maikol Nov 3, 2026
fd62bb2
chore(legacy): keep only the source-hash check
Maikol Nov 3, 2026
813cac0
chore(ignition): keep only deploy:protocol and read live artifacts
Maikol Nov 3, 2026
7dde3e7
feat(interfaces)!: use OpenZeppelin 5
Maikol Nov 5, 2026
2fb8a08
refactor(issuance): move RewardsManager from contracts
Maikol Nov 5, 2026
6da4c4e
refactor(issuance): port RewardsManager to Solidity 0.8
Maikol Nov 5, 2026
3f5270c
refactor(subgraph-service): move L2GNS and L2Curation from contracts
Maikol Nov 5, 2026
ea25620
refactor(subgraph-service): port L2GNS and L2Curation to Solidity 0.8
Maikol Nov 5, 2026
dfc25af
chore: remove packages/contracts
Maikol Nov 5, 2026
bcdafc0
chore(billing): import billing-contracts at 8b063db
Maikol Nov 6, 2026
9667c7c
chore(billing): build and test in the monorepo
Maikol Nov 6, 2026
7ed1609
chore: apply final review of the contracts removal
Maikol Nov 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/graph-core-initial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-core': major
---

Publish the governance, proxy and epoch contracts (Controller, Governed, Managed, Pausable, GraphProxy, GraphProxyAdmin, GraphProxyStorage, GraphUpgradeable, EpochManager, EpochManagerStorage) as `@graphprotocol/graph-core`.
5 changes: 5 additions & 0 deletions .changeset/graph-token-initial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-token': major
---

Publish the token, bridge, curation-token and subgraph NFT contracts (GraphToken, L2GraphToken, TokenUtils, the Arbitrum gateways, BridgeEscrow, GraphCurationToken, SubgraphNFT, SubgraphNFTDescriptor, HexStrings and Base58Encoder) as `@graphprotocol/graph-token`.
5 changes: 5 additions & 0 deletions .changeset/horizon-curation-addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/address-book': minor
---

Add the GraphCurationToken and SubgraphNFTDescriptor addresses for Arbitrum One and Arbitrum Sepolia to the horizon address book.
5 changes: 5 additions & 0 deletions .changeset/horizon-dependency-artifacts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/horizon': patch
---

The dependency artifacts and types for `TokenUtils` and `GraphUpgradeable` are now built from `@graphprotocol/graph-token` and `@graphprotocol/graph-core`, so they move from `build/contracts/@graphprotocol/contracts/...` to `build/contracts/@graphprotocol/graph-token/...` and `build/contracts/@graphprotocol/graph-core/...`. Contract bytecode is unchanged.
5 changes: 5 additions & 0 deletions .changeset/interfaces-openzeppelin-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/interfaces': major
---

Use OpenZeppelin 5. The generated `IERC20Upgradeable` types are gone, the `IERC165` types moved to `utils/introspection`, and ABI parameter names follow OpenZeppelin 5 (for example `transfer(to, value)`, `setApprovalForAll(operator, approved)`), which changes the wagmi ABIs.
5 changes: 5 additions & 0 deletions .changeset/issuance-rewards-manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/issuance': minor
---

Add RewardsManager, ported from the former `contracts` package to Solidity 0.8.35 with the same behaviour and storage layout. Its artifact is `@graphprotocol/issuance/artifacts/contracts/rewards/RewardsManager.sol/RewardsManager.json`. `@graphprotocol/graph-core` and `@graphprotocol/interfaces` become dependencies, because the published sources import them.
5 changes: 5 additions & 0 deletions .changeset/legacy-address-book.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/address-book': minor
---

Add the L1 deployment addresses (`@graphprotocol/address-book/legacy/addresses.json`) for Ethereum mainnet and Sepolia.
5 changes: 5 additions & 0 deletions .changeset/subgraph-service-discovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/subgraph-service': minor
---

Add L2GNS, GNS, L2Curation, their storage contracts and Multicall, ported from the former `contracts` package to Solidity 0.8.35 with the same behaviour and storage layout, plus `InitializableV3`, a copy of OpenZeppelin 3.4.2's `Initializable` that keeps its storage slots. The artifacts are `@graphprotocol/subgraph-service/artifacts/contracts/l2/curation/L2Curation.sol/L2Curation.json` and `@graphprotocol/subgraph-service/artifacts/contracts/l2/discovery/L2GNS.sol/L2GNS.json`.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/legacy/verified/** -text
13 changes: 13 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ jobs:
- name: Build all packages
run: pnpm -r --sequential run build

- name: Test scripts
run: pnpm test:scripts

- name: Check bytecode equivalence
run: pnpm check:bytecode

- name: Check storage layouts of ported contracts
run: pnpm check:storage

- name: Test all packages
run: pnpm -r --sequential run test:self

- name: Deploy protocol on a local Hardhat network
working-directory: packages/subgraph-service
run: npx hardhat deploy:protocol --network hardhat --subgraph-service-config localNetwork

- name: Test with coverage
run: pnpm -r --sequential run test:coverage:self

Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ jobs:
echo "Head SHA: $HEAD_SHA"

# Get changed files, filtering out deleted files and files in ignored directories
CHANGED_TS_JS=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.(js|ts|jsx|tsx|cjs|mjs)$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' || true)
CHANGED_SOL=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.sol$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts|/test/)' || true)
CHANGED_MD=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.md$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' || true)
CHANGED_JSON=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.json$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' || true)
CHANGED_YAML=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.(yml|yaml)$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' || true)
CHANGED_TS_JS=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.(js|ts|jsx|tsx|cjs|mjs)$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' | grep -v '^packages/billing/' || true)
CHANGED_SOL=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.sol$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts|/test/)' | grep -v '^packages/billing/' || true)
CHANGED_MD=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.md$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' | grep -v '^packages/billing/' || true)
CHANGED_JSON=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.json$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' | grep -v '^packages/billing/' || true)
CHANGED_YAML=$(git diff --name-only --diff-filter=d $BASE_SHA $HEAD_SHA | grep -E '\.(yml|yaml)$' | grep -v -E '(node_modules|dist|build|cache|reports|lib|coverage|artifacts|typechain|hardhat-cache|ignition/deployments|ignition/modules/artifacts)' | grep -v '^packages/billing/' || true)

# Save to files for later use
echo "$CHANGED_TS_JS" > changed_ts_js.txt
Expand Down Expand Up @@ -104,10 +104,10 @@ jobs:
run: |
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
echo "Linting all Solidity files in each package..."
# Run solhint in each workspace package that has contracts (check mode)
pnpm -r exec bash -c 'if [ -d "contracts" ]; then npx solhint --max-warnings=0 --noPrompt --noPoster "contracts/**/*.sol" 2>/dev/null || exit 1; fi'
# Run solhint in each workspace package that has contracts (check mode), skipping imported billing-contracts
pnpm -r --filter '!./packages/billing' exec bash -c 'if [ -d "contracts" ]; then npx solhint --max-warnings=0 --noPrompt --noPoster "contracts/**/*.sol" 2>/dev/null || exit 1; fi'
# Check formatting with prettier
SOL_FILES=$(git ls-files '*.sol')
SOL_FILES=$(git ls-files '*.sol' ':!packages/billing/**')
if [ -n "$SOL_FILES" ]; then
echo "$SOL_FILES" | tr '\n' '\0' | xargs -0 npx prettier --check --cache --log-level warn
else
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
run: |
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
echo "Linting all TypeScript/JavaScript files..."
TS_FILES=$(git ls-files '*.js' '*.ts' '*.cjs' '*.mjs' '*.jsx' '*.tsx')
TS_FILES=$(git ls-files '*.js' '*.ts' '*.cjs' '*.mjs' '*.jsx' '*.tsx' ':!packages/billing/**')
if [ -n "$TS_FILES" ]; then
echo "$TS_FILES" | tr '\n' '\0' | xargs -0 npx eslint --max-warnings=0 --no-warn-ignored
echo "$TS_FILES" | tr '\n' '\0' | xargs -0 npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
Expand All @@ -169,7 +169,7 @@ jobs:
run: |
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
echo "Linting all Markdown files..."
MD_FILES=$(git ls-files '*.md')
MD_FILES=$(git ls-files '*.md' ':!packages/billing/**')
if [ -n "$MD_FILES" ]; then
echo "$MD_FILES" | tr '\n' '\0' | xargs -0 npx markdownlint --ignore-path .gitignore --ignore-path .markdownlintignore
echo "$MD_FILES" | tr '\n' '\0' | xargs -0 npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
Expand All @@ -191,7 +191,7 @@ jobs:
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
echo "Linting all JSON files..."
# Exclude Ignition deployment artifacts and other build artifacts
JSON_FILES=$(git ls-files '*.json' | { grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' || true; })
JSON_FILES=$(git ls-files '*.json' ':!packages/billing/**' | { grep -v -E '(ignition/deployments/.*/artifacts/|ignition/deployments/.*/build-info/|/\.openzeppelin/|deployments/.*/solcInputs/)' || true; })
if [ -n "$JSON_FILES" ]; then
echo "$JSON_FILES" | tr '\n' '\0' | xargs -0 npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
else
Expand All @@ -215,7 +215,7 @@ jobs:
run: |
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
echo "Linting all YAML files..."
YAML_FILES=$(git ls-files '*.yml' '*.yaml')
YAML_FILES=$(git ls-files '*.yml' '*.yaml' ':!packages/billing/**')
if [ -n "$YAML_FILES" ]; then
echo "$YAML_FILES" | tr '\n' '\0' | xargs -0 npx yaml-lint
echo "$YAML_FILES" | tr '\n' '\0' | xargs -0 npx prettier --check --cache --log-level warn --no-error-on-unmatched-pattern
Expand Down Expand Up @@ -259,6 +259,16 @@ jobs:
echo "No Solidity files to lint with Forge"
fi

- name: Check OpenZeppelin v3 alias scope
run: |
# The @openzeppelin/contracts-v3 alias (SafeMath for 0.7.6 code) is only for graph-core
MATCHES=$(git grep -l '@openzeppelin/contracts-v3' -- '*.sol' ':!packages/graph-core/**') || [ $? -eq 1 ]
if [ -n "$MATCHES" ]; then
echo "@openzeppelin/contracts-v3 may only be imported from packages/graph-core:"
echo "$MATCHES"
exit 1
fi

- name: Check lint results
if: always()
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ on:
type: choice
options:
- address-book
- contracts
- graph-core
- graph-token
- interfaces
- toolshed
tag:
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/verifydeployed.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ packages/*/.eslintcache
dist/
dist-v5/
build/
packages/contracts/**/types/
deployments/hardhat/
*.js.map
*.d.ts.map
Expand All @@ -40,8 +39,8 @@ typechain-src/
typechain-types/
types-v5/
wagmi/
packages/contracts/types/
packages/contracts-test/types/
packages/graph-core/types/
packages/graph-token/types/
packages/interfaces/types/
packages/token-distribution/types/
packages/issuance/types/
Expand Down
3 changes: 3 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ deployments/hardhat/
**/*-localhost/
**/*-hardhat/
.changeset/

# Imported billing-contracts, must stay byte-identical
packages/billing/
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ deployments/hardhat/
**/chain-*/
**/*-localhost/
**/*-hardhat/

# Verified mainnet source, must stay byte-identical
packages/legacy/verified/

# Imported billing-contracts, must stay byte-identical
packages/billing/

# Pre-port artifacts, must stay byte-identical
packages/*/test/fixtures/pre-port/
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages/legacy/verified/
packages/billing/
37 changes: 17 additions & 20 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ pnpm test:coverage
# Test a specific package
cd packages/<package-name> && pnpm test

# Test a single file (in contracts package)
cd packages/contracts && npx hardhat test test/<FILE_NAME>.ts

# Run Foundry tests (in horizon/subgraph-service)
cd packages/horizon && pnpm test

# Run integration tests
cd packages/horizon && pnpm test:integration

# Run deployment tests
cd packages/horizon && pnpm test:deployment
# Check a fresh local deployment (Hardhat Ignition)
cd packages/subgraph-service && npx hardhat deploy:protocol --network hardhat --subgraph-service-config localNetwork
```

### Linting and Formatting
Expand All @@ -71,20 +65,15 @@ pnpm lint:yaml # YAML files

### Package Structure

1. **contracts** - Original Graph Protocol contracts (staking, curation, disputes)
- Uses Hardhat for development
- Contains E2E testing framework for protocol validation

2. **horizon** - Next iteration of The Graph protocol
1. **horizon** - Next iteration of The Graph protocol
- Uses Hardhat + Foundry for testing
- Deployment via Hardhat Ignition
- Migration path from original protocol

3. **subgraph-service** - Data service implementation for Graph Horizon
2. **subgraph-service** - Data service implementation for Graph Horizon
- Manages disputes and allocations
- Part of the Horizon ecosystem

4. **interfaces** - Shared contract interfaces
3. **interfaces** - Shared contract interfaces
- Centralized repository for all Solidity contract interfaces
- Used by multiple packages/programs for contract implementation and interaction
- Generates TypeScript types for distribution via npm
Expand All @@ -93,15 +82,23 @@ pnpm lint:yaml # YAML files
- Includes ethers v5 type generation
- Published types can be imported by any TypeScript program

5. **token-distribution** - Token locking and vesting contracts
4. **token-distribution** - Token locking and vesting contracts
- GraphTokenLockWallet and GraphTokenLockManager
- L2 token distribution functionality

6. **toolshed** - Shared development utilities
5. **toolshed** - Shared development utilities
- Deployment helpers
- Test fixtures
- Hardhat extensions

6. **billing** - Graph Studio billing contracts (Billing, BillingConnector, BanxaWrapper), private, Hardhat 2 with ethers v5

7. **graph-core** - Governance, proxy and epoch contracts (Controller, GraphProxy, GraphProxyAdmin, EpochManager), solc 0.7.6 with bytecode identical to the deployed protocol

8. **graph-token** - GraphToken, L2GraphToken, the Arbitrum gateways, GraphCurationToken and the SubgraphNFT contracts, solc 0.7.6 with bytecode identical to the deployed protocol

9. **legacy** - Archive of the verified source of the mainnet implementations, with addresses and audits (private)

### Key Architectural Patterns

- **Proxy Upgradeable Pattern**: Most contracts use OpenZeppelin's upgradeable proxy pattern
Expand All @@ -121,7 +118,7 @@ pnpm lint:yaml # YAML files
- Contract addresses stored in `addresses.json` files per package
- Multi-network support (mainnet, testnets, Arbitrum chains)
- Hardhat Ignition for deployment management
- Migration scripts for upgrading from original protocol to Horizon
- `deploy:protocol` deploys fresh stacks for local networks and tests; live networks are managed by `packages/deployment`

## Development Tips

Expand All @@ -130,7 +127,7 @@ pnpm lint:yaml # YAML files
Horizon packages use both Hardhat and Foundry. When developing:

1. Use `forge test` for Foundry tests
2. Use `pnpm test:integration` for integration tests
2. Use `npx hardhat deploy:protocol --network hardhat --subgraph-service-config localNetwork` from `packages/subgraph-service` to deploy a fresh local stack (`deploy:protocol` runs from subgraph-service only)
3. Set required RPC URLs using `npx hardhat vars set <variable>`

### Contract Verification
Expand Down
Loading
Loading