Ethers.js: IPC does not propagate errors at all

Created on 2 Jan 2020  路  4Comments  路  Source: ethers-io/ethers.js

for example a call like eth_sendRawTransaction might fail with {"jsonrpc":"2.0","id":42,"error":{"code":-32000,"message":"insufficient funds for gas * price + value"}}

instead, the call just returns a resolved Promise of undefined. this is because here:
https://github.com/ethers-io/ethers.js/blob/7250cdcd31c08c88e97cb8ee1f8e808ea030f88d/src.ts/providers/ipc-provider.ts#L57

the .error property is just completely ignored and instead .result is returned (which does not exist on error).

This is a pretty bad issue because for some calls (like sendTransaction) whether or not the call succeeded is very significant.

bug fixed

All 4 comments

I will look into this as soon as I can. For the v5 tests we have a Parity node deployed alongside the CI, so we鈥檒l finally have proper test cases for the IpcProvider.

You are absolutely correct.

I've reproduced this and am working on a fix to process errors the same way the JsonRpcProvider does.

I think this should be fixed now in 4.0.42. Please try it out and let me know if you have any problems.

Thanks! :)

Thank you!

Code looks good I think. I'll reopen this if i encounter issues when I try again (in a few days).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fmsouza picture fmsouza  路  44Comments

pkieltyka picture pkieltyka  路  36Comments

bpierre picture bpierre  路  43Comments

Tomix3D picture Tomix3D  路  39Comments

lastmjs picture lastmjs  路  31Comments