@@ -19,7 +19,10 @@ use super::{
19
19
unaggregated_receipts:: UnaggregatedReceipts ,
20
20
} ;
21
21
use crate :: {
22
- tap:: context:: { NetworkVersion , TapAgentContext } ,
22
+ tap:: {
23
+ context:: { NetworkVersion , TapAgentContext } ,
24
+ CheckingReceipt ,
25
+ } ,
23
26
task_lifecycle:: { LifecycleManager , RestartPolicy , TaskHandle } ,
24
27
} ;
25
28
use indexer_receipt:: TapReceipt ;
@@ -85,6 +88,9 @@ struct TaskState<T: NetworkVersion> {
85
88
/// Aggregator client for signing RAVs
86
89
#[ allow( dead_code) ]
87
90
sender_aggregator : T :: AggregatorClient ,
91
+ /// EIP-712 domain separator for signature recovery
92
+ #[ allow( dead_code) ]
93
+ domain_separator : thegraph_core:: alloy:: sol_types:: Eip712Domain ,
88
94
}
89
95
90
96
/// Different types of operations that can fail and need retry logic
@@ -314,6 +320,7 @@ where
314
320
sender,
315
321
indexer_address,
316
322
sender_aggregator,
323
+ domain_separator : thegraph_core:: alloy:: sol_types:: Eip712Domain :: default ( ) , // TODO: Get real domain separator
317
324
} ;
318
325
319
326
lifecycle
@@ -842,9 +849,28 @@ where
842
849
// Extract receipt details based on version
843
850
match receipt {
844
851
TapReceipt :: V1 ( v1_receipt) => {
845
- // For V1, we'll store the signer from the notification or use a placeholder
846
- // In a real implementation, we'd recover the signer using domain separator
847
- let signer = Address :: ZERO ; // TODO: Get actual signer from notification
852
+ // Recover the actual signer address from the V1 receipt signature
853
+ let signer = match CheckingReceipt :: new ( TapReceipt :: V1 ( v1_receipt. clone ( ) ) )
854
+ . signed_receipt ( )
855
+ . recover_signer ( & state. domain_separator )
856
+ {
857
+ Ok ( recovered_signer) => {
858
+ tracing:: debug!(
859
+ signer = %recovered_signer,
860
+ allocation_id = %v1_receipt. message. allocation_id,
861
+ "Successfully recovered signer from V1 receipt signature"
862
+ ) ;
863
+ recovered_signer
864
+ }
865
+ Err ( e) => {
866
+ tracing:: warn!(
867
+ error = %e,
868
+ allocation_id = %v1_receipt. message. allocation_id,
869
+ "Failed to recover signer from V1 receipt signature, using zero address"
870
+ ) ;
871
+ Address :: ZERO
872
+ }
873
+ } ;
848
874
signer_addresses. push ( signer. encode_hex ( ) ) ;
849
875
signatures. push ( v1_receipt. signature . as_bytes ( ) . to_vec ( ) ) ;
850
876
allocation_ids. push ( v1_receipt. message . allocation_id . encode_hex ( ) ) ;
@@ -854,9 +880,28 @@ where
854
880
error_logs. push ( error_message. clone ( ) ) ;
855
881
}
856
882
TapReceipt :: V2 ( v2_receipt) => {
857
- // For V2, we'll store the signer from the notification or use a placeholder
858
- // In a real implementation, we'd recover the signer using domain separator
859
- let signer = Address :: ZERO ; // TODO: Get actual signer from notification
883
+ // Recover the actual signer address from the V2 receipt signature
884
+ let signer = match CheckingReceipt :: new ( TapReceipt :: V2 ( v2_receipt. clone ( ) ) )
885
+ . signed_receipt ( )
886
+ . recover_signer ( & state. domain_separator )
887
+ {
888
+ Ok ( recovered_signer) => {
889
+ tracing:: debug!(
890
+ signer = %recovered_signer,
891
+ collection_id = %v2_receipt. message. collection_id,
892
+ "Successfully recovered signer from V2 receipt signature"
893
+ ) ;
894
+ recovered_signer
895
+ }
896
+ Err ( e) => {
897
+ tracing:: warn!(
898
+ error = %e,
899
+ collection_id = %v2_receipt. message. collection_id,
900
+ "Failed to recover signer from V2 receipt signature, using zero address"
901
+ ) ;
902
+ Address :: ZERO
903
+ }
904
+ } ;
860
905
signer_addresses. push ( signer. encode_hex ( ) ) ;
861
906
signatures. push ( v2_receipt. signature . as_bytes ( ) . to_vec ( ) ) ;
862
907
// For V2, we need the collection_id from the message
0 commit comments