Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tool.deploy compilation #1474

Merged
merged 1 commit into from
Jun 2, 2018
Merged
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 raiden/network/rpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def balance(self, account: Address):
""" Return the balance of the account of given address. """
return self.web3.eth.getBalance(to_checksum_address(account), 'pending')

def _gaslimit(self, location='pending') -> int:
def _gaslimit(self, location='latest') -> int:
gas_limit = self.web3.eth.getBlock(location)['gasLimit']
return gas_limit * 8 // 10

Expand Down
6 changes: 5 additions & 1 deletion raiden/utils/solc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ def compile_files_cwd(*args, **kwargs):
name conflicts"""
# get root directory of the contracts
compile_wd = os.path.commonprefix(args[0])
# edge case - compiling a single file
if os.path.isfile(compile_wd):
compile_wd = os.path.dirname(compile_wd)
# remove prefix from the files
if compile_wd[-1] is not '/':
compile_wd += '/'
file_list = [
x.replace(compile_wd + '/', '')
x.replace(compile_wd, '')
for x in args[0]
]
cwd = os.getcwd()
Expand Down
17 changes: 5 additions & 12 deletions tools/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ def name_from_file(filename):
return os.path.split(filename)[-1].partition('.')[0]


def allcontracts(contract_files):
return {
"{}:{}".format(c, name_from_file(c)): compile_files_cwd(
get_contract_path(c),
name_from_file(c),
optimize=False
)
for c in contract_files
}


def deploy_file(contract, compiled_contracts, client):
libraries = dict()
filename, _, name = contract.partition(":")
Expand All @@ -109,7 +98,11 @@ def deploy_file(contract, compiled_contracts, client):


def deploy_all(client):
compiled_contracts = allcontracts(RAIDEN_CONTRACT_FILES)
contracts_expanded = [
get_contract_path(x)
for x in RAIDEN_CONTRACT_FILES
]
compiled_contracts = compile_files_cwd(contracts_expanded)
deployed = {}
for contract in CONTRACTS_TO_DEPLOY:
deployed.update(deploy_file(contract, compiled_contracts, client))
Expand Down