emeraldpay / dshackle

Fault Tolerant Load Balancer for Ethereum and Bitcoin APIs
Apache License 2.0
308 stars 55 forks source link

dshackle filtering rpc api calls when it shouldn't #262

Closed barnabasbusa closed 11 months ago

barnabasbusa commented 1 year ago

When querying for eth_chainId for the dshackle endpoint:

curl --data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST  https://rpc.holesky.ethpandaops.io 

I get the response:

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Unsupported method: eth_chainId"}}

But querying the rpc endpoint directly works

curl --data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST  https://rpc.teku-geth-001.srv.holesky.ethpandaops.io

response:

{"jsonrpc":"2.0","id":1,"result":"0x4268"}

Any reason certain API calls are filtered by dhackle? Would it be possible to add support to all EL API endpoints?

Reference: https://ethereum.github.io/execution-apis/api-documentation/

splix commented 12 months ago

Dshackle has a special handler for eth_chainId. It doesn't route the request because it always knows the response for standard blockchains and responds immediately. But it seems it doesn't do that in your case. Do you have anything in your dshackle config that may affect it? Like disabling this specific method or using a non-standard blockchain?

skylenet commented 12 months ago

For this specific case you can override specific methods with static responses. The chainId shouldn't change for your devnet, so it's probably fine to use that as a workaround. e.g. see: https://github.com/ethpandaops/ethereum-k8s-testnets/blob/master/public-merge-kintsugi/helmsman/values/ethereum/dshackle.yaml#L88

Relevant PR that implemented that: https://github.com/emeraldpay/dshackle/pull/125

Docs: https://github.com/emeraldpay/dshackle/blob/master/docs/04-upstream-config.adoc#static-methods