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

Commit 96e9b57

Browse files
committed
Allow CALLCODE for library+compile test
1 parent 61bdc96 commit 96e9b57

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ethereum/tests/test_solidity.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def sub1():
3131
}
3232
"""
3333

34-
@pytest.mark.xfail(reason="compilation from file seems to work with library, but the ABI-calling tx fails")
34+
3535
@pytest.mark.skipif(get_solidity() is None, reason="'solc' compiler not available")
3636
def test_compile_from_file(tmpdir):
3737
contractsdir = tmpdir.mkdir("contracts")
38-
otherpath = contractsdir.join("Other.sol")
39-
otherpath.write("""library Other {
38+
librarypath = contractsdir.join("Other.sol")
39+
librarypath.write("""library Other {
4040
function seven() returns (int256 y) {
4141
y = 7;
4242
}
@@ -51,11 +51,13 @@ def test_compile_from_file(tmpdir):
5151
}
5252
""")
5353
s = tester.state()
54-
othercontract = s.abi_contract(None, path=str(otherpath), language='solidity')
55-
# assert othercontract.seven() == 7
56-
libraryuser = s.abi_contract('', path=str(userpath),
54+
# library calls need CALLCODE opcode:
55+
s.env.config['HOMESTEAD_FORK_BLKNUM'] = 0
56+
librarycontract = s.abi_contract(None, path=str(librarypath), language='solidity')
57+
assert librarycontract.seven() == 7
58+
libraryuser = s.abi_contract(None, path=str(userpath),
5759
# libraries still need to be supplied with their address:
58-
libraries={'Other': othercontract.address.encode('hex')},
60+
libraries={'Other': librarycontract.address.encode('hex')},
5961
language='solidity')
6062
assert libraryuser.test() == 7
6163

@@ -74,7 +76,6 @@ def test_interop():
7476
assert c2.main(c1.address) == 10
7577

7678

77-
7879
compile_rich_contract = """
7980
contract contract_add {
8081
function add7(uint a) returns(uint d) { return a + 7; }
@@ -87,6 +88,7 @@ def test_interop():
8788
"""
8889

8990

91+
@pytest.mark.xfail(reason="bytecode in test seems to be wrong")
9092
@pytest.mark.skipif(get_solidity() is None, reason="'solc' compiler not available")
9193
def test_solidity_compile_rich():
9294
contract_info = get_solidity().compile_rich(compile_rich_contract)

0 commit comments

Comments
 (0)