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

Commit b449ef9

Browse files
committed
Remove xfail from compile_rich() test
Solidity bytecode won't be compatible between versions at the moment. No need to check for accuracy of hex, just check for generation.
1 parent 3f96119 commit b449ef9

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

ethereum/tests/test_solidity.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
CONTRACTS_DIR = path.join(path.dirname(__file__), 'contracts')
1515

1616

17+
def bytecode_is_generated(cinfo, cname):
18+
return 'code' in cinfo[cname] and len(cinfo[cname]['code']) > 10
19+
1720
@pytest.mark.skipif(not SOLIDITY_AVAILABLE, reason='solc compiler not available')
1821
def test_library_from_file():
1922
state = tester.state()
@@ -188,7 +191,6 @@ def test_constructor():
188191
assert contract.getValue() == 2
189192

190193

191-
@pytest.mark.xfail(reason='bytecode in test seems to be wrong')
192194
@pytest.mark.skipif(not SOLIDITY_AVAILABLE, reason='solc compiler not available')
193195
def test_solidity_compile_rich():
194196
compile_rich_contract = """
@@ -211,22 +213,9 @@ def test_solidity_compile_rich():
211213
'language', 'languageVersion', 'abiDefinition', 'source',
212214
'compilerVersion', 'developerDoc', 'userDoc'
213215
}
214-
assert contract_info['contract_add']['code'] == (
215-
'0x606060405260ad8060116000396000f30060606040526000357c0100000000000000'
216-
'00000000000000000000000000000000000000000090048063651ae239146041578063'
217-
'cb02919f14606657603f565b005b6050600480359060200150608b565b604051808281'
218-
'5260200191505060405180910390f35b6075600480359060200150609c565b60405180'
219-
'82815260200191505060405180910390f35b60006007820190506097565b919050565b'
220-
'6000602a8201905060a8565b91905056'
221-
)
222-
assert contract_info['contract_sub']['code'] == (
223-
'0x606060405260ad8060116000396000f30060606040526000357c0100000000000000'
224-
'0000000000000000000000000000000000000000009004806361752024146041578063'
225-
'7aaef1a014606657603f565b005b6050600480359060200150608b565b604051808281'
226-
'5260200191505060405180910390f35b6075600480359060200150609c565b60405180'
227-
'82815260200191505060405180910390f35b60006007820390506097565b919050565b'
228-
'6000602a8203905060a8565b91905056'
229-
)
216+
assert bytecode_is_generated(contract_info, 'contract_add')
217+
assert bytecode_is_generated(contract_info, 'contract_sub')
218+
230219
assert {
231220
defn['name']
232221
for defn
@@ -285,10 +274,10 @@ def test_extra_args():
285274
src,
286275
extra_args="--optimize-runs 100"
287276
)
288-
assert 'code' in contract_info['foo']
277+
assert bytecode_is_generated(contract_info, 'foo')
289278

290279
contract_info = get_solidity().compile_rich(
291280
src,
292281
extra_args=["--optimize-runs", "100"]
293282
)
294-
assert 'code' in contract_info['foo']
283+
assert bytecode_is_generated(contract_info, 'foo')

0 commit comments

Comments
 (0)