Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 1993049

Browse files
committed
Changed test format
1 parent 3d3fb19 commit 1993049

File tree

10 files changed

+129075
-12
lines changed

10 files changed

+129075
-12
lines changed

ethereum/tools/tester2.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 = accounts[:10]
2323

2424
base_alloc = {}
25+
minimal_alloc = {}
2526
for a in accounts:
2627
base_alloc[a] = {'balance': 10**18}
27-
for i in range(16):
28+
for i in range(8):
2829
base_alloc[int_to_addr(i)] = {'balance': 1}
30+
minimal_alloc[int_to_addr(i)] = {'balance': 1}
31+
minimal_alloc[accounts[0]] = {'balance': 10**18}
2932

3033
# Initialize languages
3134
languages = {}
@@ -190,7 +193,7 @@ def mk_state_test_prefill(c):
190193
pre = c.head_state.to_dict()
191194
return {"env": env, "pre": pre}
192195

193-
def mk_state_test_postfill(c, prefill):
196+
def mk_state_test_postfill(c, prefill, filler_mode=False):
194197
txdata = c.last_tx.to_dict()
195198
modified_tx_data = {
196199
"data": [ txdata["data"] ],
@@ -213,9 +216,13 @@ def mk_state_test_postfill(c, prefill):
213216
config = 'Metropolis'
214217
else:
215218
raise Exception("Cannot get config")
216-
return {
219+
o = {
217220
"env": prefill["env"],
218221
"pre": prefill["pre"],
219222
"transaction": modified_tx_data,
220-
"post": {config: [ { "hash": postStateHash, "indexes": {"data": 0, "gas": 0, "value": 0} } ] }
221223
}
224+
if not filler_mode:
225+
o["post"] = {config: [ { "hash": postStateHash, "indexes": {"data": 0, "gas": 0, "value": 0} } ] }
226+
else:
227+
o["expect"] = [ {"indexes": {"data": 0, "gas": 0, "value": 0}, "network": ["Metropolis"], "result": c.head_state.to_dict() } ]
228+
return o

0 commit comments

Comments
 (0)