Fix remaining tests not using chain_spec in method refactors

This commit is contained in:
nolash 2021-04-06 10:17:43 +02:00
parent 9e6bb2acb2
commit 40b2e66452
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
12 changed files with 18 additions and 20 deletions

View File

@ -61,8 +61,8 @@ def balance(tokens, holder_address, chain_spec_dict):
for t in tokens:
address = t['address']
token = ERC20Token(rpc, address)
c = ERC20()
token = ERC20Token(chain_spec, rpc, address)
c = ERC20(chain_spec)
o = c.balance_of(address, holder_address, sender_address=caller_address)
r = rpc.do(o)
t['balance_network'] = c.parse_balance(r)

View File

@ -171,6 +171,7 @@ def sync_tx(self, tx_hash_hex, chain_spec_dict):
except NotFoundEthException as e:
pass
# TODO: apply receipt in tx object to validate and normalize input
if rcpt != None:
success = rcpt['status'] == 1
logg.debug('sync tx {} mined block {} success {}'.format(tx_hash_hex, rcpt['blockNumber'], success))
@ -180,6 +181,7 @@ def sync_tx(self, tx_hash_hex, chain_spec_dict):
[
tx_hash_hex,
rcpt['blockNumber'],
rcpt['transactionIndex'],
not success,
],
queue=queue,

View File

@ -23,7 +23,7 @@ def translate_address(address, trusted_addresses, chain_spec, sender_address=ZER
registry = CICRegistry(chain_spec, rpc)
declarator_address = registry.by_name('AddressDeclarator', sender_address=sender_address)
c = AddressDeclarator()
c = AddressDeclarator(chain_spec)
for trusted_address in trusted_addresses:
o = c.declaration(declarator_address, trusted_address, address, sender_address=sender_address)

View File

@ -20,10 +20,10 @@ def set_sent(chain_spec_dict, tx_hash, fail=False):
@celery_app.task(base=CriticalSQLAlchemyTask)
def set_final(chain_spec_dict, tx_hash, block=None, fail=False):
def set_final(chain_spec_dict, tx_hash, block=None, tx_index=None, fail=False):
chain_spec = ChainSpec.from_dict(chain_spec_dict)
session = SessionBase.create_session()
r = chainqueue.state.set_final(chain_spec, tx_hash, block, fail, session=session)
r = chainqueue.state.set_final(chain_spec, tx_hash, block=block, tx_index=tx_index, fail=fail, session=session)
session.close()
return r

View File

@ -39,6 +39,7 @@ class TxFilter(SyncFilter):
self.chain_spec.asdict(),
add_0x(tx_hash_hex),
tx.block.number,
tx.index,
tx.status == Status.ERROR,
],
queue=self.queue,

View File

@ -80,7 +80,7 @@ straggler_delay = int(config.get('CIC_TX_RETRY_DELAY'))
# logg.debug('submitting tx {} for retry'.format(tx_hash))
# s_check = celery.signature(
# 'cic_eth.admin.ctrl.check_lock',
[
# [
# tx_hash,
# chain_str,
# LockEnum.QUEUE,

View File

@ -2,7 +2,7 @@ cic-base~=0.1.2a60
celery==4.4.7
crypto-dev-signer~=0.4.14a17
confini~=0.3.6rc3
cic-eth-registry~=0.5.4a11
cic-eth-registry~=0.5.4a12
#cic-bancor~=0.0.6
redis==3.5.3
alembic==1.4.2
@ -19,7 +19,7 @@ eth-address-index~=0.1.1a7
chainlib~=0.0.2a4
hexathon~=0.0.1a7
chainsyncer~=0.0.1a21
chainqueue~=0.0.1a5
chainqueue~=0.0.1a6
pysha3==1.0.2
coincurve==15.0.0
sarafu-faucet~=0.0.2a16

View File

@ -38,11 +38,12 @@ def test_transfer_api(
agent_roles,
cic_registry,
register_tokens,
register_lookups,
celery_session_worker,
):
#token = CICRegistry.get_address(default_chain_spec, bancor_tokens[0])
foo_token_cache = ERC20Token(eth_rpc, foo_token)
foo_token_cache = ERC20Token(default_chain_spec, eth_rpc, foo_token)
api = Api(str(default_chain_spec), callback_param='transfer', callback_task='cic_eth.callbacks.noop.noop', queue=None)
t = api.transfer(custodial_roles['FOO_TOKEN_GIFTER'], agent_roles['ALICE'], 1024, foo_token_cache.symbol)

View File

@ -116,7 +116,7 @@ def test_register_account(
init_eth_tester.mine_block()
c = AccountRegistry()
c = AccountRegistry(default_chain_spec)
o = c.have(account_registry, eth_empty_accounts[0], sender_address=call_sender)
r = eth_rpc.do(o)
assert int(strip_0x(r), 16) == 1

View File

@ -43,7 +43,7 @@ def test_filter_process(
nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc)
init_eth_tester.mine_blocks(13)
c = ERC20(signer=eth_signer, nonce_oracle=nonce_oracle)
c = ERC20(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle)
(tx_hash_hex, o) = c.transfer(foo_token, agent_roles['ALICE'], agent_roles['BOB'], 1024)
eth_rpc.do(o)
o = receipt(tx_hash_hex)
@ -56,7 +56,7 @@ def test_filter_process(
# external tx
init_eth_tester.mine_blocks(28)
c = ERC20(signer=eth_signer, nonce_oracle=nonce_oracle)
c = ERC20(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle)
(tx_hash_hex, o) = c.transfer(foo_token, agent_roles['ALICE'], agent_roles['BOB'], 512)
eth_rpc.do(o)
o = receipt(tx_hash_hex)

View File

@ -57,8 +57,8 @@ WORKDIR /home/grassroots
USER grassroots
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
ARG cic_base_version=0.1.2a60
ARG cic_eth_version=0.11.0a4
ARG cic_base_version=0.1.2a61
ARG cic_eth_version=0.11.0a5
ARG sarafu_faucet_version=0.0.2a16
ARG cic_contracts_version=0.0.2a2
RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \

View File

@ -124,10 +124,6 @@ def register_eth(i, u):
return address
def register_ussd(u):
pass
if __name__ == '__main__':
#fi = open(os.path.join(user_out_dir, 'addresses.csv'), 'a')
@ -155,8 +151,6 @@ if __name__ == '__main__':
sub_chain_str = '{}:{}'.format(chain_spec.common_name(), chain_spec.network_id())
u.identities['evm'][sub_chain_str] = [new_address]
register_ussd(u)
new_address_clean = strip_0x(new_address)
filepath = os.path.join(
user_new_dir,