This repository was archived by the owner on Mar 5, 2025. It is now read-only.
handleRevert implementation broken when no value is specified for gasPrice on eth_sendRawTransaction #4902
Closed
1 task done
Labels
Is there an existing issue for this?
Current Behavior
checkConfirmation
inweb3-core-method/src/index.js
on line458
(here) throws an internal error because it blindly accessesparsedTx.gasPrice
to call its.toHexString()
, but this property is undefined for all EIP-1559 transactions. This is then captured by an internal try/catch, swallowed and turned intoTransactionRevertedWithoutReasonError
and the app receives noreason
.Expected Behavior
I expect the logic to be aware of the fact that
gasPrice
will beundefined
for EIP-1559 transactions and not call.toHextString()
on it in that case so that it doesn't cause an internal error that stops fetching thereason
for the failure from the RPC node witheth_call
.Steps to Reproduce
web3.eth.handleRevert = true
eth_sendRawTransaction
reason
when it shouldWeb3.js Version
1.7.1
Environment
Shouldn't matter, but I'm on Node.js Version 16.14.0.
Anything Else?
Simply adding the null propagation operator like so is all that is needed to fix:
I have tested this by manually editing the version in
lib
locally and everything works as expected then. If trying to be backwards compatible and not use null propagation operator the following fixes as well:The text was updated successfully, but these errors were encountered: