ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

IPC Socket Client does not send \n delimiter

Open fipso opened this issue 1 year ago • 3 comments

Ethers Version

6

Search Terms

ipc,socket,json

Describe the Problem

So as of now, all the major ETH node implementations support \n delimiter after every JSON message on their IPC socket. The problem is. Some even require it. Geth and Nethermind at least won't ever reply to a request if it is not terminated with \n. For Geth the reason is they use the default JSON decoder from golang which is built for streams and needs a delimiter. Nethermind just hardcoded \n as their delimiter for IPC request handling.

Please fix this. Thanks a lot. Ethers.js is amazing

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer), Geth, Other (please specify)

Environment (Other)

Nethermind

fipso avatar Sep 27 '24 12:09 fipso

Thanks. Testing it out right now...

ricmoo avatar Oct 16 '24 00:10 ricmoo

My version of Geth seems to work fine without the \n, but after adding it, Geth still works just peachy.

ricmoo avatar Oct 16 '24 00:10 ricmoo

Yes I was wrong about the geth implementation. The default json decoder from go does not need /n at all. If it sees a whitespace or /n it just skips it when parsing

fipso avatar Oct 16 '24 09:10 fipso

Would be cool if we get this merged. Can't use nethermind ipc sockets with ethers

fipso avatar Oct 27 '24 09:10 fipso

Not sure why this commit didn't get linked to from this issue, so posting this comment.

ricmoo avatar Dec 03 '24 20:12 ricmoo

Thank you so much

fipso avatar Jan 08 '25 13:01 fipso

Of course! Sorry for the delay.

For those finding this issue in the future, in was merged in v6.13.5.

Thanks! :)

ricmoo avatar Jan 14 '25 20:01 ricmoo