Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fdd4c35
chore: undo baseline test and package exclusions
RembrandtK Jan 30, 2026
32a5d1e
fix: upgrade CI Node.js to 22 for Hardhat 3.x compatibility
RembrandtK Feb 2, 2026
fe6b1c4
chore: lint fixes
RembrandtK Feb 1, 2026
e1d391d
refactor: lint optimisations
RembrandtK Feb 1, 2026
4eea0a1
feat(compiler): 0.8.33 with via IR Solidity compiler
RembrandtK Jan 31, 2026
214fbcd
feat: subgraph-service pragma 0.8.33
RembrandtK Feb 1, 2026
0d04b70
chore: update contract pragmas for 0.8.33
RembrandtK Feb 1, 2026
fb17025
refactor: consolidate public IssuanceAllocator interface
RembrandtK Feb 1, 2026
79e9538
refactor: consolidate public RewardsManager interface
RembrandtK Feb 1, 2026
8b365ad
refactor: consolidate public DisputeManager interface
RembrandtK Feb 1, 2026
23b77bc
refactor: consolidate public AllocationManager interface
RembrandtK Feb 1, 2026
b9b7a7c
refactor: consolidate public DataServicePausable interface
RembrandtK Feb 1, 2026
ce61f31
refactor: consolidate public SubgraphService interface
RembrandtK Feb 1, 2026
4ef521b
chore: add local minimal IGraphToken interface for issuance package
RembrandtK Feb 1, 2026
2252c19
fix: correct IGraphProxyAdmin interface signatures
RembrandtK Feb 1, 2026
9f1ddb4
refactor: rename RewardsReason to RewardsCondition
RembrandtK Feb 1, 2026
8481444
feat: extend RewardsCondition
RembrandtK Feb 1, 2026
354a11f
feat: add defaultReclaimAddress
RembrandtK Feb 2, 2026
bed8620
doc: IRewardsManager
RembrandtK Feb 2, 2026
ece40cd
feat: use AccessControlEnumerable in BaseUpgradeable
RembrandtK Feb 1, 2026
8ad2f28
feat: feat: split issuance getter (allocated/raw)
RembrandtK Feb 1, 2026
f86183f
feat: add private _getNewRewardsPerSignal to return unclaimable rewards
RembrandtK Feb 1, 2026
8a5ba11
feat: remove data param from RewardsReclaimed
RembrandtK Feb 2, 2026
8787824
feat: deny rewards for period that a subgraph deployment is denied
RembrandtK Feb 1, 2026
d99bf7b
refactor: simplify AllocationManager reward collection and add denial…
RembrandtK Feb 1, 2026
df0e0b8
docs: AllocationManager
RembrandtK Feb 2, 2026
620dec5
docs: RewardsManager
RembrandtK Feb 2, 2026
1e17d3e
docs: RewardsManagerStorage
RembrandtK Feb 2, 2026
781bf79
docs: rewards accounting
RembrandtK Feb 2, 2026
45f5af0
refactor: extract _getSubgraphRewardsState
RembrandtK Feb 2, 2026
7b8992e
refactor: _deniedRewards
RembrandtK Feb 2, 2026
80300d7
refactor: _reclaimRewards
RembrandtK Feb 2, 2026
bc7a67f
feat: reclaim for no signal in updateAccRewardsPerSignal
RembrandtK Feb 2, 2026
150b7a0
refactor: _getSubgraphAllocatedTokens
RembrandtK Feb 2, 2026
f830204
test: test updated rewards reclaim logic
RembrandtK Feb 1, 2026
2324bce
fixup! feat: reclaim for no signal in updateAccRewardsPerSignal
RembrandtK Feb 2, 2026
bbe4a9f
test: zero issuance timestamp update
RembrandtK Feb 2, 2026
a012282
refactor: cache storage variables in _onSubgraphSignalUpdate
RembrandtK Feb 2, 2026
ea39939
refactor: cache storage in updateAccRewardsPerSignal and onSubgraphSi…
RembrandtK Feb 2, 2026
025410f
fix: consistent reward reclaim for non-claimable subgraphs in both hooks
RembrandtK Feb 4, 2026
6d59cb8
refactor: replace bytes32(0) with RewardsCondition.NONE constant
RembrandtK Feb 4, 2026
74e0995
feat: update reward accumulators on deferred POI claims
RembrandtK Feb 4, 2026
16dbd73
fixup! fix: consistent reward reclaim for non-claimable subgraphs in …
RembrandtK Feb 5, 2026
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
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'pnpm'
- name: Set up pnpm via Corepack
shell: bash
Expand Down
151 changes: 151 additions & 0 deletions docs/CompilerUpgrade0833.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Compiler Upgrade: Solidity 0.8.33 + viaIR

This document captures the bytecode size changes resulting from the compiler configuration upgrade in the `subgraph-service` and `issuance` packages.

## Configuration Changes

### subgraph-service

| Setting | Before | After |
| ---------------- | ------- | ------- |
| Solidity Version | 0.8.27 | 0.8.33 |
| EVM Version | paris | cancun |
| Optimizer | enabled | enabled |
| Optimizer Runs | 10 | 100 |
| viaIR | false | true |

### issuance

| Setting | Before | After |
| ---------------- | ------- | ------- |
| Solidity Version | 0.8.27 | 0.8.33 |
| EVM Version | cancun | cancun |
| Optimizer | enabled | enabled |
| Optimizer Runs | 100 | 100 |
| viaIR | false | true |

## Subgraph-Service Contract Bytecode Sizes

All contracts defined in `packages/subgraph-service/contracts/`:

| Contract | Source File | Before (KiB) | After (KiB) | Change (KiB) | Change (%) |
| --------------------------- | ------------------------------------------------- | ------------ | ----------- | ------------ | ---------- |
| **SubgraphService** | contracts/SubgraphService.sol | 24.455 | 23.110 | **-1.345** | -5.5% |
| **DisputeManager** | contracts/DisputeManager.sol | 13.278 | 10.917 | **-2.361** | -17.8% |
| Allocation | contracts/libraries/Allocation.sol | 0.084 | 0.056 | -0.028 | -33.3% |
| Attestation | contracts/libraries/Attestation.sol | 0.084 | 0.056 | -0.028 | -33.3% |
| LegacyAllocation | contracts/libraries/LegacyAllocation.sol | 0.084 | 0.056 | -0.028 | -33.3% |
| SubgraphServiceV1Storage | contracts/SubgraphServiceStorage.sol | (abstract) | (abstract) | - | - |
| DisputeManagerV1Storage | contracts/DisputeManagerStorage.sol | (abstract) | (abstract) | - | - |
| AllocationManager | contracts/utilities/AllocationManager.sol | (abstract) | (abstract) | - | - |
| AllocationManagerV1Storage | contracts/utilities/AllocationManagerStorage.sol | (abstract) | (abstract) | - | - |
| AttestationManager | contracts/utilities/AttestationManager.sol | (abstract) | (abstract) | - | - |
| AttestationManagerV1Storage | contracts/utilities/AttestationManagerStorage.sol | (abstract) | (abstract) | - | - |
| Directory | contracts/utilities/Directory.sol | (abstract) | (abstract) | - | - |

### Initcode Size (Subgraph-Service Contracts)

| Contract | Before (KiB) | After (KiB) | Change (KiB) |
| ------------------- | ------------ | ----------- | ------------ |
| **SubgraphService** | 26.109 | 24.894 | **-1.215** |
| **DisputeManager** | 14.649 | 12.342 | **-2.307** |

## Issuance Contract Bytecode Sizes

All contracts defined in `packages/issuance/contracts/`:

| Contract | Source File | Before (KiB) | After (KiB) | Change (KiB) | Change (%) |
| ---------------------------- | -------------------------------------------------- | ------------ | ----------- | ------------ | ---------- |
| **IssuanceAllocator** | contracts/allocate/IssuanceAllocator.sol | 10.444 | 10.250 | **-0.194** | -1.9% |
| **RewardsEligibilityOracle** | contracts/eligibility/RewardsEligibilityOracle.sol | 4.316 | 4.554 | +0.238 | +5.5% |
| **DirectAllocation** | contracts/allocate/DirectAllocation.sol | 2.978 | 3.393 | +0.415 | +13.9% |
| BaseUpgradeable | contracts/common/BaseUpgradeable.sol | (abstract) | (abstract) | - | - |

### Initcode Size (Issuance Contracts)

| Contract | Before (KiB) | After (KiB) | Change (KiB) |
| ---------------------------- | ------------ | ----------- | ------------ |
| **IssuanceAllocator** | 10.817 | 10.601 | **-0.216** |
| **RewardsEligibilityOracle** | 4.666 | 4.881 | +0.215 |
| **DirectAllocation** | 3.330 | 3.723 | +0.393 |

### Test Contracts (Issuance)

| Contract | Before (KiB) | After (KiB) | Change (KiB) |
| ---------------------------- | ------------ | ----------- | ------------ |
| IssuanceAllocatorTestHarness | 10.641 | 10.331 | -0.310 |
| MockReentrantTarget | 1.886 | 1.535 | -0.351 |
| MockNotificationTracker | 0.495 | 0.438 | -0.057 |
| MockRevertingTarget | 0.342 | 0.250 | -0.092 |
| MockSimpleTarget | 0.293 | 0.237 | -0.056 |
| MockERC165 | 0.188 | 0.141 | -0.047 |

## Dependency Library Sizes

Libraries from horizon and other packages compiled as part of subgraph-service:

### Horizon Libraries

| Library | Before (KiB) | After (KiB) | Change (KiB) |
| ---------------- | ------------ | ----------- | ------------ |
| LinkedList | 0.084 | 0.056 | -0.028 |
| TokenUtils | 0.084 | 0.056 | -0.028 |
| UintRange | 0.084 | 0.056 | -0.028 |
| MathUtils | 0.084 | 0.056 | -0.028 |
| PPMMath | 0.084 | 0.056 | -0.028 |
| ProvisionTracker | 0.084 | 0.056 | -0.028 |

### OpenZeppelin Libraries

| Library | Before (KiB) | After (KiB) | Change (KiB) |
| ---------------- | ------------ | ----------- | ------------ |
| Address | 0.084 | 0.056 | -0.028 |
| Panic | 0.084 | 0.056 | -0.028 |
| Strings | 0.084 | 0.056 | -0.028 |
| Errors | 0.084 | 0.056 | -0.028 |
| MessageHashUtils | 0.084 | 0.056 | -0.028 |
| SafeCast | 0.084 | 0.056 | -0.028 |
| ECDSA | 0.084 | 0.056 | -0.028 |
| SignedMath | 0.084 | 0.056 | -0.028 |
| Math | 0.084 | 0.056 | -0.028 |

### Interfaces Package

| Contract | Before (KiB) | After (KiB) | Change (KiB) |
| ---------------- | ------------ | ----------- | ------------ |
| RewardsCondition | 0.458 | 0.520 | +0.062 |

## Key Observations

### subgraph-service

1. **SubgraphService now fits within mainnet limit**: The 24 KiB contract size limit was exceeded before (24.455 KiB). After the upgrade, it's safely under at 23.110 KiB.

2. **Significant savings on main contracts**: Despite increasing optimizer runs from 10 to 100 (which typically increases size for runtime gas savings), the viaIR pipeline produced smaller bytecode:
- SubgraphService: -1.345 KiB (-5.5%)
- DisputeManager: -2.361 KiB (-17.8%)

3. **Abstract contracts have no bytecode**: Storage contracts (e.g., `SubgraphServiceV1Storage`), utility contracts (`AllocationManager`, `AttestationManager`, `Directory`) are inherited by deployable contracts and have no standalone bytecode.

4. **Library stub sizes reduced**: All library stubs decreased from 0.084 KiB to 0.056 KiB (-33%), indicating more efficient metadata encoding.

### issuance

1. **IssuanceAllocator reduced**: The main contract decreased slightly (-0.194 KiB, -1.9%) with viaIR enabled.

2. **Smaller contracts increased**: DirectAllocation (+13.9%) and RewardsEligibilityOracle (+5.5%) increased in size. This is expected behavior as viaIR optimizations are more effective on larger contracts with complex inheritance patterns.

3. **Test contracts all decreased**: All mock/test contracts benefited from viaIR, showing -5% to -19% reductions.

## Why viaIR Reduces Size

The viaIR (Intermediate Representation) compilation pipeline:

- Uses Yul as an intermediate language
- Enables more aggressive cross-function optimizations
- Removes redundant code paths more effectively
- Particularly beneficial for large contracts with complex inheritance

## Date

Comparison performed: 2026-01-25
201 changes: 201 additions & 0 deletions docs/IGraphProxyAdminInterfaceFix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# IGraphProxyAdmin Interface Signature Fix

## Issue

The IGraphProxyAdmin interface in `packages/interfaces/contracts/contracts/upgrades/IGraphProxyAdmin.sol` had incorrect function signatures that didn't match the actual GraphProxyAdmin contract implementation.

### Understanding the Two Different `acceptProxy` Methods

There are **two different contracts** with similar-sounding methods, which can cause confusion:

1. **GraphUpgradeable** (base class for implementation contracts):

```solidity
// Called ON the implementation contract
function acceptProxy(IGraphProxy _proxy) external onlyProxyAdmin(_proxy) {
_proxy.acceptUpgrade();
}
```

This is inherited by implementation contracts like RewardsManager, Staking, etc.

2. **GraphProxyAdmin** (admin contract that manages upgrades):

```solidity
// Called ON the admin contract, which then calls the implementation
function acceptProxy(GraphUpgradeable _implementation, IGraphProxy _proxy) external onlyGovernor {
_implementation.acceptProxy(_proxy);
}
```

This is the admin contract that orchestrates upgrades.

**IGraphProxyAdmin represents the second one** - the GraphProxyAdmin admin contract, not the GraphUpgradeable base class.

### Incorrect Interface (Before)

The interface mistakenly used the single-parameter signature from GraphUpgradeable:

```solidity
function acceptProxy(IGraphProxy proxy) external;

function acceptProxyAndCall(IGraphProxy proxy, bytes calldata data) external;
```

### Actual GraphProxyAdmin Implementation

From `packages/contracts/contracts/upgrades/GraphProxyAdmin.sol`:

```solidity
function acceptProxy(GraphUpgradeable _implementation, IGraphProxy _proxy) external onlyGovernor {
_implementation.acceptProxy(_proxy);
}

function acceptProxyAndCall(
GraphUpgradeable _implementation,
IGraphProxy _proxy,
bytes calldata _data
) external onlyGovernor {
_implementation.acceptProxyAndCall(_proxy, _data);
}
```

The interface was **missing the first parameter** (`implementation` address) from both functions. It had copied the signature from GraphUpgradeable instead of using the correct GraphProxyAdmin signature.

## Impact

### Why This Mattered

The deployment package (`@graphprotocol/deployment`) needs to call `acceptProxy` with the correct signature to upgrade proxy contracts. The function requires TWO parameters:

1. The implementation contract address
2. The proxy contract address

Because the interface was wrong, the deployment code had to work around it by loading the full contract ABI instead of using the cleaner interface ABI:

```typescript
// packages/deployment/lib/abis.ts (old workaround)
// Note: Load from actual contract, not interface, because IGraphProxyAdmin is outdated
// Interface shows: acceptProxy(IGraphProxy proxy)
// Contract has: acceptProxy(GraphUpgradeable _implementation, IGraphProxy _proxy)
export const GRAPH_PROXY_ADMIN_ABI = loadAbi(
'@graphprotocol/contracts/artifacts/contracts/upgrades/GraphProxyAdmin.sol/GraphProxyAdmin.json',
)
```

### Why Horizon is Not Affected

GraphDirectory in horizon (`packages/horizon/contracts/utilities/GraphDirectory.sol`) imports and uses IGraphProxyAdmin, but **only as a type reference**:

```solidity
IGraphProxyAdmin private immutable GRAPH_PROXY_ADMIN;

constructor(address controller) {
GRAPH_PROXY_ADMIN = IGraphProxyAdmin(_getContractFromController("GraphProxyAdmin"));
}

function _graphProxyAdmin() internal view returns (IGraphProxyAdmin) {
return GRAPH_PROXY_ADMIN;
}
```

GraphDirectory:

- Stores the address as an immutable reference
- Returns it via a getter function
- **Never calls any methods on IGraphProxyAdmin** (like `acceptProxy`)

Since horizon doesn't call the methods, fixing the interface signature doesn't break horizon.

## Fix Applied

### Updated Interface

```solidity
/**
* @notice Accept ownership of a proxy contract
* @param implementation The implementation contract accepting the proxy
* @param proxy The proxy contract to accept
*/
function acceptProxy(address implementation, IGraphProxy proxy) external;

/**
* @notice Accept ownership of a proxy contract and call a function
* @param implementation The implementation contract accepting the proxy
* @param proxy The proxy contract to accept
* @param data The calldata to execute after accepting
*/
function acceptProxyAndCall(address implementation, IGraphProxy proxy, bytes calldata data) external;
```

**Notes on parameter type choice:**

- Used `address` instead of `GraphUpgradeable` for the implementation parameter
- This avoids creating a dependency from interfaces package to contracts package
- The actual contract uses `GraphUpgradeable`, but `address` is compatible (Solidity allows passing addresses for contract types)
- The ABI encoding is identical - both produce the same function selector and parameter encoding

**Call flow for context:**

```
Deployer/Governor
→ GraphProxyAdmin.acceptProxy(implAddress, proxyAddress) ← IGraphProxyAdmin represents THIS
→ implAddress.acceptProxy(proxyAddress) ← GraphUpgradeable provides this
→ proxyAddress.acceptUpgrade()
```

### Updated Deployment Code

Removed the workaround comment and switched to using the interface:

```typescript
// packages/deployment/lib/abis.ts (now clean)
export const GRAPH_PROXY_ADMIN_ABI = loadAbi(
'@graphprotocol/interfaces/artifacts/contracts/contracts/upgrades/IGraphProxyAdmin.sol/IGraphProxyAdmin.json',
)
```

## Files Changed

1. `packages/interfaces/contracts/contracts/upgrades/IGraphProxyAdmin.sol`
- Fixed `acceptProxy` signature
- Fixed `acceptProxyAndCall` signature

2. `packages/deployment/lib/abis.ts`
- Removed workaround comment
- Changed to load from interface instead of full contract

## Testing

Build verification:

- ✅ interfaces package builds successfully
- ✅ deployment package dependencies build successfully
- ✅ No TypeScript compilation errors
- ✅ Hardhat compilation successful

The deployment code in `packages/deployment/lib/upgrade-implementation.ts` already calls acceptProxy with both parameters:

```typescript
const acceptData = encodeFunctionData({
abi: GRAPH_PROXY_ADMIN_ABI,
functionName: 'acceptProxy',
args: [pendingImpl as `0x${string}`, proxyAddress as `0x${string}`],
})
```

This call now works with the corrected interface ABI.

## Recommendation

This fix should be safe to merge. The interface now accurately reflects the actual contract implementation, and no existing code is broken by the change since:

1. Deployment already expects the two-parameter signature
2. Horizon only uses the type, never calls the methods
3. The fix aligns the interface with reality, reducing confusion

## Questions for Team Review

1. Are there other consumers of IGraphProxyAdmin that might be affected?
2. Should this be considered a breaking change requiring a major version bump of @graphprotocol/interfaces?
3. Is there a reason the interface was historically wrong (legacy compatibility concerns)?
Loading