You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-3Lines changed: 38 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,11 +171,46 @@ The Subgraph Service is an [axum](https://crates.io/crates/axum)-based web serve
171
171
172
172
### indexer-tap-agent
173
173
174
-
The TAP Agent is an actor-based system powered by [ractor](https://crates.io/crates/ractor). It is responsible for processing receipts into RAVs and marking them ready for redemption.
174
+
The TAP Agent is an actor-based system powered by [ractor](https://crates.io/crates/ractor). It processes receipts into RAVs (Receipt Aggregate Vouchers) and prepares them for redemption by the `indexer-agent`.
175
175
176
176
#### Key Features
177
-
-**Receipt Processing:** Handles receipts stored by `indexer-service-rs`, performing aggregation and RAV generation.
178
-
-**Concurrency Management:** Leverages the actor model to efficiently manage receipt processing tasks.
177
+
1.**Receipt Processing:**
178
+
- Receipts are fetched from the `receipts` table in the database using `pglisten`.
179
+
- The actor system validates and processes receipts before aggregating them into RAVs.
180
+
- Debug logs can be activated using `RUST_LOG=debug` to provide additional insights during the receipt lifecycle.
181
+
182
+
2.**Actor System:**
183
+
- The TAP Agent operates using three main actor groups:
184
+
-**SenderAccountManager:**
185
+
- Monitors the indexer's escrow accounts.
186
+
- Handles receipt routing to the appropriate `SenderAllocation`.
187
+
- Kills the application if the database connection is lost.
188
+
-**SenderAccount:**
189
+
- Tracks receipts, pending RAVs, and invalid receipts across allocations.
190
+
- Ensures the escrow account has sufficient funds to cover outstanding obligations.
191
+
- Selects the next allocation for creating a RAV request and manages `SenderAllocation` actors.
192
+
-**SenderAllocation:**
193
+
- Represents a `(sender, allocation)` tuple.
194
+
- Processes receipts and sends updated values to the `SenderAccount`.
195
+
- Handles `TriggerRequest` messages to initiate RAV creation.
196
+
197
+
3.**RAV Workflow:**
198
+
- Valid receipts are aggregated into RAVs, which replace older RAVs in the database.
199
+
- Once an allocation is closed, the system creates a **Last RAV**, aggregating all receipts. This final RAV is marked as "Last" and prepared for redemption by the `indexer-agent`.
200
+
201
+
4.**Metrics and Monitoring:**
202
+
- The TAP Agent exposes detailed metrics to monitor system behavior. Key metrics include:
203
+
-**Unaggregated Receipts:** Ensure unaggregated receipts remain below the `max_willing_to_lose` value to prevent the sender from being denied.
204
+
-**RAV Request Failures:** Monitor the rate of failed RAV requests, as repeated failures can disrupt aggregation.
205
+
- Full details of all metrics can be found in the [Metrics Documentation](https://github.com/graphprotocol/indexer-rs/blob/gustavo/rebuild-documentation/docs/Metrics.md#tap-agent-metrics).
206
+
- A Grafana dashboard is available to visualize system metrics and provide a clear overview of the TAP Agent's performance:
0 commit comments