Skip to content

Commit

Permalink
Fix tool.deploy compilation
Browse files Browse the repository at this point in the history
- fixes compilation for deploy script
- also changes 'pending' to 'latest' when obtaining block number in
  `gasLimit()` method
  (parity "bug". See: openethereum/parity-ethereum#8703)
  • Loading branch information
pcppcp committed May 31, 2018
1 parent 6ae3fc3 commit b281e6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
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

0 comments on commit b281e6e

Please sign in to comment.