-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: complete failed transaction receipts with block data #1952
fix: complete failed transaction receipts with block data #1952
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1952 +/- ##
==========================================
+ Coverage 61.49% 61.69% +0.20%
==========================================
Files 263 263
Lines 23394 23425 +31
==========================================
+ Hits 14387 14453 +66
+ Misses 8006 7967 -39
- Partials 1001 1005 +4
|
2342a98
to
3ee367a
Compare
3ee367a
to
92a44bd
Compare
evmrpc/tx.go
Outdated
@@ -53,6 +53,44 @@ func (t *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common. | |||
} | |||
return nil, err | |||
} | |||
// Fill in the receipt if the transaction has failed and used 0 gas | |||
if receipt.TxType == 0 && receipt.GasUsed == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check status instead of txType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
receipt.TxType = uint32(etx.Type()) | ||
receipt.Status = uint32(ethtypes.ReceiptStatusFailed) | ||
receipt.GasUsed = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you can also fill other fields like input, value, etc. from etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks receipt doesn't have these fields: https://github.com/sei-protocol/sei-chain/blob/main/x/evm/types/receipt.pb.go#L102
i checked some successfully tx receipts, they have logs but it doesn't have input/value either.
evmrpc/tx.go
Outdated
// Fill in the receipt if the transaction has failed and used 0 gas | ||
if receipt.Status == 0 && receipt.GasUsed == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here saying that this case is for when a tx fails before it makes it to the VM?
* feat: fill failed tx receipt missing fields with block data * improve logic * set gasUsed=0 * debug: gasUsed * remove log * fix status check * unit test * update comment
Describe your changes and provide context
This PR enhances the handling of failed transaction receipts by filling in missing fields using data from the block. When a transaction fails with zero gas usage, the receipt might be missing important information. This PR ensures all receipt fields are properly populated by looking up the transaction in the block.
In
GetTransactionReceipt
, when a receipt hasTxType == 0
andGasUsed == 0
, we:Testing performed to validate your change