You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just found a bug in Hardhat Network's implementation of eth_call, which I'm currently fixing it, and realized that I'll have to copy paste a bunch fo code from the VM to do it.
Our implementation of eth_call uses vm.runTx, instead of vm.runCall, as the latter can fail. But runTx wasn't really designed for this, and I'm hitting a limitation.
When you execute eth_call, you can run your call in the context of a block, and it should be as close as possible to running a tx as the last one in the block. This means that you need to keep things like block.timestamp and block.gasLimit in sync.
eth_call also accepts a gas limit param, which doesn't need to be capped by block.gasLimit. Actually, it's normally higher. For example, Geth accepts up to 25000000 regardless of the block gas limit.
My problem is that runTx checks that the tx's gas limit is <= than the block's one here. So, I need to do something like this myself, but _runTx is not exported, so I'd need to copy everything.
As a "workaround" I can modify the block, setting its gas limit to the eth_call's one right before execution, but that behavior is slightly incorrect.
In the meantime, I'll implement that workaround, but it'd be great to have a way to implement this properly. We are not on v5 yet, so even if we somehow fix this, I'll need the workaround for about a month.
The text was updated successfully, but these errors were encountered:
I just found a bug in Hardhat Network's implementation of
eth_call
, which I'm currently fixing it, and realized that I'll have to copy paste a bunch fo code from the VM to do it.Our implementation of
eth_call
usesvm.runTx
, instead ofvm.runCall
, as the latter can fail. ButrunTx
wasn't really designed for this, and I'm hitting a limitation.When you execute
eth_call
, you can run your call in the context of a block, and it should be as close as possible to running a tx as the last one in the block. This means that you need to keep things likeblock.timestamp
andblock.gasLimit
in sync.eth_call
also accepts a gas limit param, which doesn't need to be capped byblock.gasLimit
. Actually, it's normally higher. For example, Geth accepts up to 25000000 regardless of the block gas limit.My problem is that
runTx
checks that the tx's gas limit is <= than the block's one here. So, I need to do something like this myself, but_runTx
is not exported, so I'd need to copy everything.As a "workaround" I can modify the block, setting its gas limit to the
eth_call
's one right before execution, but that behavior is slightly incorrect.In the meantime, I'll implement that workaround, but it'd be great to have a way to implement this properly. We are not on v5 yet, so even if we somehow fix this, I'll need the workaround for about a month.
The text was updated successfully, but these errors were encountered: