· 7 years ago · Sep 01, 2018, 11:00 AM
1% pytest -vvvvv --capture=no -k "test_state_fixtures[/home/veox/src/py-evm/fixtures/GeneralStateTests/stReturnDataTest/modexp_modsize0_returndatasize.json:modexp_modsize0_returndatasize:Byzantium:4]"
2========================================================================================= test session starts =========================================================================================
3platform linux -- Python 3.7.0, pytest-3.6.4, py-1.6.0, pluggy-0.7.1 -- /home/veox/src/py-evm/.virtualenv/py-evm/bin/python
4cachedir: .pytest_cache
5rootdir: /home/veox/src/py-evm, inifile: pytest.ini
6plugins: xdist-1.18.1, cov-2.5.1, asyncio-0.9.0, asyncio-network-simulator-0.1.0a2, hypothesis-3.69.5
7collected 82815 items / 82814 deselected / 1 skipped
8
9tests/json-fixtures/test_state.py::test_state_fixtures[/home/veox/src/py-evm/fixtures/GeneralStateTests/stReturnDataTest/modexp_modsize0_returndatasize.json:modexp_modsize0_returndatasize:Byzantium:4] Set level for logger: eth
10Set level for logger: p2p
11Set level for logger: trinity
12Generating AccountDB trie
13TRANSACTION: sender: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | gas: 1000000000 | gas-price: 1 | s: 13621143048526588506862799462283916133293811860612719748513146487649688695973 | r: 8871728107123313783612332975171019870077055321389879585797480748028168320763 | v: 28 | data-hash: 0x7bc9dbd09195275429a19d51a23fb9b38ab1b61cb525aa516de05c932ab72450
14COMPUTATION STARTING: gas: 999978092 | from: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth 0 | static: n
15OPCODE: 0x36 (CALLDATASIZE) | pc: 0
16GAS CONSUMPTION: 999978092 - 2 -> 999978090 (CALLDATASIZE)
17OPCODE: 0x60 (PUSH1) | pc: 1
18GAS CONSUMPTION: 999978090 - 3 -> 999978087 (PUSH1)
19OPCODE: 0x60 (PUSH1) | pc: 3
20GAS CONSUMPTION: 999978087 - 3 -> 999978084 (PUSH1)
21OPCODE: 0x37 (CALLDATACOPY) | pc: 5
22GAS CONSUMPTION: 999978084 - 3 -> 999978081 (CALLDATACOPY)
23MEMORY: size (0 -> 128) | cost (0 -> 12)
24GAS CONSUMPTION: 999978081 - 12 -> 999978069 (Expanding memory 0 -> 128)
25GAS CONSUMPTION: 999978069 - 12 -> 999978057 (CALLDATACOPY fee)
26OPCODE: 0x60 (PUSH1) | pc: 6
27GAS CONSUMPTION: 999978057 - 3 -> 999978054 (PUSH1)
28OPCODE: 0x61 (PUSH2) | pc: 8
29GAS CONSUMPTION: 999978054 - 3 -> 999978051 (PUSH2)
30OPCODE: 0x36 (CALLDATASIZE) | pc: 11
31GAS CONSUMPTION: 999978051 - 2 -> 999978049 (CALLDATASIZE)
32OPCODE: 0x60 (PUSH1) | pc: 12
33GAS CONSUMPTION: 999978049 - 3 -> 999978046 (PUSH1)
34OPCODE: 0x60 (PUSH1) | pc: 14
35GAS CONSUMPTION: 999978046 - 3 -> 999978043 (PUSH1)
36OPCODE: 0x60 (PUSH1) | pc: 16
37GAS CONSUMPTION: 999978043 - 3 -> 999978040 (PUSH1)
38OPCODE: 0x5a (GAS) | pc: 18
39GAS CONSUMPTION: 999978040 - 2 -> 999978038 (GAS)
40OPCODE: 0xf2 (CALLCODE) | pc: 19
41GAS CONSUMPTION: 999978038 - 700 -> 999977338 (CALLCODE)
42MEMORY: size (128 -> 128) | cost (12 -> 12)
43MEMORY: size (128 -> 1056) | cost (12 -> 101)
44GAS CONSUMPTION: 999977338 - 89 -> 999977249 (Expanding memory 128 -> 1056)
45GAS CONSUMPTION: 999977249 - 984352605 -> 15624644 (CALLCODE)
46COMPUTATION STARTING: gas: 984352605 | from: 0x1000000000000000000000000000000000000000 | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth 1 | static: n
47GAS CONSUMPTION: 984352605 - 23970528 -> 960382077 (MODEXP Precompile)
48COMPUTATION SUCCESS: from: 0x1000000000000000000000000000000000000000 | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth: 1 | static: n | gas-used: 23970528 | gas-remaining: 960382077
49GAS RETURNED: 15624644 + 960382077 -> 976006721
50OPCODE: 0x60 (PUSH1) | pc: 20
51GAS CONSUMPTION: 976006721 - 3 -> 976006718 (PUSH1)
52OPCODE: 0x55 (SSTORE) | pc: 22
53GAS CONSUMPTION: 976006718 - 20000 -> 975986718 (SSTORE: 0x1000000000000000000000000000000000000000[1] -> 1 (0))
54OPCODE: 0x61 (PUSH2) | pc: 23
55GAS CONSUMPTION: 975986718 - 3 -> 975986715 (PUSH2)
56OPCODE: 0x51 (MLOAD) | pc: 26
57GAS CONSUMPTION: 975986715 - 3 -> 975986712 (MLOAD)
58MEMORY: size (1056 -> 1056) | cost (101 -> 101)
59OPCODE: 0x60 (PUSH1) | pc: 27
60GAS CONSUMPTION: 975986712 - 3 -> 975986709 (PUSH1)
61OPCODE: 0x55 (SSTORE) | pc: 29
62GAS CONSUMPTION: 975986709 - 5000 -> 975981709 (SSTORE: 0x1000000000000000000000000000000000000000[2] -> 0 (0))
63OPCODE: 0x3d (RETURNDATASIZE) | pc: 30
64GAS CONSUMPTION: 975981709 - 2 -> 975981707 (RETURNDATASIZE)
65OPCODE: 0x60 (PUSH1) | pc: 31
66GAS CONSUMPTION: 975981707 - 3 -> 975981704 (PUSH1)
67OPCODE: 0x55 (SSTORE) | pc: 33
68GAS CONSUMPTION: 975981704 - 5000 -> 975976704 (SSTORE: 0x1000000000000000000000000000000000000000[3] -> 999188 (4294967295))
69OPCODE: 0x0 (STOP) | pc: 33
70COMPUTATION SUCCESS: from: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth: 0 | static: n | gas-used: 24001388 | gas-remaining: 975976704
71TRANSACTION REFUND: 975976704 -> 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
72TRANSACTION FEE: 24023296 -> 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
73Generating AccountDB trie
74FAILED
75
76============================================================================================== FAILURES ===============================================================================================
77________________ test_state_fixtures[/home/veox/src/py-evm/fixtures/GeneralStateTests/stReturnDataTest/modexp_modsize0_returndatasize.json:modexp_modsize0_returndatasize:Byzantium:4] ________________
78
79fixture = {'env': {'currentCoinbase': b'*\xdc%fP\x18\xaa\x1f\xe0\xe6\xbcfm\xac\x8f\xc2i\x7f\xf9\xba', 'currentDifficulty': 13107...x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f?\x14\x01\x01\x01', 'gasLimit': 1000000000, 'gasPrice': 1, 'nonce': 0, ...}}
80fixture_vm_class = <class 'abc.ByzantiumVMForTesting'>
81
82 def test_state_fixtures(fixture, fixture_vm_class):
83 header = BlockHeader(
84 coinbase=fixture['env']['currentCoinbase'],
85 difficulty=fixture['env']['currentDifficulty'],
86 block_number=fixture['env']['currentNumber'],
87 gas_limit=fixture['env']['currentGasLimit'],
88 timestamp=fixture['env']['currentTimestamp'],
89 parent_hash=fixture['env']['previousHash'],
90 )
91
92 chaindb = ChainDB(get_db_backend())
93 vm = fixture_vm_class(header=header, chaindb=chaindb)
94
95 state = vm.state
96 apply_state_dict(state.account_db, fixture['pre'])
97 state.account_db.persist()
98
99 # Update state_root manually
100 vm.block = vm.block.copy(header=vm.block.header.copy(state_root=state.state_root))
101 if 'secretKey' in fixture['transaction']:
102 unsigned_transaction = vm.create_unsigned_transaction(
103 nonce=fixture['transaction']['nonce'],
104 gas_price=fixture['transaction']['gasPrice'],
105 gas=fixture['transaction']['gasLimit'],
106 to=fixture['transaction']['to'],
107 value=fixture['transaction']['value'],
108 data=fixture['transaction']['data'],
109 )
110 private_key = keys.PrivateKey(fixture['transaction']['secretKey'])
111 transaction = unsigned_transaction.as_signed_transaction(private_key=private_key)
112 elif 'vrs' in fixture['transaction']:
113 v, r, s = (
114 fixture['transaction']['v'],
115 fixture['transaction']['r'],
116 fixture['transaction']['s'],
117 )
118 transaction = vm.create_transaction(
119 nonce=fixture['transaction']['nonce'],
120 gas_price=fixture['transaction']['gasPrice'],
121 gas=fixture['transaction']['gasLimit'],
122 to=fixture['transaction']['to'],
123 value=fixture['transaction']['value'],
124 data=fixture['transaction']['data'],
125 v=v,
126 r=r,
127 s=s,
128 )
129
130 try:
131 header, receipt, computation = vm.apply_transaction(vm.block.header, transaction)
132 transactions = vm.block.transactions + (transaction, )
133 receipts = vm.block.get_receipts(chaindb) + (receipt, )
134 block = vm.set_block_transactions(vm.block, header, transactions, receipts)
135 except ValidationError as err:
136 block = vm.block
137 transaction_error = err
138 logger.warn("Got transaction error", exc_info=True)
139 else:
140 transaction_error = False
141
142 if not transaction_error:
143 log_entries = computation.get_log_entries()
144 actual_logs_hash = hash_log_entries(log_entries)
145 if 'logs' in fixture['post']:
146 expected_logs_hash = fixture['post']['logs']
147 assert expected_logs_hash == actual_logs_hash
148 elif log_entries:
149 raise AssertionError("Got log {0} entries. hash:{1}".format(
150 len(log_entries),
151 actual_logs_hash,
152 ))
153
154 if 'out' in fixture:
155 expected_output = fixture['out']
156 if isinstance(expected_output, int):
157 assert len(computation.output) == expected_output
158 else:
159 assert computation.output == expected_output
160
161> assert block.header.state_root == fixture['post']['hash']
162E AssertionError: assert b'\x08\x0e\x9...ef?\x1eK\x87}' == b'\x9a\xfeG\x8...2\xe4\xce\xa3'
163E At index 0 diff: 8 != 154
164E Full diff:
165E - (b'\x08\x0e\x9d\xfd\xef\x1a\xb1()V\xc2/\xf6\x9b\x98\xe3\xc8\xd1\x93\xcfx\xf1mX'
166E - b'e4\xef?\x1eK\x87}')
167E + (b'\x9a\xfeG\x85\xe7\x1e\xf1\xd3&8\xc3\xcc|c.%W\x00]b\xfes\\\xaeZ\xaa\xd6\xf3'
168E + b'\x02\xe4\xce\xa3')
169
170actual_logs_hash = b'\x1d\xccM\xe8\xde\xc7]z\xab\x85\xb5g\xb6\xcc\xd4\x1a\xd3\x12E\x1b\x94\x8at\x13\xf0\xa1B\xfd@\xd4\x93G'
171block = <ByzantiumBlock(#Block #1)>
172chaindb = <eth.db.chain.ChainDB object at 0x7f4d345a4cc0>
173computation = <eth.vm.forks.byzantium.computation.ByzantiumComputation object at 0x7f4d14aaf6d8>
174expected_logs_hash = b'\x1d\xccM\xe8\xde\xc7]z\xab\x85\xb5g\xb6\xcc\xd4\x1a\xd3\x12E\x1b\x94\x8at\x13\xf0\xa1B\xfd@\xd4\x93G'
175fixture = {'env': {'currentCoinbase': b'*\xdc%fP\x18\xaa\x1f\xe0\xe6\xbcfm\xac\x8f\xc2i\x7f\xf9\xba', 'currentDifficulty': 13107...x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f?\x14\x01\x01\x01', 'gasLimit': 1000000000, 'gasPrice': 1, 'nonce': 0, ...}}
176fixture_vm_class = <class 'abc.ByzantiumVMForTesting'>
177header = <BlockHeader #1 4e25f5d9>
178log_entries = ()
179memcontents = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
180offset = 1056
181private_key = '0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8'
182receipt = <eth.rlp.receipts.Receipt object at 0x7f4d14aaf588>
183receipts = (<eth.rlp.receipts.Receipt object at 0x7f4d14aaf588>,)
184state = <abc.ByzantiumStateForTesting object at 0x7f4d14aa43b8>
185step = 32
186transaction = <eth.vm.forks.byzantium.transactions.ByzantiumTransaction object at 0x7f4d14aaf400>
187transaction_error = False
188transactions = (<eth.vm.forks.byzantium.transactions.ByzantiumTransaction object at 0x7f4d14aaf400>,)
189unsigned_transaction = <eth.vm.forks.byzantium.transactions.ByzantiumUnsignedTransaction object at 0x7f4d345a4dd8>
190vm = <abc.ByzantiumVMForTesting object at 0x7f4d345a4d68>
191
192tests/json-fixtures/test_state.py:350: AssertionError
193----------------------------------------------------------------------------------------- Captured log setup ------------------------------------------------------------------------------------------
194conftest.py 46 INFO Set level for logger: eth
195conftest.py 46 INFO Set level for logger: p2p
196conftest.py 46 INFO Set level for logger: trinity
197------------------------------------------------------------------------------------------ Captured log call ------------------------------------------------------------------------------------------
198logging.py 10 TRACE Generating AccountDB trie
199logging.py 10 TRACE TRANSACTION: sender: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | gas: 1000000000 | gas-price: 1 | s: 13621143048526588506862799462283916133293811860612719748513146487649688695973 | r: 8871728107123313783612332975171019870077055321389879585797480748028168320763 | v: 28 | data-hash: 0x7bc9dbd09195275429a19d51a23fb9b38ab1b61cb525aa516de05c932ab72450
200logging.py 10 TRACE COMPUTATION STARTING: gas: 999978092 | from: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth 0 | static: n
201logging.py 10 TRACE OPCODE: 0x36 (CALLDATASIZE) | pc: 0
202logging.py 10 TRACE GAS CONSUMPTION: 999978092 - 2 -> 999978090 (CALLDATASIZE)
203logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 1
204logging.py 10 TRACE GAS CONSUMPTION: 999978090 - 3 -> 999978087 (PUSH1)
205logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 3
206logging.py 10 TRACE GAS CONSUMPTION: 999978087 - 3 -> 999978084 (PUSH1)
207logging.py 10 TRACE OPCODE: 0x37 (CALLDATACOPY) | pc: 5
208logging.py 10 TRACE GAS CONSUMPTION: 999978084 - 3 -> 999978081 (CALLDATACOPY)
209logging.py 10 TRACE MEMORY: size (0 -> 128) | cost (0 -> 12)
210logging.py 10 TRACE GAS CONSUMPTION: 999978081 - 12 -> 999978069 (Expanding memory 0 -> 128)
211logging.py 10 TRACE GAS CONSUMPTION: 999978069 - 12 -> 999978057 (CALLDATACOPY fee)
212logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 6
213logging.py 10 TRACE GAS CONSUMPTION: 999978057 - 3 -> 999978054 (PUSH1)
214logging.py 10 TRACE OPCODE: 0x61 (PUSH2) | pc: 8
215logging.py 10 TRACE GAS CONSUMPTION: 999978054 - 3 -> 999978051 (PUSH2)
216logging.py 10 TRACE OPCODE: 0x36 (CALLDATASIZE) | pc: 11
217logging.py 10 TRACE GAS CONSUMPTION: 999978051 - 2 -> 999978049 (CALLDATASIZE)
218logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 12
219logging.py 10 TRACE GAS CONSUMPTION: 999978049 - 3 -> 999978046 (PUSH1)
220logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 14
221logging.py 10 TRACE GAS CONSUMPTION: 999978046 - 3 -> 999978043 (PUSH1)
222logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 16
223logging.py 10 TRACE GAS CONSUMPTION: 999978043 - 3 -> 999978040 (PUSH1)
224logging.py 10 TRACE OPCODE: 0x5a (GAS) | pc: 18
225logging.py 10 TRACE GAS CONSUMPTION: 999978040 - 2 -> 999978038 (GAS)
226logging.py 10 TRACE OPCODE: 0xf2 (CALLCODE) | pc: 19
227logging.py 10 TRACE GAS CONSUMPTION: 999978038 - 700 -> 999977338 (CALLCODE)
228logging.py 10 TRACE MEMORY: size (128 -> 128) | cost (12 -> 12)
229logging.py 10 TRACE MEMORY: size (128 -> 1056) | cost (12 -> 101)
230logging.py 10 TRACE GAS CONSUMPTION: 999977338 - 89 -> 999977249 (Expanding memory 128 -> 1056)
231logging.py 10 TRACE GAS CONSUMPTION: 999977249 - 984352605 -> 15624644 (CALLCODE)
232logging.py 10 TRACE COMPUTATION STARTING: gas: 984352605 | from: 0x1000000000000000000000000000000000000000 | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth 1 | static: n
233logging.py 10 TRACE GAS CONSUMPTION: 984352605 - 23970528 -> 960382077 (MODEXP Precompile)
234logging.py 10 TRACE COMPUTATION SUCCESS: from: 0x1000000000000000000000000000000000000000 | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth: 1 | static: n | gas-used: 23970528 | gas-remaining: 960382077
235logging.py 10 TRACE GAS RETURNED: 15624644 + 960382077 -> 976006721
236logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 20
237logging.py 10 TRACE GAS CONSUMPTION: 976006721 - 3 -> 976006718 (PUSH1)
238logging.py 10 TRACE OPCODE: 0x55 (SSTORE) | pc: 22
239logging.py 10 TRACE GAS CONSUMPTION: 976006718 - 20000 -> 975986718 (SSTORE: 0x1000000000000000000000000000000000000000[1] -> 1 (0))
240logging.py 10 TRACE OPCODE: 0x61 (PUSH2) | pc: 23
241logging.py 10 TRACE GAS CONSUMPTION: 975986718 - 3 -> 975986715 (PUSH2)
242logging.py 10 TRACE OPCODE: 0x51 (MLOAD) | pc: 26
243logging.py 10 TRACE GAS CONSUMPTION: 975986715 - 3 -> 975986712 (MLOAD)
244logging.py 10 TRACE MEMORY: size (1056 -> 1056) | cost (101 -> 101)
245logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 27
246logging.py 10 TRACE GAS CONSUMPTION: 975986712 - 3 -> 975986709 (PUSH1)
247logging.py 10 TRACE OPCODE: 0x55 (SSTORE) | pc: 29
248logging.py 10 TRACE GAS CONSUMPTION: 975986709 - 5000 -> 975981709 (SSTORE: 0x1000000000000000000000000000000000000000[2] -> 0 (0))
249logging.py 10 TRACE OPCODE: 0x3d (RETURNDATASIZE) | pc: 30
250logging.py 10 TRACE GAS CONSUMPTION: 975981709 - 2 -> 975981707 (RETURNDATASIZE)
251logging.py 10 TRACE OPCODE: 0x60 (PUSH1) | pc: 31
252logging.py 10 TRACE GAS CONSUMPTION: 975981707 - 3 -> 975981704 (PUSH1)
253logging.py 10 TRACE OPCODE: 0x55 (SSTORE) | pc: 33
254logging.py 10 TRACE GAS CONSUMPTION: 975981704 - 5000 -> 975976704 (SSTORE: 0x1000000000000000000000000000000000000000[3] -> 999188 (4294967295))
255logging.py 10 TRACE OPCODE: 0x0 (STOP) | pc: 33
256logging.py 10 TRACE COMPUTATION SUCCESS: from: 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b | to: 0x1000000000000000000000000000000000000000 | value: 0 | depth: 0 | static: n | gas-used: 24001388 | gas-remaining: 975976704
257logging.py 10 TRACE TRANSACTION REFUND: 975976704 -> 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b
258logging.py 10 TRACE TRANSACTION FEE: 24023296 -> 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
259logging.py 10 TRACE Generating AccountDB trie
260======================================================================= 1 failed, 1 skipped, 82814 deselected in 14.95 seconds ========================================================================