Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Fixes solidity warnings #227

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyethapp/console_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def block_from_rlp(this, rlp_data):
return TransientBlock.init_from_rlp(l).to_block()

try:
from ethereum._solidity import solc_wrapper
from ethereum.tools._solidity import solc_wrapper
except ImportError:
solc_wrapper = None
pass
Expand Down
4 changes: 2 additions & 2 deletions pyethapp/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ def compilers(self):
except ImportError:
pass
try:
import ethereum._solidity
s = ethereum._solidity.get_solidity()
import ethereum.tools._solidity
s = ethereum.tools._solidity.get_solidity()
if s:
self.compilers_['solidity'] = s.compile_rich
else:
Expand Down
13 changes: 9 additions & 4 deletions pyethapp/tests/test_console_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,19 @@ def test_console_name_reg_contract(test_app):
}
"""

import ethereum.tools._solidity
solidity = ethereum.tools._solidity.get_solidity()
from ethereum.tools import _solidity
solidity = _solidity.get_solidity()
if solidity is None:
pytest.xfail("solidity not installed, not tested")
else:
# create the NameReg contract
tx_to = b''
evm_code = solidity.compile(solidity_code)
filepath = None
contract_name = 'NameReg'
compiled = _solidity.compile_code(
solidity_code,
combined='bin,abi')
evm_code = _solidity.solidity_get_contract_data(compiled, filepath, contract_name)['bin']
chainservice = test_app.services.chain
chain = test_app.services.chain.chain
hc_state = State(chainservice.head_candidate.state_root, chain.env)
Expand All @@ -200,7 +205,7 @@ def test_console_name_reg_contract(test_app):
assert code != '0x'

# interact with the NameReg contract
abi = solidity.mk_full_signature(solidity_code)
abi = _solidity.solidity_get_contract_data(compiled, filepath, contract_name)['abi']
namereg = eth.new_contract(abi, creates, sender=sender)

register_tx = namereg.register('alice', startgas=90000, gasprice=50 * 10**9)
Expand Down
16 changes: 12 additions & 4 deletions pyethapp/tests/test_jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ def test_compile_solidity():
with open(path.join(path.dirname(__file__), 'contracts', 'multiply.sol')) as handler:
solidity_code = handler.read()

solidity = ethereum._solidity.get_solidity() # pylint: disable=protected-access

abi = solidity.mk_full_signature(solidity_code)
code = data_encoder(solidity.compile(solidity_code))
filepath = None
contract_name = 'test'
compiled = _solidity.compile_code(
solidity_code,
combined='bin,abi')
# well it seems we could also access it directly using:
# compiled['test']['abi']
abi = _solidity.solidity_get_contract_data(compiled, filepath, contract_name)['abi']
# compiled['test']['bin_hex']
code = _solidity.solidity_get_contract_data(compiled, filepath, contract_name)['bin_hex']
# add the "0x" prefix to keep consistency with compileSolidity()
code = "0x" + code

info = {
'abiDefinition': abi,
Expand Down