Skip to content

Commit 3158381

Browse files
committed
TEST: Polygon Fee Transfer Log
1 parent e4757ff commit 3158381

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

eth/tracers/firehose_concurrency_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package tracers
33
import (
44
"encoding/hex"
55
"fmt"
6+
"github.com/ethereum/go-ethereum/common"
7+
"github.com/ethereum/go-ethereum/core/types"
68
"github.com/ethereum/go-ethereum/core/vm"
79
"github.com/ethereum/go-ethereum/params"
810
"github.com/stretchr/testify/require"
@@ -144,3 +146,37 @@ func extractBlocksFromOutput(t *testing.T, output string) []extractedBlock {
144146

145147
return blocks
146148
}
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

Comments
 (0)