@@ -4,8 +4,10 @@ use super::*;
44use frame_support:: ensure;
55use snowbridge_beacon_primitives:: ExecutionProof ;
66
7- use snowbridge_beacon_primitives:: merkle_proof:: { generalized_index_length, subtree_index} ;
8- use snowbridge_ethereum:: Receipt ;
7+ use snowbridge_beacon_primitives:: {
8+ merkle_proof:: { generalized_index_length, subtree_index} ,
9+ receipt:: verify_receipt_proof,
10+ } ;
911use snowbridge_verification_primitives:: {
1012 VerificationError :: { self , * } ,
1113 Verifier , * ,
@@ -21,28 +23,12 @@ impl<T: Config> Verifier for Pallet<T> {
2123 Self :: verify_execution_proof ( & proof. execution_proof )
2224 . map_err ( |e| InvalidExecutionProof ( e. into ( ) ) ) ?;
2325
24- let receipt = Self :: verify_receipt_inclusion (
26+ Self :: verify_receipt_inclusion (
2527 proof. execution_proof . execution_header . receipts_root ( ) ,
2628 & proof. receipt_proof . 1 ,
29+ event_log,
2730 ) ?;
2831
29- event_log. validate ( ) . map_err ( |_| InvalidLog ) ?;
30-
31- // Convert snowbridge_core::inbound::Log to snowbridge_ethereum::Log.
32- let event_log = snowbridge_ethereum:: Log {
33- address : event_log. address ,
34- topics : event_log. topics . clone ( ) ,
35- data : event_log. data . clone ( ) ,
36- } ;
37-
38- if !receipt. contains_log ( & event_log) {
39- log:: error!(
40- target: "ethereum-client" ,
41- "💫 Event log not found in receipt for transaction" ,
42- ) ;
43- return Err ( LogNotFound )
44- }
45-
4632 Ok ( ( ) )
4733 }
4834}
@@ -53,20 +39,21 @@ impl<T: Config> Pallet<T> {
5339 pub fn verify_receipt_inclusion (
5440 receipts_root : H256 ,
5541 receipt_proof : & [ Vec < u8 > ] ,
56- ) -> Result < Receipt , VerificationError > {
57- let result = verify_receipt_proof ( receipts_root , receipt_proof ) . ok_or ( InvalidProof ) ? ;
58-
59- match result {
60- Ok ( receipt ) => Ok ( receipt ) ,
61- Err ( err ) => {
62- log:: trace! (
63- target : "ethereum-client" ,
64- "💫 Failed to decode transaction receipt: {}" ,
65- err
66- ) ;
67- Err ( InvalidProof )
68- } ,
42+ log : & Log ,
43+ ) -> Result < ( ) , VerificationError > {
44+ let receipt = verify_receipt_proof ( receipts_root , receipt_proof ) . ok_or ( InvalidProof ) ? ;
45+ if !receipt . logs ( ) . iter ( ) . any ( |l| {
46+ l . data . data . 0 == log . data &&
47+ l . address . 0 == log . address . 0 &&
48+ l . topics ( ) . len ( ) == log. topics . len ( )
49+ } ) {
50+ log :: error! (
51+ target : "ethereum-client" ,
52+ "💫 Event log not found in receipt for transaction" ,
53+ ) ;
54+ return Err ( LogNotFound )
6955 }
56+ Ok ( ( ) )
7057 }
7158
7259 /// Validates an execution header with ancestry_proof against a finalized checkpoint on
0 commit comments