ethereum.tangerine_whistle.utils.messageethereum.spurious_dragon.utils.message
Hardfork Utility Functions For The Message Data-structure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Message specific functions used in this tangerine whistle version ofMessage specific functions used in this spurious dragon version of
specification.
prepare_message
Execute a transaction against the provided environment.
Parameters
block_env : Environment for the Ethereum Virtual Machine. tx_env : Environment for the transaction. tx : Transaction to be executed.
Returns
message:
Items containing contract creation or message call specific data.ethereum.tangerine_whistle.vm.Messageethereum.spurious_dragon.vm.Message
def prepare_message(block_env: BlockEnvironment, tx_env: TransactionEnvironment, tx: Transaction) -> Message:
30 | """ |
---|---|
31 | Execute a transaction against the provided environment. |
32 |
|
33 | Parameters |
34 | ---------- |
35 | block_env : |
36 | Environment for the Ethereum Virtual Machine. |
37 | tx_env : |
38 | Environment for the transaction. |
39 | tx : |
40 | Transaction to be executed. |
41 |
|
42 | Returns |
43 | ------- |
44 | message: `ethereum.tangerine_whistle.vm.Message` |
44 | message: `ethereum.spurious_dragon.vm.Message` |
45 | Items containing contract creation or message call specific data. |
46 | """ |
47 | if isinstance(tx.to, Bytes0): |
48 | current_target = compute_contract_address( |
49 | tx_env.origin, |
50 | get_account(block_env.state, tx_env.origin).nonce - Uint(1), |
51 | ) |
52 | msg_data = Bytes(b"") |
53 | code = tx.data |
54 | code_address = None |
55 | elif isinstance(tx.to, Address): |
56 | current_target = tx.to |
57 | msg_data = tx.data |
58 | code = get_account(block_env.state, tx.to).code |
59 |
|
60 | code_address = tx.to |
61 | else: |
62 | raise AssertionError("Target must be address or empty bytes") |
63 | |
64 | return Message( |
65 | block_env=block_env, |
66 | tx_env=tx_env, |
67 | caller=tx_env.origin, |
68 | target=tx.to, |
69 | gas=tx_env.gas, |
70 | value=tx.value, |
71 | data=msg_data, |
72 | code=code, |
73 | depth=Uint(0), |
74 | current_target=current_target, |
75 | code_address=code_address, |
76 | should_transfer_value=True, |
77 | parent_evm=None, |
78 | ) |