Skip to content

Expose EVM Object #53

@AusIV

Description

@AusIV

Rationale

The EVM object would be useful for simulating EVM functions, for use cases similar to Cardinal's Estimate Gas List

Implementation

Start with a plugeth-utils interface:

type EVM interface {
  func Reset(txCtx TxContext, statedb StateDB)
  func Cancel()
  func Cancelled() bool
  func Call(caller *core.Address, addr core.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error)
  func CallCode(caller *core.Address, addr core.Address, input []byte, gas uint64, value *big.Int) (ret []byte, leftOverGas uint64, err error)
  func DelegateCall(caller *core.Address, addr core.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
  func StaticCall(caller *core.Address, addr core.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error)
  func Create(caller *core.Address, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr core.Address, leftOverGas uint64, err error)
  func Create2(caller *core.Address, code []byte, gas uint64, endowment *big.Int, salt *uint256.Int) (ret []byte, contractAddr core.Address, leftOverGas uint64, err error)
  func ChainConfig() *params.ChainConfig { return evm.chainConfig
}

Then in plugeth's plugins/wrappers, implement a wrapper object that takes a core.EVM object and translates calls to comply with the Plugeth-utils interface.

This could then be exposed through the PluGeth backend by proxying the internal/ethapi backend's GetEVM() call. Note that this will require the implmentation of #52 so that the StateDB can be passed through.

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