Incorrect eth_call response for view function

The following eth_call to mainnet:

{
	"jsonrpc":"2.0",
	"method":"eth_call",
	"params":[{
		"to": "0x2184fae5a2e3355df155ad3cdb2089f9f6e0868b",
		"data": "0x41976e09000000000000000000000000f6ce9BFA82D1088d3257a76ec2e0ce1C8060BF8c"
	}, "0xB8C333"],
	"id":1
}

Will return 0x0000000000000000000000000000000000000000000000000000000000000000 on Infura, however the correct response is 0x000000000000000000000000000000000000000000000000000000000011a2dc. This can be reproduced with other block numbers, including "latest", the correct response will change but Infura will always respond with 0x00...00.

Note that this bug makes Infura unsuitable to be used by indexers in The Graph.

Thanks for the report. I was able to reproduce this issue and will look more closely into it with our engineering team. Will have an update for you asap.

Hey @leoyvens thanks for reporting the issue. I dug into it and determined what’s going on. To protect out service from being abused we limit the gas an eth_call can use to 10x the latest block gas cap, so roughly 120 million gas. Note that this is substantially higher than the default geth gas cap, which is 25 million.

With standard geth’s default gas cap, the execution reverts. However, it seems like this view function, if supplied a large but non-infinite amount of gas, ends up returning 0x0...0 instead of the correct value or reverting. So, on a local uncapped node, I tried “binary searching” different gas values to see how the function behaved:

  • Any gas limit below roughly 0x5360000 -> execution is reverted
  • Any gas limit between approximately 0x5364000 and 0x18000000 -> returns 0x0000000000000000000000000000000000000000000000000000000000000000
  • Gas limits around 0x1a000000 -> returns out of gas error
  • Gas limits above 0x1c000000 -> returns 0x000000000000000000000000000000000000000000000000000000000011b645

0x1c000000 is a very high amount of gas (over 465 million).

Thank you very much for investigating, so I wasn’t aware that the gas limit supplied to a view function can alter its return value, and that if the value is not specified the default gas limit of the node will be used. So I don’t think Infura can be faulted here, the caller needs to set its own gas limit to guard against this.