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

eth: RPC API does not enforce 0x prefix #2438

Closed
gavofyork opened this issue Apr 9, 2016 · 5 comments
Closed

eth: RPC API does not enforce 0x prefix #2438

gavofyork opened this issue Apr 9, 2016 · 5 comments
Assignees
Milestone

Comments

@gavofyork
Copy link
Contributor

System information

Geth version: All versions
OS & Version: Windows/Linux/OSX
Commit hash : All commits

Expected behaviour

Should return:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": null
  },
  "id": 274
}

Actual behaviour

Accepts and queues a transaction with the data interpreted as hex.

Steps to reproduce the behaviour

Make JSONRPC request using:

{"id":253,"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["f8898085061467a0cc832fd61894b816c3abdbb9967485f8645bc83143bb749572e080a4922a2c9d00000000000000000000000000000000000000000000000000000000000f69b51ca0239bfaea0e564e825136ef60e1964e44a2cf4b870a243acd447c9a56126b7ebea043e74bae18396f906741418febe29e7ac611bfcca80846b311b1f986cd6ff747"]}
@obscuren
Copy link
Contributor

Thanks. The function that decodes hex does not explicitly check for 0x, it assumes the input is hex without the prefix.

@bas-vk wasn't this addressed in the new RPC?

@fjl fjl changed the title Geth accepts and processes invalidly formatted JSONRPC requests. eth: RPC API does not enforce 0x prefix Apr 11, 2016
@bas-vk
Copy link
Member

bas-vk commented Apr 12, 2016

The new RPC layer uses the same hex decode function as the old RPC layer and thus has the same semantics. This probably has been since the inception of the RPC layer. I will create a PR that addresses this. It also falsely accepts input of uneven length.

@ethers
Copy link
Member

ethers commented Nov 23, 2016

Hi, when can this be fixed please? It's causing the community cycles like:
trufflesuite/truffle#179
https://github.com/ethcore/parity/issues/1317

@fjl fjl added this to the 1.5.4 milestone Nov 23, 2016
@fjl fjl self-assigned this Nov 23, 2016
@obscuren obscuren modified the milestones: 1.5.4, 1.5.5 Nov 27, 2016
@karalabe
Copy link
Member

Fixed in yesterday's (1.5.4) release.

@fjl
Copy link
Contributor

fjl commented Nov 29, 2016

This is not fixed yet.

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

No branches or pull requests

6 participants