eth_getCode returns error #57

Closed
opened 2021-04-18 20:53:26 +00:00 by ramilexe · 8 comments
ramilexe commented 2021-04-18 20:53:26 +00:00 (Migrated from github.com)

eth_getCode returns error when block number set to nil:

ipldClient.CodeAt(ctx, common.HexToAddress(contractAddress), nil)

Return message:

{
      Code: -32000,
      Message: "sql: converting argument $1 type: uint64 values with high bit set are not supported",
      Data: nil,
}
eth_getCode returns error when block number set to `nil`: `ipldClient.CodeAt(ctx, common.HexToAddress(contractAddress), nil)` Return message: ``` { Code: -32000, Message: "sql: converting argument $1 type: uint64 values with high bit set are not supported", Data: nil, } ```
Member

What happens if you send nil to geth?

What happens if you send `nil` to geth?
Member

You'll get an error of the form: errors.New("invalid arguments; neither block nor hash specified"), so it should be returning an error.

You'll get an error of the form: `errors.New("invalid arguments; neither block nor hash specified")`, so it should be returning an error.
Member

Also the arg is rpc.BlockNumberOrHash

Also the arg is `rpc.BlockNumberOrHash`
ramilexe commented 2021-04-19 13:42:08 +00:00 (Migrated from github.com)

What happens if you send nil to geth?

It returns code without any errors

> What happens if you send `nil` to geth? It returns code without any errors
Member

That doesn't seem right.

https://github.com/vulcanize/go-ethereum/blob/master/internal/ethapi/api.go#L729 => f26c19cbcd/eth/api_backend.go (L171)

If blockNrOrHash is nil both those ok checks will fail and fall through to the err

That doesn't seem right. https://github.com/vulcanize/go-ethereum/blob/master/internal/ethapi/api.go#L729 => https://github.com/vulcanize/go-ethereum/blob/f26c19cbcd60175598824c7e09b64b8896daf721/eth/api_backend.go#L171 If `blockNrOrHash` is `nil` both those `ok` checks will fail and fall through to the err
ramilexe commented 2021-04-19 14:15:20 +00:00 (Migrated from github.com)
>That doesn't seem right. It is right. https://github.com/vulcanize/ipld-eth-server/pull/53/files#diff-8118e44ac15fb5ab2e2ece2ab52fd23062a10b5cc9c55ee5b3620a1242cff27cR186-R194 ![image](https://user-images.githubusercontent.com/1008882/115250787-937fe000-a132-11eb-9108-cd42f3b8a543.png)
Member

Thanks! I think the RPC server must be converting the nil arg to rpc.LatestBlockNumber (-1) behind the scenes, which is causing the issue.

Thanks! I think the RPC server must be converting the `nil` arg to `rpc.LatestBlockNumber` (-1) behind the scenes, which is causing the issue.
ramilexe commented 2021-04-21 11:17:52 +00:00 (Migrated from github.com)

Fixed in commit 9b960a105f

Fixed in commit https://github.com/vulcanize/ipld-eth-server/pull/53/commits/9b960a105fe7fe38cfe584bba2b5b324de22f3d3
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/ipld-eth-server#57
No description provided.