@@ -3,6 +3,8 @@ package tracers
3
3
import (
4
4
"encoding/hex"
5
5
"fmt"
6
+ "github.com/ethereum/go-ethereum/common"
7
+ "github.com/ethereum/go-ethereum/core/types"
6
8
"github.com/ethereum/go-ethereum/core/vm"
7
9
"github.com/ethereum/go-ethereum/params"
8
10
"github.com/stretchr/testify/require"
@@ -144,3 +146,37 @@ func extractBlocksFromOutput(t *testing.T, output string) []extractedBlock {
144
146
145
147
return blocks
146
148
}
149
+
150
+ // Polygon specific test
151
+ func TestFirehose_PolygonFeeTransferLog (t * testing.T ) {
152
+ // Create a Polygon fee transfer log
153
+ polygonFeeLog := & types.Log {
154
+ Address : common .HexToAddress ("0x0000000000000000000000000000000000001010" ),
155
+ Topics : []common.Hash {
156
+ common .HexToHash ("0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63" ),
157
+ common.Hash {},
158
+ common.Hash {},
159
+ common.Hash {},
160
+ },
161
+ Data : []byte {},
162
+ BlockNumber : 0 ,
163
+ Index : 1 ,
164
+ }
165
+
166
+ receipt := & types.Receipt {
167
+ Status : 1 , // Success
168
+ Logs : []* types.Log {polygonFeeLog },
169
+ }
170
+
171
+ f := NewFirehose (& FirehoseConfig {})
172
+ f .OnBlockchainInit (params .AllEthashProtocolChanges )
173
+ f .OnBlockStart (blockEvent (0 ))
174
+ f .onTxStart (txEvent (), hex2Hash (fmt .Sprintf ("ABCD%d" , 0 )), from , to )
175
+ f .OnCallEnter (0 , byte (vm .CALL ), from , to , nil , 0 , nil )
176
+ f .OnLog (polygonFeeLog )
177
+ f .OnCallExit (0 , nil , 0 , fmt .Errorf ("call reverted" ), true )
178
+ f .OnTxEnd (receipt , nil )
179
+ f .OnBlockEnd (nil )
180
+
181
+ // No assertion required as we simply need to verify the test does not panic
182
+ }
0 commit comments