You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
checkConfirmation in web3-core-method/src/index.js on line 458 (here) throws an internal error because it blindly accesses parsedTx.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 into TransactionRevertedWithoutReasonError and the app receives no reason.
Expected Behavior
I expect the logic to be aware of the fact that gasPrice will be undefined 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 the reason for the failure from the RPC node with eth_call.
Steps to Reproduce
Set web3.eth.handleRevert = true
Send a transaction that should return a revert reason through the eth_sendRawTransaction
Catch the error
Notice it has no reason when it should
Web3.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:
gasPrice: parsedTx.gasPrice?.toHexString(),
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:
drub0y
changed the title
handleRevert implementation broken when no value is specified for gasPrice on transaction
handleRevert implementation broken when no value is specified for gasPrice on eth_sendRawTransaction
Mar 29, 2022
drub0y
added a commit
to drub0y/web3.js
that referenced
this issue
Mar 29, 2022
@drub0y Thanks for reaching back to us. We will investigate this issue and try to get it fixed as soon we have some bandwidth. Currently all our resources are focused towards 4.x rewrite.
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: