Skip to content

Support state overrides in eth_call #512

@gzliudan

Description

@gzliudan

The state override set option allows you to change the state of a contract before executing the call. This means you can modify the values of variables stored in the contract, such as balances and approvals for that call without actually modifying the contract on the blockchain.

In more technical terms, the state override set is an optional parameter that allows executing the call against a modified chain state. It is an address-to-state mapping, where each entry specifies some state to be overridden prior to executing the call. Each address maps to an object containing:

FIELD TYPE BYTES 2 DESCRIPTION
balance Quantity <32 Fake balance to set for the account before executing the call.
nonce Quantity <8 Fake nonce to set for the account before executing the call.
code Binary any Fake EVM bytecode to inject into the account before executing the call.
state Object any Fake key-value mapping to override all slots in the account storage before executing the call.
stateDiff Object any Fake key-value mapping to override individual slots in the account storage before executing the call.

The state override set is the third parameter in eth_call. We only support the first and the second parameters now. It is a new feature to the xdc blockchain.

Reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions