Uncomment gas tests
This commit is contained in:
parent
1f425bead8
commit
bc688ffad2
@ -39,178 +39,178 @@ from cic_eth.error import OutOfGasError
|
|||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
#def test_task_check_gas_ok(
|
def test_task_check_gas_ok(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# eth_rpc,
|
eth_rpc,
|
||||||
# eth_signer,
|
eth_signer,
|
||||||
# init_database,
|
init_database,
|
||||||
# agent_roles,
|
agent_roles,
|
||||||
# custodial_roles,
|
custodial_roles,
|
||||||
# celery_session_worker,
|
celery_session_worker,
|
||||||
# ):
|
):
|
||||||
#
|
|
||||||
# rpc = RPCConnection.connect(default_chain_spec, 'default')
|
rpc = RPCConnection.connect(default_chain_spec, 'default')
|
||||||
# nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], conn=eth_rpc)
|
nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], conn=eth_rpc)
|
||||||
# gas_oracle = OverrideGasOracle(price=1000000000, limit=21000)
|
gas_oracle = OverrideGasOracle(price=1000000000, limit=21000)
|
||||||
# c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
||||||
# (tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
||||||
#
|
|
||||||
# queue_create(
|
queue_create(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# 0,
|
0,
|
||||||
# agent_roles['ALICE'],
|
agent_roles['ALICE'],
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# session=init_database,
|
session=init_database,
|
||||||
# )
|
)
|
||||||
# cache_gas_data(
|
cache_gas_data(
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# )
|
)
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# s = celery.signature(
|
s = celery.signature(
|
||||||
# 'cic_eth.eth.gas.check_gas',
|
'cic_eth.eth.gas.check_gas',
|
||||||
# [
|
[
|
||||||
# [
|
[
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# ],
|
],
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# [],
|
[],
|
||||||
# None,
|
None,
|
||||||
# 8000000,
|
8000000,
|
||||||
# ],
|
],
|
||||||
# queue=None
|
queue=None
|
||||||
# )
|
)
|
||||||
# t = s.apply_async()
|
t = s.apply_async()
|
||||||
# t.get_leaf()
|
t.get_leaf()
|
||||||
# assert t.successful()
|
assert t.successful()
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
||||||
# assert tx['status'] & StatusBits.QUEUED == StatusBits.QUEUED
|
assert tx['status'] & StatusBits.QUEUED == StatusBits.QUEUED
|
||||||
#
|
|
||||||
#
|
|
||||||
#def test_task_check_gas_insufficient(
|
def test_task_check_gas_insufficient(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# eth_rpc,
|
eth_rpc,
|
||||||
# eth_signer,
|
eth_signer,
|
||||||
# init_database,
|
init_database,
|
||||||
# agent_roles,
|
agent_roles,
|
||||||
# custodial_roles,
|
custodial_roles,
|
||||||
# celery_session_worker,
|
celery_session_worker,
|
||||||
# whoever,
|
whoever,
|
||||||
# ):
|
):
|
||||||
#
|
|
||||||
# rpc = RPCConnection.connect(default_chain_spec, 'default')
|
rpc = RPCConnection.connect(default_chain_spec, 'default')
|
||||||
# nonce_oracle = OverrideNonceOracle(whoever, 42)
|
nonce_oracle = OverrideNonceOracle(whoever, 42)
|
||||||
# gas_oracle = OverrideGasOracle(price=1000000000, limit=21000)
|
gas_oracle = OverrideGasOracle(price=1000000000, limit=21000)
|
||||||
# c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
||||||
# (tx_hash_hex, tx_signed_raw_hex) = c.create(whoever, agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.create(whoever, agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
||||||
#
|
|
||||||
# queue_create(
|
queue_create(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# 42,
|
42,
|
||||||
# whoever,
|
whoever,
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# session=init_database,
|
session=init_database,
|
||||||
# )
|
)
|
||||||
# cache_gas_data(
|
cache_gas_data(
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# )
|
)
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# s = celery.signature(
|
s = celery.signature(
|
||||||
# 'cic_eth.eth.gas.check_gas',
|
'cic_eth.eth.gas.check_gas',
|
||||||
# [
|
[
|
||||||
# [
|
[
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# ],
|
],
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# [],
|
[],
|
||||||
# None,
|
None,
|
||||||
# None,
|
None,
|
||||||
# ],
|
],
|
||||||
# queue=None
|
queue=None
|
||||||
# )
|
)
|
||||||
# t = s.apply_async()
|
t = s.apply_async()
|
||||||
# try:
|
try:
|
||||||
# r = t.get_leaf()
|
r = t.get_leaf()
|
||||||
# except OutOfGasError:
|
except OutOfGasError:
|
||||||
# pass
|
pass
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
||||||
# assert tx['status'] & StatusBits.GAS_ISSUES == StatusBits.GAS_ISSUES
|
assert tx['status'] & StatusBits.GAS_ISSUES == StatusBits.GAS_ISSUES
|
||||||
#
|
|
||||||
#
|
|
||||||
#def test_task_check_gas_low(
|
def test_task_check_gas_low(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# eth_rpc,
|
eth_rpc,
|
||||||
# eth_signer,
|
eth_signer,
|
||||||
# init_database,
|
init_database,
|
||||||
# agent_roles,
|
agent_roles,
|
||||||
# custodial_roles,
|
custodial_roles,
|
||||||
# celery_session_worker,
|
celery_session_worker,
|
||||||
# whoever,
|
whoever,
|
||||||
# ):
|
):
|
||||||
#
|
|
||||||
# gas_oracle = OverrideGasOracle(price=MINIMUM_FEE_PRICE, limit=MINIMUM_FEE_UNITS)
|
gas_oracle = OverrideGasOracle(price=MINIMUM_FEE_PRICE, limit=MINIMUM_FEE_UNITS)
|
||||||
# nonce_oracle = RPCNonceOracle(custodial_roles['GAS_GIFTER'], conn=eth_rpc)
|
nonce_oracle = RPCNonceOracle(custodial_roles['GAS_GIFTER'], conn=eth_rpc)
|
||||||
# c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
||||||
# (tx_hash_hex, o) = c.create(custodial_roles['GAS_GIFTER'], whoever, 100 * (10 ** 6))
|
(tx_hash_hex, o) = c.create(custodial_roles['GAS_GIFTER'], whoever, 100 * (10 ** 6))
|
||||||
# r = eth_rpc.do(o)
|
r = eth_rpc.do(o)
|
||||||
#
|
|
||||||
# rpc = RPCConnection.connect(default_chain_spec, 'default')
|
rpc = RPCConnection.connect(default_chain_spec, 'default')
|
||||||
# nonce_oracle = RPCNonceOracle(whoever, conn=eth_rpc)
|
nonce_oracle = RPCNonceOracle(whoever, conn=eth_rpc)
|
||||||
# c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
||||||
# (tx_hash_hex, tx_signed_raw_hex) = c.create(whoever, agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.create(whoever, agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
||||||
#
|
|
||||||
# queue_create(
|
queue_create(
|
||||||
# default_chain_spec,
|
default_chain_spec,
|
||||||
# 0,
|
0,
|
||||||
# whoever,
|
whoever,
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# session=init_database,
|
session=init_database,
|
||||||
# )
|
)
|
||||||
# cache_gas_data(
|
cache_gas_data(
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# tx_signed_raw_hex,
|
tx_signed_raw_hex,
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# )
|
)
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# s = celery.signature(
|
s = celery.signature(
|
||||||
# 'cic_eth.eth.gas.check_gas',
|
'cic_eth.eth.gas.check_gas',
|
||||||
# [
|
[
|
||||||
# [
|
[
|
||||||
# tx_hash_hex,
|
tx_hash_hex,
|
||||||
# ],
|
],
|
||||||
# default_chain_spec.asdict(),
|
default_chain_spec.asdict(),
|
||||||
# ],
|
],
|
||||||
# [],
|
[],
|
||||||
# None,
|
None,
|
||||||
# None,
|
None,
|
||||||
# queue=None
|
queue=None
|
||||||
# )
|
)
|
||||||
# t = s.apply_async()
|
t = s.apply_async()
|
||||||
# t.get_leaf()
|
t.get_leaf()
|
||||||
# assert t.successful()
|
assert t.successful()
|
||||||
#
|
|
||||||
# init_database.commit()
|
init_database.commit()
|
||||||
#
|
|
||||||
# tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
tx = get_tx(default_chain_spec, tx_hash_hex, session=init_database)
|
||||||
# assert tx['status'] & StatusBits.QUEUED == StatusBits.QUEUED
|
assert tx['status'] & StatusBits.QUEUED == StatusBits.QUEUED
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
Loading…
Reference in New Issue
Block a user