vechain-sdk-js
vechain-sdk-js copied to clipboard
🐛 [BUG] - RPC eth_estimateGas has no-standard-behaviour
Description
While migration a hardhat project to the @vechain/sdk-hardhat-plugin
a difference in the handling of eth_estimateGas
occured.
Calling eth_estimateGas
requires a second parameter for the block height, which is normally not required.
For example:
- https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_estimategas
- https://www.quicknode.com/docs/ethereum/eth_estimateGas
Or test with ankr:
curl -XPOST -s "https://rpc.ankr.com/eth" -H "content-type: application/json" -d '
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"from": "0x37cce5c8bd6141cbe8172b277faa65af5cc83c6a",
"data": "0x"
}
],
"id": "1"
}
' | jq
returns:
{
"jsonrpc": "2.0",
"id": "1",
"result": "0xcf08"
}
The SDK throws an error on that call because a second parameter with a block reference is required:
https://github.com/vechain/vechain-sdk-js/blob/7eb0fe28c0fc7e71d82a28cf3f73f687245c74e0/packages/network/src/provider/utils/rpc-mapper/methods-map/methods/eth_estimateGas/eth_estimateGas.ts#L27-L43
Reproduction URL
No response
Reproduction steps
Execute rpc request `eth_estimateGas` with params:
[
{
"from": "0x37cce5c8bd6141cbe8172b277faa65af5cc83c6a",
"data": "0x"
}
]
It should return a successful estimate instead of an error.
Screenshots
No response
Logs
No response
OS
No response