diff --git a/eth/tracers/firehose.go b/eth/tracers/firehose.go index f53560965036..585667c6da20 100644 --- a/eth/tracers/firehose.go +++ b/eth/tracers/firehose.go @@ -534,7 +534,6 @@ func (f *Firehose) OnBlockEnd(err error) { } else { f.printBlockToFirehose(f.block, f.blockFinality) } - } else { // An error occurred, could have happen in transaction/call context, we must not check if in trx/call, only check in block f.ensureInBlock(0) @@ -899,6 +898,7 @@ func (f *Firehose) removeLogBlockIndexOnStateRevertedCalls() { func (f *Firehose) assignOrdinalAndIndexToReceiptLogs() { firehoseTrace("assigning ordinal and index to logs") + defer func() { firehoseTrace("assigning ordinal and index to logs terminated") }() @@ -2297,7 +2297,6 @@ func maxFeePerGas(tx *types.Transaction) *pbeth.BigInt { case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType: return firehoseBigIntFromNative(tx.GasFeeCap()) - } panic(errUnhandledTransactionType("maxFeePerGas", tx.Type())) @@ -2311,7 +2310,6 @@ func maxPriorityFeePerGas(tx *types.Transaction) *pbeth.BigInt { case types.DynamicFeeTxType, types.BlobTxType, types.SetCodeTxType: return firehoseBigIntFromNative(tx.GasTipCap()) } - panic(errUnhandledTransactionType("maxPriorityFeePerGas", tx.Type())) } diff --git a/eth/tracers/firehose_concurrency.go b/eth/tracers/firehose_concurrency.go index 6059df7bcdea..c6954368d16a 100644 --- a/eth/tracers/firehose_concurrency.go +++ b/eth/tracers/firehose_concurrency.go @@ -1,8 +1,9 @@ package tracers import ( - pbeth "github.com/streamingfast/firehose-ethereum/types/pb/sf/ethereum/type/v2" "sync" + + pbeth "github.com/streamingfast/firehose-ethereum/types/pb/sf/ethereum/type/v2" ) type blockPrintJob struct { diff --git a/eth/tracers/firehose_concurrency_test.go b/eth/tracers/firehose_concurrency_test.go index 7ccc808a19e8..ccfd921b45cf 100644 --- a/eth/tracers/firehose_concurrency_test.go +++ b/eth/tracers/firehose_concurrency_test.go @@ -3,17 +3,17 @@ package tracers import ( "encoding/hex" "fmt" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/params" - "github.com/stretchr/testify/require" "regexp" "strconv" "strings" "testing" + + "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" + "github.com/stretchr/testify/require" ) func TestFirehose_BlockPrintsToFirehose_SingleBlock(t *testing.T) { - f := NewFirehose(&FirehoseConfig{ ConcurrentBlockFlushing: 1, ApplyBackwardCompatibility: ptr(false), @@ -56,7 +56,6 @@ func TestFirehose_BlockPrintsToFirehose_SingleBlock(t *testing.T) { } func TestFirehose_BlocksPrintToFirehose_MultipleBlocksInOrder(t *testing.T) { - const blockCount = 100 const baseBlockNum = 0 diff --git a/eth/tracers/firehose_test.go b/eth/tracers/firehose_test.go index eeff3d333e33..8add39bc2829 100644 --- a/eth/tracers/firehose_test.go +++ b/eth/tracers/firehose_test.go @@ -37,7 +37,8 @@ func TestFirehoseCallStack_Push(t *testing.T) { actions []actionRunner }{ { - "push/pop emtpy", []actionRunner{ + "push/pop emtpy", + []actionRunner{ push(&pbeth.Call{}), pop(), check(func(t *testing.T, s *CallStack) { @@ -46,7 +47,8 @@ func TestFirehoseCallStack_Push(t *testing.T) { }, }, { - "push/push/push", []actionRunner{ + "push/push/push", + []actionRunner{ push(&pbeth.Call{}), push(&pbeth.Call{}), push(&pbeth.Call{}), @@ -193,7 +195,6 @@ func Test_FirehoseAndGethHeaderFieldMatches(t *testing.T) { var endsWithUnknownConstant = regexp.MustCompile(`.*\(\d+\)$`) func TestFirehose_BalanceChangeAllMappedCorrectly(t *testing.T) { - for i := 0; i <= math.MaxUint8; i++ { tracingReason := tracing.BalanceChangeReason(i) if tracingReason == tracing.BalanceChangeUnspecified || tracingReason == tracing.BalanceChangeRevert { @@ -405,7 +406,7 @@ func TestFirehose_reorderIsolatedTransactionsAndOrdinals(t *testing.T) { goldenPath := tt.expectedBlockFile if !goldenUpdate && !fileExits(t, goldenPath) { - t.Fatalf("the golden file %q does not exist, re-run with 'GOLDEN_UPDATE=true go test ./... -run %q' to generate the intial version", goldenPath, t.Name()) + t.Fatalf("the golden file %q does not exist, re-run with 'GOLDEN_UPDATE=true go test ./... -run %q' to generate the initial version", goldenPath, t.Name()) } content, err := protojson.MarshalOptions{Indent: " "}.Marshal(f.block) diff --git a/eth/tracers/internal/tracetest/firehose/helpers_test.go b/eth/tracers/internal/tracetest/firehose/helpers_test.go index 0dde5e7058da..f7d1dee22a59 100644 --- a/eth/tracers/internal/tracetest/firehose/helpers_test.go +++ b/eth/tracers/internal/tracetest/firehose/helpers_test.go @@ -67,7 +67,7 @@ func (lines firehoseBlockLines) assertOnlyBlockEquals(t *testing.T, goldenDir st for _, line := range lines { goldenPath := filepath.Join(goldenDir, fmt.Sprintf("block.%d.golden.json", line.Block.Header.Number)) if !goldenUpdate && !fileExists(t, goldenPath) { - t.Fatalf("the golden file %q does not exist, re-run with 'GOLDEN_UPDATE=true go test ./... -run %q' to generate the intial version", goldenPath, t.Name()) + t.Fatalf("the golden file %q does not exist, re-run with 'GOLDEN_UPDATE=true go test ./... -run %q' to generate the initial version", goldenPath, t.Name()) } unnormalizedContent, err := protojson.MarshalOptions{Indent: " "}.Marshal(line.Block)