evm.vm package¶
Subpackages¶
Submodules¶
evm.vm.base module¶
-
class
evm.vm.base.VM(header, chaindb)¶ Bases:
objectThe VM class represents the Chain rules for a specific protocol definition such as the Frontier or Homestead network. Defining an Chain defining individual VM classes for each fork of the protocol rules within that network.
-
apply_computation(message)¶ Perform the computation that would be triggered by the VM message.
-
apply_create_message(message)¶ Execution of an VM message to create a new contract.
-
apply_message(message)¶ Execution of an VM message.
-
apply_transaction(transaction)¶ Apply the transaction to the vm in the current block.
-
chaindb= None¶
-
clear_journal()¶ Cleare the journal. This should be called at any point of VM execution where the statedb is being committed, such as after a transaction has been applied to a block.
-
commit(snapshot)¶ Commits the journal to the point where the snapshot was taken. This will destroy any journal checkpoints after the snapshot checkpoint.
-
classmethod
configure(name=None, **overrides)¶
-
configure_header(**header_params)¶ Setup the current header with the provided parameters. This can be used to set fields like the gas limit or timestamp to value different than their computed defaults.
-
classmethod
create_header_from_parent(parent_header, **header_params)¶ Creates and initializes a new block header from the provided parent_header.
-
create_transaction(*args, **kwargs)¶ Proxy for instantiating a transaction for this VM.
-
create_unsigned_transaction(*args, **kwargs)¶ Proxy for instantiating a transaction for this VM.
-
execute_transaction(transaction)¶ Execute the transaction in the vm.
-
get_ancestor_hash(block_number)¶ Return the hash for the ancestor with the given number
-
get_block_by_header(block_header)¶
-
classmethod
get_block_class()¶ Return the class that this VM uses for blocks.
-
get_block_reward(block_number)¶
-
get_nephew_reward(block_number)¶
-
get_opcode_fn(opcode)¶
-
get_transaction_class()¶ Return the class that this VM uses for transactions.
-
get_uncle_reward(block_number, uncle)¶
-
import_block(block)¶
-
logger¶
-
mine_block(*args, **kwargs)¶ Mine the current block.
-
opcodes= None¶
-
precompiles¶
-
revert(snapshot)¶ Revert the VM to the state at the snapshot
-
snapshot()¶ Perform a full snapshot of the current state of the VM.
Snapshots are a combination of the state_root at the time of the snapshot and the checkpoint_id returned from the journaled DB.
-
state_db(read_only=False)¶
-
validate_transaction(transaction)¶ Perform chain-aware validation checks on the transaction.
-
evm.vm.code_stream module¶
evm.vm.computation module¶
-
class
evm.vm.computation.Computation(vm, message)¶ Bases:
objectThe execution computation
-
accounts_to_delete= None¶
-
add_child_computation(child_computation)¶
-
add_log_entry(account, topics, data)¶
-
apply_child_computation(child_msg)¶
-
children= None¶
-
code= None¶
-
error= None¶
-
extend_memory(start_position, size)¶
-
gas_meter= None¶
-
get_accounts_for_deletion()¶
-
get_gas_refund()¶
-
get_gas_remaining()¶
-
get_gas_used()¶
-
get_log_entries()¶
-
is_error¶
-
is_origin_computation¶ Is this computation the computation initiated by a transaction.
-
is_success¶
-
logger= <logging.Logger object>¶
-
logs= None¶
-
memory= None¶
-
msg= None¶
-
output¶
-
prepare_child_message(gas, to, value, data, code, **kwargs)¶
-
register_account_for_deletion(beneficiary)¶
-
return_data= b''¶
-
stack= None¶
-
vm= None¶
-
-
evm.vm.computation.memory_gas_cost(size_in_bytes)¶
evm.vm.gas_meter module¶
evm.vm.memory module¶
evm.vm.message module¶
-
class
evm.vm.message.Message(gas, gas_price, to, sender, value, data, code, origin=None, depth=0, create_address=None, code_address=None, should_transfer_value=True, is_static=False)¶ Bases:
objectA message for VM computation.
-
code= None¶
-
code_address¶
-
create_address= None¶
-
data= None¶
-
depth= None¶
-
gas= None¶
-
gas_price= None¶
-
is_create¶
-
is_origin¶
-
is_static= None¶
-
logger= <logging.Logger object>¶
-
origin¶
-
sender= None¶
-
should_transfer_value= None¶
-
storage_address¶
-
to= None¶
-
value= None¶
-
evm.vm.stack module¶
-
class
evm.vm.stack.Stack¶ Bases:
objectVM Stack
-
dup(position)¶ Perform a DUP operation on the stack.
-
logger= <logging.Logger object>¶
-
pop(num_items=1, type_hint=None)¶ Pop an item off thes stack.
Note: This function is optimized for speed over readability.
-
push(value)¶ Push an item onto the stack.
-
swap(position)¶ Perform a SWAP operation on the stack.
-
values= None¶
-