Skip to content

Commit

Permalink
- align status of transaction of the firehose block with the status o…
Browse files Browse the repository at this point in the history
…f the transaction of the RPC
  • Loading branch information
Eduard-Voiculescu committed May 28, 2024
1 parent e45ed70 commit 190bf5a
Show file tree
Hide file tree
Showing 5 changed files with 988 additions and 5 deletions.
14 changes: 10 additions & 4 deletions eth/tracers/firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,18 @@ func (f *Firehose) completeTransaction(receipt *types.Receipt) *pbeth.Transactio
f.transaction.GasUsed = receipt.GasUsed
f.transaction.Receipt = newTxReceiptFromChain(receipt, f.transaction.Type)
f.transaction.Status = transactionStatusFromChainTxReceipt(receipt.Status)
} else {
// When there are no receipt, it proves that we have an error, so we must set the status to FAILED
f.transaction.Status = pbeth.TransactionTraceStatus_FAILED
}

// It's possible that the transaction was reverted, but we still have a receipt, in that case, we must
// check the root call
if rootCall.StatusReverted {
f.transaction.Status = pbeth.TransactionTraceStatus_REVERTED
// Today, we follow what the RPC returns, so we do not set REVERTED, and set it to FAILED
if *f.applyBackwardCompatibility {
// It's possible that the transaction was reverted, but we still have a receipt, in that case, we must
// check the root call
if rootCall.StatusReverted {
f.transaction.Status = pbeth.TransactionTraceStatus_REVERTED
}
}

// Order is important, we must populate the state reverted before we remove the log block index and re-assign ordinals
Expand Down
1 change: 1 addition & 0 deletions eth/tracers/internal/tracetest/firehose/firehose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func TestFirehosePrestate(t *testing.T) {
"./testdata/TestFirehosePrestate/deposit_nonce_check_optimism_after_canyon",
"./testdata/TestFirehosePrestate/deposit_nonce_check_base_before_canyon",
"./testdata/TestFirehosePrestate/deposit_nonce_check_base_after_canyon",
"./testdata/TestFirehosePrestate/deposit_nonce_check_base_state_failed",
}

for _, folder := range testFolders {
Expand Down
Loading

0 comments on commit 190bf5a

Please sign in to comment.