From e698f51c84ef5c5a77dac84d9a5abc2e1e6eb161 Mon Sep 17 00:00:00 2001 From: nolash Date: Mon, 22 Mar 2021 17:59:36 +0100 Subject: [PATCH] Add receipt waits to all runnables --- python/eth_address_declarator/runnable/add.py | 13 ++++++++----- .../eth_address_declarator/runnable/deploy.py | 19 +++++++++---------- python/eth_token_index/runnable/add.py | 13 +++++-------- python/eth_token_index/runnable/deploy.py | 19 +++++++++---------- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/python/eth_address_declarator/runnable/add.py b/python/eth_address_declarator/runnable/add.py index ad9bd53..6985e9a 100644 --- a/python/eth_address_declarator/runnable/add.py +++ b/python/eth_address_declarator/runnable/add.py @@ -49,6 +49,9 @@ if args.vv: elif args.v: logg.setLevel(logging.INFO) +block_last = args.w +block_all = args.ww + passphrase_env = 'ETH_PASSPHRASE' if args.env_prefix != None: passphrase_env = args.env_prefix + '_' + passphrase_env @@ -81,11 +84,11 @@ def main(): c = AddressDeclarator(signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=chain_id) (tx_hash_hex, o) = c.add_declaration(contract_address, signer_address, subject_address, declaration) rpc.do(o) - o = receipt(tx_hash_hex) - r = rpc.do(o) - if r['status'] == 0: - sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') - sys.exit(1) + if block_last: + r = rpc.wait(tx_hash_hex) + if r['status'] == 0: + sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') + sys.exit(1) print(tx_hash_hex) diff --git a/python/eth_address_declarator/runnable/deploy.py b/python/eth_address_declarator/runnable/deploy.py index 8a0b11b..19eee5f 100644 --- a/python/eth_address_declarator/runnable/deploy.py +++ b/python/eth_address_declarator/runnable/deploy.py @@ -80,18 +80,17 @@ def main(): c = AddressDeclarator(signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=chain_id) (tx_hash_hex, o) = c.constructor(signer_address, initial_description) rpc.do(o) - o = receipt(tx_hash_hex) - r = rpc.do(o) - if r['status'] == 0: - sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') - sys.exit(1) - # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) - address = r['contractAddress'] - if block_last: - rpc.wait(tx_hash_hex) + r = rpc.wait(tx_hash_hex) + if r['status'] == 0: + sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') + sys.exit(1) + # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) + address = r['contractAddress'] - print(address) + print(address) + else: + print(tx_hash_hex) sys.exit(0) diff --git a/python/eth_token_index/runnable/add.py b/python/eth_token_index/runnable/add.py index 6d781b5..1abb922 100644 --- a/python/eth_token_index/runnable/add.py +++ b/python/eth_token_index/runnable/add.py @@ -83,20 +83,17 @@ def main(): c = TokenUniqueSymbolIndex(signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=chain_id) (tx_hash_hex, o) = c.register(contract_address, signer_address, token_address) rpc.do(o) - o = receipt(tx_hash_hex) - r = rpc.do(o) - if r['status'] == 0: - sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') - sys.exit(1) + if block_last: + r = rpc.wait(tx_hash_hex) + if r['status'] == 0: + sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') + sys.exit(1) c = ERC20() o = c.symbol(token_address) r = rpc.do(o) token_symbol = ERC20.parse_symbol(r) - if block_last: - helper.wait_for() - logg.info('added token {} at {} to token index {}'.format(token_symbol, token_address, contract_address)) print(tx_hash_hex) diff --git a/python/eth_token_index/runnable/deploy.py b/python/eth_token_index/runnable/deploy.py index ea5a4bc..22eb1d9 100644 --- a/python/eth_token_index/runnable/deploy.py +++ b/python/eth_token_index/runnable/deploy.py @@ -78,18 +78,17 @@ def main(): c = TokenUniqueSymbolIndex(signer=signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=chain_id) (tx_hash_hex, o) = c.constructor(signer_address) rpc.do(o) - o = receipt(tx_hash_hex) - r = rpc.do(o) - if r['status'] == 0: - sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') - sys.exit(1) - # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) - address = r['contractAddress'] - if block_last: - rpc.wait(tx_hash_hex) + r = rpc.wait(tx_hash_hex) + if r['status'] == 0: + sys.stderr.write('EVM revert while deploying contract. Wish I had more to tell you') + sys.exit(1) + # TODO: pass through translator for keys (evm tester uses underscore instead of camelcase) + address = r['contractAddress'] - print(address) + print(address) + else: + print(tx_hash_hex) sys.exit(0)