![]() |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Message-call/contract-creation executor; useful for executing transactions. More...
#include <Executive.h>
Public Member Functions | |
| Executive (State &_s, EnvInfo const &_envInfo, SealEngineFace const &_sealEngine, unsigned _level=0) | |
| Simple constructor; executive will operate on given state, with the given environment info. More... | |
| Executive (Block &_s, BlockChain const &_bc, unsigned _level=0) | |
| Executive (Block &_s, LastBlockHashesFace const &_lh, unsigned _level=0) | |
| Executive (State &io_s, Block const &_block, unsigned _txIndex, BlockChain const &_bc, unsigned _level=0) | |
| Executive (Executive const &)=delete | |
| void | operator= (Executive)=delete |
| void | initialize (bytesConstRef _transaction) |
| Initializes the executive for evaluating a transaction. You must call finalize() at some point following this. More... | |
| void | initialize (Transaction const &_transaction) |
| bool | finalize () |
| bool | execute () |
| Transaction const & | t () const |
| LogEntries const & | logs () const |
| u256 | gasUsed () const |
| owning_bytes_ref | takeOutput () |
| bool | create (Address const &_txSender, u256 const &_endowment, u256 const &_gasPrice, u256 const &_gas, bytesConstRef _code, Address const &_originAddress) |
| bool | createOpcode (Address const &_sender, u256 const &_endowment, u256 const &_gasPrice, u256 const &_gas, bytesConstRef _code, Address const &_originAddress) |
| bool | create2Opcode (Address const &_sender, u256 const &_endowment, u256 const &_gasPrice, u256 const &_gas, bytesConstRef _code, Address const &_originAddress, u256 const &_salt) |
| bool | call (Address const &_receiveAddress, Address const &_txSender, u256 const &_txValue, u256 const &_gasPrice, bytesConstRef _txData, u256 const &_gas) |
| bool | call (CallParameters const &_cp, u256 const &_gasPrice, Address const &_origin) |
| void | accrueSubState (SubState &_parentContext) |
| Finalise an operation through accruing the substate into the parent context. More... | |
| bool | go (OnOpFunc const &_onOp=OnOpFunc()) |
| OnOpFunc | simpleTrace () |
| Operation function for providing a simple trace of the VM execution. More... | |
| u256 | gas () const |
| Address | newAddress () const |
| TransactionException | getException () const noexcept |
| void | setResultRecipient (ExecutionResult &_res) |
| Collect execution results in the result storage provided. More... | |
| void | revert () |
| Revert all changes made to the state by this execution. More... | |
Message-call/contract-creation executor; useful for executing transactions.
Two ways of using this class - either as a transaction executive or a CALL/CREATE executive.
In the first use, after construction, begin with initialize(), then execute() and end with finalize(). Call go() after execute() only if it returns false.
In the second use, after construction, begin with call() or create() and end with accrueSubState(). Call go() after call()/create() only if it returns false.
Example:
Definition at line 103 of file Executive.h.
|
inline |
Simple constructor; executive will operate on given state, with the given environment info.
Definition at line 107 of file Executive.h.
| Executive::Executive | ( | Block & | _s, |
| BlockChain const & | _bc, | ||
| unsigned | _level = 0 |
||
| ) |
Easiest constructor. Creates executive to operate on the state of end of the given block, populating environment info from given Block and the LastHashes portion from the BlockChain.
Definition at line 182 of file Executive.cpp.
| Executive::Executive | ( | Block & | _s, |
| LastBlockHashesFace const & | _lh, | ||
| unsigned | _level = 0 |
||
| ) |
LastHashes-split constructor. Creates executive to operate on the state of end of the given block, populating environment info accordingly, with last hashes given explicitly.
Definition at line 190 of file Executive.cpp.
| Executive::Executive | ( | State & | io_s, |
| Block const & | _block, | ||
| unsigned | _txIndex, | ||
| BlockChain const & | _bc, | ||
| unsigned | _level = 0 |
||
| ) |
Previous-state constructor. Creates executive to operate on the state of a particular transaction in the given block, populating environment info from the given Block and the LastHashes portion from the BlockChain. State is assigned the resultant value, but otherwise unused.
Definition at line 198 of file Executive.cpp.
|
delete |
| void Executive::accrueSubState | ( | SubState & | _parentContext | ) |
Finalise an operation through accruing the substate into the parent context.
Definition at line 211 of file Executive.cpp.
| bool Executive::call | ( | Address const & | _receiveAddress, |
| Address const & | _txSender, | ||
| u256 const & | _txValue, | ||
| u256 const & | _gasPrice, | ||
| bytesConstRef | _txData, | ||
| u256 const & | _gas | ||
| ) |
Set up the executive for evaluating a bare CALL (message call) operation.
Definition at line 285 of file Executive.cpp.
| bool Executive::call | ( | CallParameters const & | _cp, |
| u256 const & | _gasPrice, | ||
| Address const & | _origin | ||
| ) |
Definition at line 291 of file Executive.cpp.
| bool Executive::create | ( | Address const & | _txSender, |
| u256 const & | _endowment, | ||
| u256 const & | _gasPrice, | ||
| u256 const & | _gas, | ||
| bytesConstRef | _code, | ||
| Address const & | _originAddress | ||
| ) |
Set up the executive for evaluating a bare CREATE (contract-creation) operation.
Definition at line 357 of file Executive.cpp.
| bool Executive::create2Opcode | ( | Address const & | _sender, |
| u256 const & | _endowment, | ||
| u256 const & | _gasPrice, | ||
| u256 const & | _gas, | ||
| bytesConstRef | _code, | ||
| Address const & | _originAddress, | ||
| u256 const & | _salt | ||
| ) |
Definition at line 370 of file Executive.cpp.
| bool Executive::createOpcode | ( | Address const & | _sender, |
| u256 const & | _endowment, | ||
| u256 const & | _gasPrice, | ||
| u256 const & | _gas, | ||
| bytesConstRef | _code, | ||
| Address const & | _originAddress | ||
| ) |
Definition at line 363 of file Executive.cpp.
| bool Executive::execute | ( | ) |
Begins execution of a transaction. You must call finalize() following this.
Definition at line 269 of file Executive.cpp.
| bool Executive::finalize | ( | ) |
Finalise a transaction previously set up with initialize().
Definition at line 535 of file Executive.cpp.
|
inline |
Definition at line 175 of file Executive.h.
| u256 Executive::gasUsed | ( | ) | const |
Definition at line 206 of file Executive.cpp.
|
inlinenoexcept |
Definition at line 181 of file Executive.h.
Executes (or continues execution of) the VM.
Definition at line 441 of file Executive.cpp.
|
inline |
Initializes the executive for evaluating a transaction. You must call finalize() at some point following this.
Definition at line 132 of file Executive.h.
| void Executive::initialize | ( | Transaction const & | _transaction | ) |
Definition at line 217 of file Executive.cpp.
|
inline |
Definition at line 146 of file Executive.h.
|
inline |
Definition at line 178 of file Executive.h.
|
delete |
| void Executive::revert | ( | ) |
Revert all changes made to the state by this execution.
Definition at line 575 of file Executive.cpp.
|
inline |
Collect execution results in the result storage provided.
Definition at line 184 of file Executive.h.
| OnOpFunc Executive::simpleTrace | ( | ) |
Operation function for providing a simple trace of the VM execution.
Definition at line 420 of file Executive.cpp.
|
inline |
Definition at line 143 of file Executive.h.
|
inline |
Definition at line 151 of file Executive.h.