Batched calls for getting token symbol don't seem to be working after switching to new endpoint

I’m making batched calls to infura and my own parity nodes. They all worked for a long while, then recently I noticed batched calls to get token symbol for multiple tokens quit working only to infura. The call to get a token symbol will work unbatched. It used to work batched to infura. It still works exactly as is when I make the call directly to my own parity node. It suddenly stopped working recently and the only change I can see is that I’m now pointing to the new infura endpoint with the project ID instead of the old key style.

Here’s payload I send that works to my parity node but not Infura.

[
  {
    'id': 123,
    'jsonrpc': '2.0',
    'method': 'eth_call',
    'params': [
      {
        'data': '0x95d89b410000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef',
        'to': '0x0d8775f648430679a709e98d2b0cb6250d2887ef'
      }
    ]
  }
]

Here’s the response I get when I batch.

[
  {
    'jsonrpc': '2.0',
    'id': 123,
    'error': {
      'code': -32602,
      'message': 'missing value for required argument 1'
    }
  }
]

Same call to my parity node gives me this response:

[
  {
    'jsonrpc': '2.0',
    'result': '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034241540000000000000000000000000000000000000000000000000000000000',
    'id': 123
  }
]

Also note that I tested batching eth_getBlockByHash calls to infura and it’s working just fine. I’m not sure why.

Can you provide the snippet of the code where you are making this request? You could be using the recently deprecated legacy API auth and that is why you’re seeing issues.

It’s python code to simply send a REST call to an Ethereum node, I just plug in which URL I’m sending the data to. Does the URL for infura look correct to you? You can just copy this data payload and make a curl call and you’ll get the same result.

NOTE: It won’t let me post links since i’m a new user so i’ve replaced https://mainnet.infura.io/v3/MyProjectID with INFURASURL

I ran some code to simultaneously send the same request to 3 nodes, 2 of them are my parity nodes and 1 of them is infura.

(Thread-7) SubmitRequest: to INFURASURL with payload [{‘id’: 70274741081124, ‘jsonrpc’: ‘2.0’, ‘method’: ‘eth_call’, ‘params’: [{‘data’: ‘0x95d89b410000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef’, ‘to’: ‘0x0d8775f648430679a709e98d2b0cb6250d2887ef’}]}]

(Thread-8) SubmitRequest: to http://MyParityNode_1 with payload [{‘id’: 70274741081124, ‘jsonrpc’: ‘2.0’, ‘method’: ‘eth_call’, ‘params’: [{‘data’: ‘0x95d89b410000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef’, ‘to’: ‘0x0d8775f648430679a709e98d2b0cb6250d2887ef’}]}]

(Thread-9) SubmitRequest: to http://MyParityNode_2 with payload [{‘id’: 70274741081124, ‘jsonrpc’: ‘2.0’, ‘method’: ‘eth_call’, ‘params’: [{‘data’: ‘0x95d89b410000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef’, ‘to’: ‘0x0d8775f648430679a709e98d2b0cb6250d2887ef’}]}]

(Thread-8) SubmitRequest: response.content = b’[{“jsonrpc”:“2.0”,“result”:“0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034241540000000000000000000000000000000000000000000000000000000000”,“id”:70274741081124}]\n’, this was for url = http://MyParityNode_1

(MainThread) resultDict = {‘0x0d8775f648430679a709e98d2b0cb6250d2887ef’: ‘BAT’}
(Thread-7) SubmitRequest: response.content = b’[{“jsonrpc”:“2.0”,“id”:70274741081124,“error”:{“code”:-32602,“message”:“missing value for required argument 1”}}]', this was for url = INFURASURL

(Thread-9) SubmitRequest: response.content = b’[{“jsonrpc”:“2.0”,“result”:“0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034241540000000000000000000000000000000000000000000000000000000000”,“id”:70274741081124}]\n’, this was for url = http://MyParityNode_2

I’m not using the secret as a part of the request. Maybe that has something to do with it? But I left this box unchecked.

External Image

Hi lampshade9909,

It looks like you’re missing the 2nd argument to eth_call, the block number you want to use. I’m actually surprised parity let’s you omit that!

Your request should be something like:

[
  {
    'id': 123,
    'jsonrpc': '2.0',
    'method': 'eth_call',
    'params': [
      {
        'data': '0x95d89b410000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef',
        'to': '0x0d8775f648430679a709e98d2b0cb6250d2887ef'
      },
      "latest"
    ]
  }
]

See the docs for eth_call for more details: https://infura.io/docs/ethereum/json-rpc/eth_call

1 Like

@Ryan_Schneider
That may very well be the problem, but I just tested it again and now it’s working without adding ‘latest’. Did someone add that ability as a result of this post? Or is this some weird fluke?

I can confirm we still require the block argument (referred to as “argument 1” in the error since the first one is argument 0). Are you sure you didn’t accidentally point at your parity node when testing?

Yep, that was it. And yeah it looks like ‘eth_getBlockByHash’ does not require a BLOCK PARAMETER. I bet my batched eth_call to get the token symbol was never working to infura ever even in the past and I just now noticed it. My redundancy with my parity nodes must have been masking that problem.