Ethereum  PoC-8
The C++ Implementation of Ethereum
dev::eth::ExtVM Class Reference

Externality interface for the Virtual Machine providing access to world state. More...

#include <ExtVM.h>

Inheritance diagram for dev::eth::ExtVM:
dev::eth::ExtVMFace

Public Member Functions

 ExtVM (State &_s, EnvInfo const &_envInfo, SealEngineFace const &_sealEngine, Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytesConstRef _code, h256 const &_codeHash, unsigned _depth, bool _isCreate, bool _staticCall)
 Full constructor. More...
 
u256 store (u256 _n) final
 Read storage location. More...
 
void setStore (u256 _n, u256 _v) final
 Write a value in storage. More...
 
u256 originalStorageValue (u256 const &_key) final
 Read original storage value (before modifications in the current transaction). More...
 
bytes const & codeAt (Address _a) final
 Read address's code. More...
 
size_t codeSizeAt (Address _a) final
 
h256 codeHashAt (Address _a) final
 
CreateResult create (u256 _endowment, u256 &io_gas, bytesConstRef _code, Instruction _op, u256 _salt, OnOpFunc const &_onOp={}) final
 Create a new contract. More...
 
CallResult call (CallParameters &_params) final
 Create a new message call. More...
 
u256 balance (Address _a) final
 Read address's balance. More...
 
bool exists (Address _a) final
 Does the account exist? More...
 
void suicide (Address _a) final
 Suicide the associated contract to the given address. More...
 
EVMSchedule const & evmSchedule () const final
 Return the EVM gas-price schedule for this execution context. More...
 
State const & state () const
 
h256 blockHash (u256 _number) final
 Hash of a block if within the last 256 blocks, or h256() otherwise. More...
 
- Public Member Functions inherited from dev::eth::ExtVMFace
 ExtVMFace (EnvInfo const &_envInfo, Address _myAddress, Address _caller, Address _origin, u256 _value, u256 _gasPrice, bytesConstRef _data, bytes _code, h256 const &_codeHash, unsigned _depth, bool _isCreate, bool _staticCall)
 Full constructor. More...
 
virtual ~ExtVMFace ()=default
 
 ExtVMFace (ExtVMFace const &)=delete
 
ExtVMFaceoperator= (ExtVMFace const &)=delete
 
virtual void log (h256s &&_topics, bytesConstRef _data)
 Revert any changes made (by any of the other calls). More...
 
EnvInfo const & envInfo () const
 Get the execution environment information. More...
 

Additional Inherited Members

- Public Attributes inherited from dev::eth::ExtVMFace
Address myAddress
 Address associated with executing code (a contract, or contract-to-be). More...
 
Address caller
 Address which sent the message (either equal to origin or a contract). More...
 
Address origin
 Original transactor. More...
 
u256 value
 Value (in Wei) that was passed to this address. More...
 
u256 gasPrice
 Price of gas (that we already paid). More...
 
bytesConstRef data
 Current input data. More...
 
bytes code
 Current code that is executing. More...
 
h256 codeHash
 SHA3 hash of the executing code. More...
 
u256 salt
 Values used in new address construction by CREATE2. More...
 
SubState sub
 Sub-band VM state (suicides, refund counter, logs). More...
 
unsigned depth = 0
 Depth of the present call. More...
 
bool isCreate = false
 Is this a CREATE call? More...
 
bool staticCall = false
 Throw on state changing. More...
 

Detailed Description

Externality interface for the Virtual Machine providing access to world state.

Definition at line 38 of file ExtVM.h.

Constructor & Destructor Documentation

◆ ExtVM()

dev::eth::ExtVM::ExtVM ( State _s,
EnvInfo const &  _envInfo,
SealEngineFace const &  _sealEngine,
Address  _myAddress,
Address  _caller,
Address  _origin,
u256  _value,
u256  _gasPrice,
bytesConstRef  _data,
bytesConstRef  _code,
h256 const &  _codeHash,
unsigned  _depth,
bool  _isCreate,
bool  _staticCall 
)
inline

Full constructor.

Definition at line 42 of file ExtVM.h.

Member Function Documentation

◆ balance()

u256 dev::eth::ExtVM::balance ( Address  _a)
inlinefinalvirtual

Read address's balance.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 85 of file ExtVM.h.

◆ blockHash()

h256 ExtVM::blockHash ( u256  _number)
finalvirtual

Hash of a block if within the last 256 blocks, or h256() otherwise.

Implements dev::eth::ExtVMFace.

Definition at line 186 of file ExtVM.cpp.

◆ call()

CallResult ExtVM::call ( CallParameters _params)
finalvirtual

Create a new message call.

Implements dev::eth::ExtVMFace.

Definition at line 126 of file ExtVM.cpp.

◆ codeAt()

bytes const& dev::eth::ExtVM::codeAt ( Address  _a)
inlinefinalvirtual

Read address's code.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 70 of file ExtVM.h.

◆ codeHashAt()

h256 ExtVM::codeHashAt ( Address  _a)
finalvirtual
Returns
the hash of the code at the given address.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 144 of file ExtVM.cpp.

◆ codeSizeAt()

size_t ExtVM::codeSizeAt ( dev::Address  _a)
finalvirtual
Returns
the size of the code in bytes at the given address.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 139 of file ExtVM.cpp.

◆ create()

CreateResult ExtVM::create ( u256  _endowment,
u256 io_gas,
bytesConstRef  _code,
Instruction  _op,
u256  _salt,
OnOpFunc const &  _onOp = {} 
)
finalvirtual

Create a new contract.

Implements dev::eth::ExtVMFace.

Definition at line 154 of file ExtVM.cpp.

◆ evmSchedule()

EVMSchedule const& dev::eth::ExtVM::evmSchedule ( ) const
inlinefinalvirtual

Return the EVM gas-price schedule for this execution context.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 100 of file ExtVM.h.

◆ exists()

bool dev::eth::ExtVM::exists ( Address  _a)
inlinefinalvirtual

Does the account exist?

Reimplemented from dev::eth::ExtVMFace.

Definition at line 88 of file ExtVM.h.

◆ originalStorageValue()

u256 dev::eth::ExtVM::originalStorageValue ( u256 const &  _key)
inlinefinalvirtual

Read original storage value (before modifications in the current transaction).

Reimplemented from dev::eth::ExtVMFace.

Definition at line 64 of file ExtVM.h.

◆ setStore()

void ExtVM::setStore ( u256  _n,
u256  _v 
)
finalvirtual

Write a value in storage.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 149 of file ExtVM.cpp.

◆ state()

State const& dev::eth::ExtVM::state ( ) const
inline

Definition at line 105 of file ExtVM.h.

◆ store()

u256 dev::eth::ExtVM::store ( u256  _n)
inlinefinalvirtual

Read storage location.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 58 of file ExtVM.h.

◆ suicide()

void ExtVM::suicide ( Address  _a)
finalvirtual

Suicide the associated contract to the given address.

Reimplemented from dev::eth::ExtVMFace.

Definition at line 175 of file ExtVM.cpp.


The documentation for this class was generated from the following files: