Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
a7fb875
feat: implement Indexing Agreements
matiasedgeandnode May 23, 2025
1651716
test: Add extra tests for Indexing Agreements
matiasedgeandnode Jun 16, 2025
b53ca01
fix: [TRST-H-1] IndexingAgreement.collect() on CanceledByPayer
matiasedgeandnode Jun 19, 2025
da42fb4
fix: Remove PaymentType constraint from RecurringCollector
matiasedgeandnode Jun 23, 2025
7695c9e
fix: [TRST-H-2] Only agreement owner can collect indexing fee
matiasedgeandnode Jul 21, 2025
8048c4c
fix: [TRST-H-3] collect() checks provision
matiasedgeandnode Jul 22, 2025
29dfdcc
fix: [TRST-M-1] correct TYPEHASH string for RCAU
matiasedgeandnode Jul 22, 2025
345cfc8
fix: [TRST-M-2] shared collection window logic
matiasedgeandnode Jul 23, 2025
8b2e93a
fix: [TRST-M-3] Add nonce-based replay protection
matiasedgeandnode Jul 23, 2025
aac9f8b
fix: [TRST-L-3] Add deterministic agreement ID
matiasedgeandnode Jul 23, 2025
836c0c2
fix: [TRST-L-5] Add slippage protection
matiasedgeandnode Jul 24, 2025
e3d2787
fix: [TRST-L-6] Proper agreement version check
matiasedgeandnode Jul 24, 2025
308d6e6
document: [TRST-L-7] update()
matiasedgeandnode Jul 24, 2025
17b794e
fix: [TRST-L-9] Cancel agreement if over-allocated
matiasedgeandnode Jul 24, 2025
6d9a18c
fix: [TRST-R-1] minor fixes
matiasedgeandnode Jul 24, 2025
58b7a28
fix: [TRST-R-4] CEI violation
matiasedgeandnode Jul 24, 2025
5f732ac
fix: [TRST-R-5] Terms validation
matiasedgeandnode Jul 24, 2025
b492251
fix: [TRST-R-6] Configurable indexing fees cut
matiasedgeandnode Jul 25, 2025
0e469be
fix: [TRST-M-2] improve _getCollectionInfo()
matiasedgeandnode Aug 11, 2025
f65877e
feat(interfaces): remove staking extension from interfaces
tmigone Nov 28, 2025
714b32c
chore: more interface removal
tmigone Nov 28, 2025
392047c
feat: clean up post horizon on horizon contracts
tmigone Nov 28, 2025
28f2661
test: update horizon tests after cleanup
tmigone Nov 28, 2025
1d2b76d
fix: more cleanup on horizon, interfaces and toolshed packages
tmigone Dec 1, 2025
ac103d7
fix: contracts changes
tmigone Dec 1, 2025
c541c8d
feat: remove stuff from subgraph service contracts
tmigone Dec 1, 2025
abcafaa
chore: remove dead code
tmigone Dec 1, 2025
eb59951
Merge branch 'main' into tmigone/horizon-cleanup
tmigone Dec 1, 2025
a2abc90
test(contract): hack outdated test suite to pass
tmigone Dec 1, 2025
bee3e79
test: fix vm.assume too many rejections
tmigone Dec 1, 2025
c419850
Merge branch 'main' into tmigone/horizon-cleanup
tmigone Dec 1, 2025
a5bbbf8
chore: address review feedback
tmigone Dec 2, 2025
da2dba7
feat: add fn to force withdraw legacy stake and delegation
tmigone Dec 3, 2025
dd8d624
chore: lint
tmigone Dec 3, 2025
0f71288
fix: re-validate thawingPeriod when accepting provision parameters (O…
tmigone Dec 19, 2025
a91f59a
fix: return correct result for getThawedTokens when called for delega…
tmigone Dec 19, 2025
ed356fe
fix: remove more deprecated code (OZ N-01)
tmigone Dec 19, 2025
1c3e306
fix: outdated documentation (OZ N-02)
tmigone Dec 19, 2025
d9f053a
test: fix tests
tmigone Dec 19, 2025
ad15756
chore: use ^0.8.27 caret pragma and bump solc to 0.8.34
RembrandtK May 5, 2026
9b2fddc
Merge commit '0e469beeba0ec433e313be8c9129bcf99acdaac6' into indexing…
RembrandtK May 5, 2026
2a9d80b
Merge commit 'd9f053a7d96a8a4d81415303ae1d537f836f887c' into indexing…
RembrandtK May 5, 2026
927cd08
feat: add back legacy allocation id collision check
RembrandtK May 5, 2026
9edb765
chore: restore pragma
RembrandtK May 5, 2026
79af545
fix: cap maxSecondsPerCollection instead of reverting
RembrandtK May 5, 2026
20abcac
fix: enforce temporal validation on zero-token collections and remove…
RembrandtK May 5, 2026
8776d49
feat: add adjustThaw to PaymentsEscrow
RembrandtK May 5, 2026
5ea7b1e
refactor: rename IRewardsEligibility to IProviderEligibility
RembrandtK May 5, 2026
d31a2c9
feat: contract approver model for RecurringCollector accept/update
RembrandtK May 5, 2026
2bcc8ec
feat: IDataServiceAgreements interface and SubgraphService integration
RembrandtK May 5, 2026
7d7927a
feat: enumerable indexer tracking for REO and issuance constructor cl…
RembrandtK May 5, 2026
15bd6ce
feat: RecurringAgreementManager with lifecycle, escrow funding, and a…
RembrandtK May 5, 2026
8ca9cc1
fix(rewards): reorder subtraction in _updateSubgraphRewards to avoid …
RembrandtK May 5, 2026
2b5bce3
fix(test): set subgraphService in snapshot inversion tests
RembrandtK May 5, 2026
0d9e8fe
fix(test): exclude named test users from fuzz-generated indexer addre…
RembrandtK May 5, 2026
cd2f1b4
feat: add issuance distribution integration to RAM
RembrandtK May 5, 2026
89ba6e8
docs: clarify two-layer token capping semantics in collection flow
RembrandtK May 5, 2026
50e984d
docs: add payments trust model
RembrandtK May 5, 2026
6a9e372
test: add cross-package testing harness with callback gas measurements
RembrandtK May 5, 2026
251e16f
docs(audit): add PR1301 audit report and findings
RembrandtK May 5, 2026
f5617ef
feat(RAM): threshold-based escrow basis degradation (TRST-M-2, TRST-M-3)
RembrandtK May 5, 2026
435a281
fix(RAM): refresh escrow snapshot in _updateEscrow (TRST-H-3)
RembrandtK May 5, 2026
4fc2be9
fix(RAM): add minimum thaw fraction to prevent dust-thaw griefing (TR…
RembrandtK May 5, 2026
e3bec76
feat(RM): add revert control for ineligible indexers
RembrandtK May 5, 2026
3f9c68c
docs(audit): acknowledge audit findings (TRST-CR-1/3, L-4, R-1, SR-1/…
RembrandtK May 5, 2026
df7f081
feat: resize allocations to zero instead of force-closing
RembrandtK May 5, 2026
4c61ad9
feat: revert closing allocations with active indexing agreement
RembrandtK May 5, 2026
a93ee92
fix(collector): reject agreements with overflow-prone token/duration …
RembrandtK May 5, 2026
74aaa34
feat(collector): offer storage, stored-hash auth, scoped claims and c…
RembrandtK May 5, 2026
68c8a39
fix(collector): harden payer callbacks, add opt-in eligibility gate (…
RembrandtK May 5, 2026
9d16819
fix: compiler stack overflow
RembrandtK May 5, 2026
f56be5f
refactor(RAM): replace set-based range views with indexed accessors
RembrandtK May 5, 2026
fc8e141
feat(RAM): add emergency role control and eligibility oracle escape h…
RembrandtK May 5, 2026
22eab27
refactor(RAM): convert offerAgreement and cancelAgreement to IAgreeme…
RembrandtK May 5, 2026
87a0b89
refactor(RAM): remove offerAgreementUpdate, revokeAgreementUpdate, an…
RembrandtK May 5, 2026
2e75ecc
refactor(RAM): restructure storage into collector → provider hierarchy
RembrandtK May 5, 2026
67af760
feat(collector): make RecurringCollector upgradeable
RembrandtK May 5, 2026
be5cead
feat(collector): add pause mechanism to RecurringCollector (TRST-L-3)
RembrandtK May 5, 2026
70b8fa1
fix(subgraph-service): remove VALID_PROVISION and REGISTERED from can…
RembrandtK May 5, 2026
b289023
docs: update audit extracts for PR1301 v02 report
RembrandtK May 5, 2026
a882efc
fix(collector): add gas overhead buffer to callback prechecks (TRST-L-9)
RembrandtK May 5, 2026
8a22a87
fix(collector): cap returndata copy in payer callbacks (TRST-M-4)
RembrandtK May 5, 2026
c7f3c4b
docs: add response to TRST-L-10 EIP-7702 callback dispatch (won't fix)
RembrandtK May 5, 2026
a7a7305
feat(RAM): drop pair tracking below residual escrow threshold (TRST-M…
RembrandtK May 5, 2026
c1ba8b5
docs: add responses to TRST-L-6, TRST-R-7 (both won't fix)
RembrandtK May 5, 2026
4665998
docs(audit): acknowledge TRST-R-3 cancelAgreement defensive check
RembrandtK May 5, 2026
018a315
fix(collector): remove dead oldHash guard (TRST-R-6)
RembrandtK May 5, 2026
7a2ceea
fix(collector): non-zero offer types, reserve OFFER_TYPE_NONE=0 senti…
RembrandtK May 5, 2026
98acddd
refactor(interfaces): drop unused state and offer-option flags, tight…
RembrandtK May 5, 2026
bebf0db
docs(audit): acknowledge trust-boundary correction in TRST-H-4
RembrandtK May 5, 2026
65a63fa
docs(audit): acknowledge reclaim-reason change in TRST-R-13
RembrandtK May 5, 2026
eb511ca
docs(ram): document collector replay-protection assumption (TRST-R-4)
RembrandtK May 5, 2026
f2441ea
docs(ram): document non-retroactive role-change semantics (TRST-R-10)
RembrandtK May 5, 2026
ad829d0
docs(ram): align pause-escalation prose with whenNotPaused scope (TRS…
RembrandtK May 5, 2026
c2c15eb
docs(collector): note self-authorization auth-check obligation (TRST-…
RembrandtK May 5, 2026
229ede6
fix(subgraph-service): validate update terms against RCAU rate, not s…
RembrandtK May 5, 2026
35ba863
refactor(collector): preparatory helpers, signatures, and version con…
RembrandtK May 5, 2026
9ad6498
refactor(collector): drop unreachable agreementId-zero check
RembrandtK May 5, 2026
cb36d57
refactor(collector): extract _requireValidTerms from duplicated valid…
RembrandtK May 5, 2026
25fd070
refactor(collector): split accept logic out of _validateAndStoreAgree…
RembrandtK May 5, 2026
4fdbdab
refactor(collector): split update apply out of _validateAndStoreUpdate
RembrandtK May 5, 2026
08634a3
feat(subgraph-service): idempotent accept/update with allocation rebi…
RembrandtK May 5, 2026
51963df
refactor(collector): hoist solhint-disable, idiomatic deadline compar…
RembrandtK May 5, 2026
c4c52de
fix(collector): validate offer terms against deadline, not block.time…
RembrandtK May 5, 2026
523171e
refactor(collector): extract _getAgreementDetails/_versionHashAt helpers
RembrandtK May 5, 2026
41caee8
fix(collector): persistent agreement.payer for independent cancellati…
RembrandtK May 5, 2026
de49979
feat(collector): idempotent accept/update/cancel-on-nothing
RembrandtK May 5, 2026
600951d
feat(collector): add OfferCancelled event for SCOPE_PENDING cancellat…
RembrandtK May 5, 2026
ef0c92e
feat(collector): per-version semantics in getAgreementDetails (TRST-L…
RembrandtK May 5, 2026
f2361e8
feat(collector): compose cancel/settled flags in getAgreementDetails …
RembrandtK May 5, 2026
262d9cc
feat(collector): add SCOPE_SIGNED to cancel() for EOA offer revocatio…
RembrandtK May 5, 2026
258a0f3
feat(issuance): expose getIssuanceAllocator on IIssuanceTarget
RembrandtK May 5, 2026
d28e30c
fix(collector): validate full terms at offer time
RembrandtK May 5, 2026
1434b12
fix(collector): respect deadlines in scoped claim cap
RembrandtK May 5, 2026
7401923
refactor(collector): collapse redundant state guard in _getMaxNextClaim
RembrandtK May 5, 2026
950b23b
fix(collector): use dedicated error for invalid offer type in offer()
RembrandtK May 5, 2026
7c12e2f
chore(collector): make module-level constants internal to free EIP-17…
RembrandtK May 5, 2026
a8f4632
feat(collector): add CONDITION_AGREEMENT_OWNER for ERC-165-validated …
RembrandtK May 5, 2026
11292cf
docs(audits): drop withdrawn TRST findings, retitle and park remainin…
RembrandtK May 5, 2026
3af1424
docs(audits): rename parked v03 lows from TRST-L-{old}-{new}.md to fi…
RembrandtK May 5, 2026
7911e1d
docs(audits): incorporate Trust Security PR1325 v03 fix-review
RembrandtK May 5, 2026
80c5010
docs(collector): clarify cancel() signer-vs-payer caller for SCOPE_SI…
RembrandtK May 5, 2026
8d16537
test(collector): assert callbacks receive MAX_PAYER_CALLBACK_GAS with…
RembrandtK May 5, 2026
66dec49
docs(collector): document EIP-7702 trust assumption for CONDITION_ELI…
RembrandtK May 5, 2026
93e7d1c
refactor(ram): use VERSION_CURRENT instead of magic 0 in getAgreement…
RembrandtK May 5, 2026
2292e6a
chore(ci): fix flaky CI tests and silence block-timestamp lint
RembrandtK May 6, 2026
bbec75e
docs(audit): record pre-rebase SHAs and old → new mapping
RembrandtK May 6, 2026
675d397
docs(audit): add Trust Security PR1331 v04 fix-review report
RembrandtK May 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: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ packages/*/.eslintcache
dist/
dist-v5/
build/
packages/contracts/**/types/
deployments/hardhat/
*.js.map
*.d.ts.map
Expand Down Expand Up @@ -58,7 +59,9 @@ bin/
.env
.DS_Store
.vscode
core
# Forge core dumps
**/core
!**/core/

# Coverage and other reports
coverage/
Expand Down
176 changes: 176 additions & 0 deletions docs/PaymentsTrustModel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Payments Trust Model

This document describes the trust assumptions between the five core actors in the Graph Horizon payments protocol: **payer**, **collector**, **data service**, **receiver**, and **escrow**. The general model is described first, followed by specifics of the current implementation (RecurringCollector, SubgraphService, RAM).

## Trust Summary

| Relationship | Trust | Mitigation |
| --------------------------- | ----------------------------------------- | ------------------------------------------------ |
| Payer → Collector | Enforces agreed caps | Protocol-deployed; escrow caps absolute exposure |
| Payer → Receiver | Claimed work is honest | Post-hoc disputes + stake locking |
| Receiver → Payer (EOA) | Escrow stays funded | Thaw period; on-chain visibility |
| Receiver → Payer (contract) | Escrow stays funded; not block collection | RecurringAgreementManager: protocol-deployed |
| Receiver → Collector | Correctly caps and forwards payment | Protocol-deployed; code is transparent |
| Receiver → Data Service | Correct computation; not paused | Protocol-deployed; code is transparent |
| Receiver → Escrow | Releases funds on valid collection | Stateless; no discretionary logic |
| Data Service ↔ Collector | Each trusts the other's domain | Two-layer capping; independent validation |

## Actors

| Actor | Role | Examples |
| ---------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **Payer** | Funds escrow; authorizes collector contracts | RecurringAgreementManager (protocol-managed), external payer (ECDSA-signed) |
| **Collector** | Validates payment requests; enforces per-agreement caps | RecurringCollector |
| **Data service** | Entry point for collection; computes amounts earned | SubgraphService |
| **Receiver** | Service provider receiving payment | Indexer |
| **Escrow** | Holds GRT per (payer, collector, receiver) tuple; enforces thaw periods | PaymentsEscrow |

## Payment Flow (General Model)

```
│ Receiver
└─> Data Service.collect(work done)
└─> Collector.collect(tokens earned)
│ validates payment terms, caps amount
└─> PaymentsEscrow.collect(tokens to collect)
└─> GraphPayments.collect(tokens collected)
│ distributes to: protocol (burned), data service, delegation pool, receiver
<───┘
<───┘
<───┘
<───┘
```

Any data service and collector can plug into this flow. The PaymentsEscrow and GraphPayments layers are fixed protocol infrastructure. The data service computes its own token amount; the collector independently caps it; the actual payment is `min(tokens earned, agreement cap)`, and escrow reverts if balance is insufficient.

### RecurringCollector Extensions

RecurringCollector adds payer callbacks when the payer is a contract:

```
│ Receiver
└─> Data Service.collect(work done)
└─> RecurringCollector.collect(tokens earned)
│ validates agreement terms, caps amount
│ validates receiver has active provision with data service
│ if 0 < tokensToCollect AND payer is contract:
│ if implements IProviderEligibility:
│ require payer.isEligible(receiver) ← can BLOCK
│ try payer.beforeCollection(id, tokens) (can't block)
└─> PaymentsEscrow.collect(tokens to collect)
└─> GraphPayments.collect(tokens collected)
│ distributes to: protocol (burned), data service, delegation pool, receiver
<───┘
<───┘
│ if payer is contract: (even if tokensToCollect == 0)
│ try payer.afterCollection(id, tokens) (can't block)
<───┘
<───┘
```

- **`isEligible`**: fail-open gate — only an explicit return of `0` blocks collection; call failures (reverts, malformed data) are ignored to prevent a buggy payer from griefing the receiver. Only called when `0 < tokensToCollect`.
- **`beforeCollection`**: try-catch — allows payer to top up escrow (RAM uses this for JIT deposits), but cannot block (though a malicious contract payer could consume excessive gas). Only called when `0 < tokensToCollect`.
- **`afterCollection`**: try-catch — allows payer to reconcile state post-collection, cannot block (same gas exhaustion caveat). Called even when `tokensToCollect == 0` (zero-token collections still trigger reconciliation).

## Trust Relationships

### Payer → Collector

**Trust required**: The payer authorizes the collector contract and trusts it to enforce payment terms; that it will not collect more than the agreed-upon amounts per collection period.

**Mitigation**: The collector is a protocol-deployed contract with fixed logic. The escrow balance provides an absolute ceiling — the collector cannot extract more than the deposited balance.

> _RecurringCollector_: enforces per-agreement caps of `maxOngoingTokensPerSecond × maxSecondsPerCollection` (plus `maxInitialTokens` on first collection) per collection window. The payer's exposure is bounded by the agreement terms they signed or authorized.

### Payer → Receiver

**Trust required**: The receiver is paid immediately when collecting based on claimed work done. The payer relies on post-hoc enforcement rather than on-chain validation of the receiver's claims.

**Mitigation**: The payment protocol itself is agnostic to what evidence the receiver provides — that is the data service's domain.

> _SubgraphService_: the receiver submits a POI (Proof of Indexing) which is emitted in events but not validated on-chain. Payment proceeds regardless of POI correctness. The dispute system provides post-hoc enforcement: fishermen can challenge invalid POIs, and the indexer's locked stake (`tokensCollected × stakeToFeesRatio`) serves as economic collateral during the dispute period.
>
> _RAM as payer_: the payer is the protocol itself, and if configured, an eligibility oracle gates the receiver's ability to collect (checked by RecurringCollector via `IProviderEligibility`).

### Receiver → Payer

**Trust minimised by escrow**: The escrow is the primary trust-minimisation mechanism — to avoid trust in the payer, the receiver should bound uncollected work to what the escrow guarantees rather than relying on the payer to top up.

Caveats on effective escrow (contract payers introduce additional trust requirements — see caveat 3):

1. **Thawing reduces effective balance** — a payer can initiate a thaw; once the thaw period completes, those tokens are withdrawable. The receiver should account for the thawing period and any in-progress thaws when assessing available escrow.
2. **Cancellation freezes the collection window** at `canceledAt` — the receiver can still collect for the period up to cancellation (with `minSecondsPerCollection` bypassed), but no further.
3. **Contract payers can block** — if the payer is a contract that implements `IProviderEligibility`, it can deny collection via `isEligible` (see [RecurringCollector Extensions](#recurringcollector-extensions)).

**Mitigation**: The thawing period provides a window for the receiver to collect before funds are withdrawn. The escrow balance and thaw state are publicly visible on-chain.

> _RAM as payer_: RAM automates escrow maintenance (Full/OnDemand/JIT modes). When not operating in Full escrow mode, the receiver also depends on RAM's ability to fund at collection time. Mitigation: RAM is a protocol-deployed contract — its funding logic is transparent and predictable, with no adversarial incentive to deny payment.

### Receiver → Data Service

**Trust required**: The receiver (or their operator) calls the data service's `collect()` directly. The receiver trusts it to:

1. **Compute amounts correctly** — the data service determines its claim of what is earned
2. **Not be paused** — the data service may have a pause mechanism that would block collection

**Mitigation**: The data service is a protocol-deployed contract. Token amounts are capped by the collector independently, so data service overstatement is bounded.

> _SubgraphService_: `_tokensToCollect` computes the amount earned. The `enforceService` modifier requires the caller to be authorized by the receiver (indexer) for their provision.

### Receiver → Escrow

**Trust required**: The receiver trusts escrow to release funds when a valid collection is presented. The receiver has no direct access to escrow — funds can only flow through the authorized collection path (data service → collector → escrow → GraphPayments → receiver).

**Mitigation**: Escrow is a stateless intermediary — it debits the payer's balance and forwards to GraphPayments. No discretionary logic. The failure modes are insufficient balance or protocol-wide pause (escrow's `collect` has a `notPaused` modifier).

### Data Service → Collector

**Trust required**: The data service trusts the collector to faithfully enforce temporal and amount-based caps. The data service provides its own token calculation, but the collector applies `min(requested, cap)` — the data service relies on this capping being correct.

**Mitigation**: Both are protocol-deployed contracts. The two-layer capping model means neither layer alone determines the payout — the minimum of both applies.

### Collector → Data Service

**Trust required**: The collector trusts the data service to call `collect()` only with valid, legitimate payment requests. The collector validates payment terms but relies on the data service to verify service delivery.

**Mitigation**: The collector validates its own domain (agreement existence, temporal bounds, amount caps) independently.

> _RecurringCollector + SubgraphService_: the collector validates RCA terms; the data service verifies allocation status and emits POIs for dispute.

## Who Can Block Collection?

Which actors can prevent a collection from succeeding, and how:

| Actor | Can block? | How (general model) |
| ------------ | ---------- | ---------------------------------------------- |
| Payer | Yes | Contract payer only, via `isEligible` |
| Collector | Yes | Reject payment request based on its own rules |
| Data service | Yes | Pause mechanism; code-level revert conditions |
| Receiver | No | Can only initiate, not block |
| Escrow | Yes | Insufficient balance; also protocol-wide pause |

### Implementation-Specific Notes

**ECDSA-signed agreements** (external payer): the payer is an EOA and has no on-chain blocking mechanism. The receiver's trust is bounded by the current escrow balance (minus any thawing amount).

**RAM-managed agreements** (protocol payer): the payer (RAM) has no adversarial incentive to block. If an eligibility oracle is configured, blocking trust effectively transfers to the oracle (see [RecurringCollector Extensions](#recurringcollector-extensions)).

## Trust Reduction Mechanisms

| Mechanism | What it bounds | Actor protected | Scope |
| --------------------------------------------------------------- | ------------------------------------------------------------------ | --------------- | ------------------------ |
| Escrow deposit + thaw period | Payer can't instantly withdraw | Receiver | General |
| Two-layer token capping | Neither data service nor collector alone sets amount | Payer | General |
| Collector-enforced agreement terms | Per-collection exposure | Payer | General |
| Cancellation still allows final collection | Receiver collects accrued amount | Receiver | General |
| Dispute system + stake locking | Invalid POIs are challengeable | Payer / network | SubgraphService |
| Eligibility oracle | Ineligible receivers denied | Payer | RecurringCollector + RAM |
| `lastCollectionAt` advancing only through validated collections | No fake liveness signals (advances even on zero-token collections) | All | RecurringCollector |

## Related Documents

- [MaxSecondsPerCollectionCap.md](../packages/horizon/contracts/payments/collectors/MaxSecondsPerCollectionCap.md) — Two-layer capping semantics
- [RecurringAgreementManager.md](../packages/issuance/contracts/agreement/RecurringAgreementManager.md) — RAM escrow management
- [RewardsEligibilityOracle.md](../packages/issuance/contracts/eligibility/RewardsEligibilityOracle.md) — Oracle trust model and failsafe
- [RewardAccountingSafety.md](./RewardAccountingSafety.md) — Reward accounting invariants
- [RewardConditions.md](./RewardConditions.md) — Reclaim conditions
File renamed without changes.
8 changes: 7 additions & 1 deletion packages/contracts-test/tests/unit/disputes/poi.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DisputeManager } from '@graphprotocol/contracts'
import { DisputeManager, IRewardsManager } from '@graphprotocol/contracts'
import { EpochManager } from '@graphprotocol/contracts'
import { GraphToken } from '@graphprotocol/contracts'
import { IStaking } from '@graphprotocol/contracts'
Expand Down Expand Up @@ -30,6 +30,7 @@ describe('DisputeManager:POI', () => {
let epochManager: EpochManager
let grt: GraphToken
let staking: IStaking
let rewardsManager: IRewardsManager

// Derive some channel keys for each indexer used to sign attestations
const indexerChannelKey = deriveChannelKey()
Expand Down Expand Up @@ -92,10 +93,15 @@ describe('DisputeManager:POI', () => {
epochManager = contracts.EpochManager as EpochManager
grt = contracts.GraphToken as GraphToken
staking = contracts.Staking as IStaking
rewardsManager = contracts.RewardsManager as IRewardsManager

// Give some funds to the fisherman
await grt.connect(governor).mint(fisherman.address, fishermanTokens)
await grt.connect(fisherman).approve(disputeManager.address, fishermanTokens)

// HACK: we set the staking contract as the subgraph service to make tests pass.
// This is due to the test suite being outdated.
await rewardsManager.connect(governor).setSubgraphService(staking.address)
})

beforeEach(async function () {
Expand Down
8 changes: 7 additions & 1 deletion packages/contracts-test/tests/unit/disputes/query.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAttestation, Receipt } from '@graphprotocol/common-ts'
import { DisputeManager } from '@graphprotocol/contracts'
import { DisputeManager, IRewardsManager } from '@graphprotocol/contracts'
import { EpochManager } from '@graphprotocol/contracts'
import { GraphToken } from '@graphprotocol/contracts'
import { IStaking } from '@graphprotocol/contracts'
Expand Down Expand Up @@ -35,6 +35,7 @@ describe('DisputeManager:Query', () => {
let epochManager: EpochManager
let grt: GraphToken
let staking: IStaking
let rewardsManager: IRewardsManager

// Derive some channel keys for each indexer used to sign attestations
const indexer1ChannelKey = deriveChannelKey()
Expand Down Expand Up @@ -121,6 +122,7 @@ describe('DisputeManager:Query', () => {
epochManager = contracts.EpochManager as EpochManager
grt = contracts.GraphToken as GraphToken
staking = contracts.Staking as IStaking
rewardsManager = contracts.RewardsManager as IRewardsManager

// Give some funds to the fisherman
for (const dst of [fisherman, fisherman2]) {
Expand All @@ -139,6 +141,10 @@ describe('DisputeManager:Query', () => {
indexerAddress: indexer.address,
receipt,
}

// HACK: we set the staking contract as the subgraph service to make tests pass.
// This is due to the test suite being outdated.
await rewardsManager.connect(governor).setSubgraphService(staking.address)
})

beforeEach(async function () {
Expand Down
Loading