File tree Expand file tree Collapse file tree 5 files changed +29
-2
lines changed
Expand file tree Collapse file tree 5 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,14 @@ impl Config {
226226 ) ;
227227 }
228228
229+ // Horizon configuration validation
230+ if self . horizon . enabled && self . horizon . subgraph_service_address . is_none ( ) {
231+ return Err (
232+ "Missing required 'horizon.subgraph_service_address' when horizon.enabled = true. \
233+ Set it in the config file under [horizon] or via env var TAP_AGENT__HORIZON__SUBGRAPH_SERVICE_ADDRESS.". to_string ( ) ,
234+ ) ;
235+ }
236+
229237 Ok ( ( ) )
230238 }
231239}
@@ -470,6 +478,11 @@ pub struct HorizonConfig {
470478 /// - Only V1 TAP receipts are supported
471479 #[ serde( default ) ]
472480 pub enabled : bool ,
481+
482+ // Address of the SubgraphService contract used for Horizon (V2)
483+ // Required when `enabled = true`. Optional otherwise.
484+ #[ serde( default ) ]
485+ pub subgraph_service_address : Option < Address > ,
473486}
474487
475488#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -412,6 +412,9 @@ pub struct SenderAccountConfig {
412412
413413 #[ doc( hidden) ]
414414 pub horizon_enabled : bool ,
415+
416+ /// SubgraphService address used for Horizon (V2) receipts
417+ pub subgraph_service_address : Address ,
415418}
416419
417420impl SenderAccountConfig {
@@ -428,6 +431,10 @@ impl SenderAccountConfig {
428431 tap_sender_timeout : config. tap . sender_timeout_secs ,
429432 trusted_senders : config. tap . trusted_senders . clone ( ) ,
430433 horizon_enabled : config. horizon . enabled ,
434+ subgraph_service_address : config
435+ . horizon
436+ . subgraph_service_address
437+ . unwrap_or ( config. indexer . indexer_address ) ,
431438 }
432439 }
433440}
Original file line number Diff line number Diff line change @@ -181,6 +181,8 @@ pub struct AllocationConfig {
181181 pub indexer_address : Address ,
182182 /// Polling interval for escrow subgraph
183183 pub escrow_polling_interval : Duration ,
184+ /// SubgraphService address for Horizon (V2)
185+ pub subgraph_service_address : Address ,
184186}
185187
186188impl AllocationConfig {
@@ -191,6 +193,7 @@ impl AllocationConfig {
191193 rav_request_receipt_limit : config. rav_request_receipt_limit ,
192194 indexer_address : config. indexer_address ,
193195 escrow_polling_interval : config. escrow_polling_interval ,
196+ subgraph_service_address : config. subgraph_service_address ,
194197 }
195198 }
196199}
@@ -484,6 +487,7 @@ where
484487 . pgpool ( pgpool. clone ( ) )
485488 . allocation_id ( T :: allocation_id_to_address ( & allocation_id) )
486489 . indexer_address ( config. indexer_address )
490+ . subgraph_service_address ( config. subgraph_service_address )
487491 . sender ( sender)
488492 . escrow_accounts ( escrow_accounts. clone ( ) )
489493 . build ( ) ;
Original file line number Diff line number Diff line change @@ -200,6 +200,9 @@ pub struct TapAgentContext<T> {
200200 sender : Address ,
201201 #[ cfg_attr( test, builder( default = crate :: test:: INDEXER . 1 ) ) ]
202202 indexer_address : Address ,
203+ /// SubgraphService address (used by Horizon V2 queries)
204+ #[ cfg_attr( test, builder( default = crate :: test:: INDEXER . 1 ) ) ]
205+ subgraph_service_address : Address ,
203206 escrow_accounts : Receiver < EscrowAccounts > ,
204207 /// We use phantom data as a marker since it's
205208 /// only used to define what methods are available
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ impl ReceiptRead<TapReceipt> for TapAgentContext<Horizon> {
257257 "# ,
258258 CollectionId :: from( self . allocation_id) . encode_hex( ) ,
259259 self . sender. encode_hex( ) ,
260- self . indexer_address . encode_hex( ) ,
260+ self . subgraph_service_address . encode_hex( ) ,
261261 self . indexer_address. encode_hex( ) ,
262262 & signers,
263263 rangebounds_to_pgrange( timestamp_range_ns) ,
@@ -379,7 +379,7 @@ impl ReceiptDelete for TapAgentContext<Horizon> {
379379 & signers,
380380 rangebounds_to_pgrange( timestamp_ns) ,
381381 self . sender. encode_hex( ) ,
382- self . indexer_address . encode_hex( ) ,
382+ self . subgraph_service_address . encode_hex( ) ,
383383 self . indexer_address. encode_hex( ) ,
384384 )
385385 . execute ( & self . pgpool )
You can’t perform that action at this time.
0 commit comments