dshackle icon indicating copy to clipboard operation
dshackle copied to clipboard

`eth_getBlockByNumber` returns empty response on Ethereum mainnet

Open rgelinas-polygon opened this issue 1 year ago • 7 comments

Using the latest dshackle release 0.15 with the following minimal reproduction config:

version: v1
port: 2449

proxy:
  host: 0.0.0.0
  port: 8545
  routes:
    - id: ethereum
      blockchain: ethereum

cluster:
  upstreams:
    - id: quicknode-mainnet
      chain: ethereum
      disable-validation: true
      connection:
        ethereum:
          rpc:
            url: "<functioning_quicknode_endpoint>"
          ws:
            url: "<functioning_quicknode_endpoint>"

Despite upstreams providing responses for eth_getBlockByNumber (I verified by dumping upstream responses in WsConnectionImpl) dshackle returns an error to downstream clients. As an example reproduction using cast:

$ cast rpc eth_getBlockByNumber 0x160d0c4 true
Error: server returned an error response: error code -32002: No response or no available upstream for eth_getBlockByNumber

Sent against a known-good upstream directly, that produces the expected response.

rgelinas-polygon avatar Aug 20 '25 12:08 rgelinas-polygon

Does it say in the console anything about the upstream? it's likely "no available upstream" but it should say in the logs if it cannot connect, etc

splix avatar Aug 20 '25 13:08 splix

Does it say in the console anything about the upstream? it's likely "no available upstream" but it should say in the logs if it cannot connect, etc

No, the logs reflect the upstreams being available, and other head-verified methods work fine when sent at the exact same time (eth_getTransactionReceipt for example). I disabled validation in the reproduction config to ensure there wasn't anything else contributing to it.

As a sanity check, I just ran the 0.15 docker image with this config using the public DRPC Mainnet endpoints to see if it was coincidentally isolated to the two providers we use:

version: v1
port: 2449

proxy:
  host: 0.0.0.0
  port: 8545
  routes:
    - id: ethereum
      blockchain: ethereum

cluster:
  upstreams:
    - id: drpc-mainnet
      chain: ethereum
      disable-validation: true
      connection:
        ethereum:
          rpc:
            url: "https://eth.drpc.org"
          ws:
            url: "wss://eth.drpc.org"

But the same cast fails, again when sent to the DRPC endpoints directly is fine.

$ cast rpc eth_getBlockByNumber 0x160d0c4 true
Error: server returned an error response: error code -32002: No response or no available upstream for eth_getBlockByNumber

rgelinas-polygon avatar Aug 20 '25 13:08 rgelinas-polygon

@splix Any update on reproduction for this? We are able to reproduce with basically any provider, public or private, and it renders dshackle functionally useless for production use for us.

rgelinas-polygon avatar Aug 22 '25 11:08 rgelinas-polygon

Yes, I found the reason. It's a in a dependency which processes JSON, and I'm updating it right now. Apparently there was a suboptimal code and with the growth of the ethereum it became noticeable.

I'll finish the update today or tomorrow, but as a temp workaround I suggest to add more CPU for dshackle.

splix avatar Aug 22 '25 14:08 splix

Do you have a suggested target you've observed it working correctly at? We've bumped our instances to 2 full cores each and still get a timeout in that query

rgelinas-polygon avatar Aug 25 '25 00:08 rgelinas-polygon

I guess this would not be enough. Anyway, I have a fix locally, it works. I didn't make a release yet just to make sure nothing else is broken. Will make one in a day or two.

If it helps, you can send false and make separate requests per transaction.

splix avatar Aug 25 '25 00:08 splix

@rgelinas-polygon Please try v0.16

splix avatar Aug 28 '25 00:08 splix