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

cast call jsonrpc request with params.length=3 rejected by Nethermind #7943

Closed
2 tasks done
pyggie opened this issue May 17, 2024 · 1 comment
Closed
2 tasks done
Labels
T-bug Type: bug

Comments

@pyggie
Copy link

pyggie commented May 17, 2024

Component

Cast

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (467aff3 2024-05-17T00:18:15.145320552Z)

What command(s) is the bug in?

cast call

Operating System

Linux

Describe the bug

cast call generates a JSON-RPC request with params array of 3 elements (the 3rd is an empty state-override set). Nethermind expects only 2 elements and rejects the request.

For example:

WETH=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
AAVE_WETH=0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8
cast call $WETH "balanceOf(address)(uint256)" $AAVE_WETH

Some Ethereum node implementations (such as Alchemy) handle this request correctly.
Nethermind logs an error:

Error when handling Id:1, eth_call([{"from":"0x0000000000000000000000000000000000000000","to":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","value":"0x0","input":"0x70a082310000000000000000000000004d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8"},"latest",{}]) | {
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": "Incorrect parameters count, expected: 2, actual: 3"
  },
  "id": 1
}

The request params includes a 3rd parameter {} that some Ethereum clients accept as a "state override set".

One possibility is to omit the 3rd parameter when the state override set is empty, to retain compatibility with the reference Ethereum JSON-RPC Spec in the common case of no overrides.

Observed with:

  • cast 0.2.0 (467aff3 2024-05-17T00:18:15.145580559Z)
  • Nethermind 1.26.0
@DaniPopes
Copy link
Member

Fixed in the next nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

2 participants