Skip to content
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

Anvil IPC response does not contain a newline, breaks web3py v7 AsyncIPCProvider #9203

Open
1 of 2 tasks
BowTiedDevil opened this issue Oct 26, 2024 · 0 comments
Open
1 of 2 tasks
Assignees
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate

Comments

@BowTiedDevil
Copy link

Component

Anvil

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (192a5a2 2024-10-26T00:22:40.192959901Z)

What command(s) is the bug in?

anvil

Operating System

Linux

Describe the bug

Web3py v7 added an async IPC provider. I have been testing it and discovered that it hangs when communicating with Anvil's IPC implementation. It works as expected with Reth's IPC implementation.

Comparing the responses from the IPC, I can see that Anvil omits the newline at the end of the response. Reth includes the newline.

Here are two responses captured from my node and an Anvil fork:

bytearray(b'{"jsonrpc":"2.0","id":0,"result":"reth/v1.1.0-1ba631ba/x86_64-unknown-linux-gnu"}\n')
bytearray(b'{"jsonrpc":"2.0","id":0,"result":"anvil/v0.2.0"}')

The hang occurs because the async IPC provider defers reading from the socket to asyncio's StreamReader.readline() method, which expects a \n separator. Not finding it, it continues to read from the socket until the timeout is reached.

I don't know if a newline is a convention or a requirement — it's unclear if web3py's newline expectation is wrong, or whether the omission is something Anvil should correct.

@BowTiedDevil BowTiedDevil added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Oct 26, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 26, 2024
@yash-atreya yash-atreya added C-anvil Command: anvil T-to-investigate Type: to investigate and removed T-needs-triage Type: this issue needs to be labelled labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-bug Type: bug T-to-investigate Type: to investigate
Projects
Status: Todo
Development

No branches or pull requests

3 participants