[go: up one dir, main page]

Etherlink: eth_call state override

We have the standard ethereum spec implemented for eth_call: https://ethereum.org/fr/developers/docs/apis/json-rpc/#eth_call

But geth adds a few features that could be used by priority partners, in particular state override https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#ethcall-override-example

Note: there is also block override, but that's not what is asked ? tbc @lthms

Funny use case presented in the geth doc: modify a contract to add accessors to some private values, to be able to query using eth_call

Spec:

Field Type Bytes Optional Description
balance Quantity <32 Yes Fake balance to set for the account before executing the call.
nonce Quantity <8 Yes Fake nonce to set for the account before executing the call.
code Binary any Yes Fake EVM bytecode to inject into the account before executing the call.
state Object any Yes Fake key-value mapping to override all slots in the account storage before executing the call.
stateDiff Object any Yes Fake key-value mapping to override individual slots in the account storage before executing the call.

Example:

{
  "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3": {
    "balance": "0xde0b6b3a7640000"
  },
  "0xebe8efa441b9302a0d7eaecc277c09d20d684540": {
    "code": "0x...",
    "state": {
      ""
    }
  }
}

It seems all work is done in the node, with no modification to the kernel.

Edited by Pierre-Emmanuel CORNILLEAU