Skip to content

Commit 7fa2c3e

Browse files
lrettighwwhww
authored andcommitted
Add transaction_context object to Computation
Ports over the changes made to master in ethereum#327. Creates a BaseTransactionContext class and a child FrontierTransactionContext class. Removes properties which remain constant (gas_price, origin) from Message and move them to the new TransactionContext class. Generate a TransactionContext inside execute_transaction and attach it to the Computation object. Pass this down into child Computations. Begin reworking code which reads the (now-removed) Message.{origin,gas_price}. Update tests. Errors from blockchain fixtures were being swallowed silently. Output these along with a full stack trace to make debugging easier.
1 parent 41db49c commit 7fa2c3e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/json-fixtures/test_virtual_machine.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,23 @@ def test_vm_fixtures(fixture, vm_class, computation_getter):
192192
# Update state_root manually
193193
vm.block.header.state_root = vm_state.state_root
194194

195-
computation = computation_getter(fixture, code, vm)
196-
195+
message = Message(
196+
to=fixture['exec']['address'],
197+
sender=fixture['exec']['caller'],
198+
value=fixture['exec']['value'],
199+
data=fixture['exec']['data'],
200+
code=code,
201+
gas=fixture['exec']['gas'],
202+
)
203+
transaction_context = BaseTransactionContext(
204+
origin=fixture['exec']['origin'],
205+
gas_price=fixture['exec']['gasPrice'],
206+
)
207+
computation = vm.state.get_computation(message, transaction_context).apply_computation(
208+
vm.state,
209+
message,
210+
transaction_context,
211+
)
197212
# Update state_root manually
198213
vm.block.header.state_root = computation.vm_state.state_root
199214

0 commit comments

Comments
 (0)