Parity-ethereum: JSON RPC Not to Standard

Created on 5 Oct 2017  ·  1Comment  ·  Source: openethereum/parity-ethereum

System information

Parity version: 1.7.2-beta
OS & Version: Linux 64bit

Description

Parity appears to violate the JSON RPC Standard defined here:
https://github.com/ethereum/wiki/wiki/JSON-RPC

When encoding QUANTITIES (integers, numbers): encode as hex, prefix with "0x", the most compact representation (slight exception: zero should be represented as "0x0").

Actual behaviour

Input:
{
    "method":  "eth_getBlockTransactionCountByNumber",
    "params":  [
                   "4000000"
               ],
    "id":  0,
    "jsonrpc":  "2.0"
}

Output:
0x45

Expected behaviour (Parity)

Input:
{
    "method":  "eth_getBlockTransactionCountByNumber",
    "params":  [
                   "4000000"
               ],
    "id":  0,
    "jsonrpc":  "2.0"
}

Output:
WARNING: @{code=-32602; message=invalid argument 0: hex string without 0x prefix}

It seems that Parity is accepting raw integers (as string) where 4000000 is automatically being translated to "0x3d0900"

This could cause incompatibility between Geth and Parity nodes for developers if they don't test code on both clients thinking that other clients (such as Geth) would accept "4000000" when it does not.

F2-bug 🐞 M4-core ⛓ M6-rpcapi 📣 P5-sometimesoon 🌲

Most helpful comment

@tomusdrw seems like it's time to remove the leniency we put in place last year when Geth was the one accepting misformatted parameters, not Parity.

>All comments

@tomusdrw seems like it's time to remove the leniency we put in place last year when Geth was the one accepting misformatted parameters, not Parity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uluhonolulu picture uluhonolulu  ·  3Comments

barakman picture barakman  ·  3Comments

gaoxiangxyz picture gaoxiangxyz  ·  3Comments

stone212 picture stone212  ·  3Comments

jacogr picture jacogr  ·  4Comments