edr icon indicating copy to clipboard operation
edr copied to clipboard

Add support for block override in `eth_call`

Open fvictorio opened this issue 6 months ago • 0 comments

See docs here: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#eth-call

The fields to support are:

  • number
  • difficulty
  • time
  • gasLimit
  • coinbase
  • random
  • baseFee
  • blobBaseFee

Integration tests for this are relatively easy to implement. We just need to deploy a contract like this:

contract BlockOverrideTest {
  function getBlockNumber() public view returns (uint) {
    return block.number;
  }

  function getBlockTimestamp() public view returns (uint) {
    return block.timestamp;
  }

  // etc.
}

and call each function with the proper override. (Testing that multiple things can be overridden with a single call is a bit more involved, but still doable.)

fvictorio avatar Aug 19 '24 15:08 fvictorio