valory-xyz/trader-quickstart

[Staking] FeeTooLow error when activating the on-chain service

Closed this issue · 8 comments

The following error "FeeTooLow" appeared on a fresh run of a service with staking, just after transferring 25 OLAS to the operator address.

This error seems to have been originated by the poetry run autonomy service activate run with staking, so possibly the fix should be done on the Open Autonomy repository.

It required 3 attempts to activate the service correctly.

ATTEMPT 1:

[Service owner] Activating registration for on-chain service [SERVICE_ID]...
Checking balance of operator's address (minimum required 25.0000 OLAS):
  - Address: [ADDRESS]
  - Balance: 0.0000 OLAS

    Please, fund address [ADDRESS] with at least 25.0000.
    Waiting...   

  - Updated balance: 25.0000 OLAS
    OK.

[2023-11-14 18:20:19,436][WARNING] Unable to send transaction: {'code': -32010, 'message': 'FeeTooLow, EffectivePriorityFeePerGas too low 595038728 < 1000000000, BaseFee: 14135311314'}
Traceback (most recent call last):
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/bin/autonomy", line 8, in <module>
    sys.exit(cli())
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1126, in __call__
    return self.main(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1051, in main
    rv = self.invoke(ctx)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1393, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/service.py", line 79, in _activate
    ).activate_service()
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/helpers/chain.py", line 709, in activate_service
    self.approve_erc20_usage(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/helpers/chain.py", line 685, in approve_erc20_usage
    approve_erc20_usage(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/chain/service.py", line 204, in approve_erc20_usage
    tx_receipt = transact(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/chain/mint.py", line 74, in transact
    return ledger_api.api.eth.get_transaction_receipt(tx_digest)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/eth/eth.py", line 460, in get_transaction_receipt
    return self._transaction_receipt(transaction_hash)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/module.py", line 64, in caller
    (method_str, params), response_formatters = method.process_params(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/method.py", line 214, in process_params
    _apply_request_formatters(params, self.request_formatters(method)),
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/functional.py", line 45, in inner
    return callback(fn(*args, **kwargs))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/method.py", line 55, in _apply_request_formatters
    formatted_params = pipe(params, request_formatters)
  File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 746, in map_abi_data
    return pipe(data, *pipeline)
  File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 781, in data_tree_map
    return recursive_map(map_to_typed_data, data_tree)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 84, in recursive_map
    items_mapped = map_collection(recurse, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 68, in map_collection
    return datatype(map(func, collection))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 82, in recurse
    return recursive_map(func, item)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 85, in recursive_map
    return func(items_mapped)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 777, in map_to_typed_data
    return ABITypedData(func(*elements))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 80, in wrapper
    modified = to_wrap(type_str, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 135, in new_normalizer
    return old_normalizer(abi_type, type_str, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 148, in abi_bytes_to_hex
    bytes_data = hexstr_if_str(to_bytes, data)
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/encoding.py", line 178, in hexstr_if_str
    return to_type(primitive, hexstr=hexstr)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/decorators.py", line 70, in wrapper
    _assert_one_val(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/decorators.py", line 33, in _assert_one_val
    raise TypeError(
TypeError: Exactly one of the passed values can be specified. Instead, values were: (None,), {'hexstr': None}

ATTEMPT 2:

[Service owner] Activating registration for on-chain service [SERVICE_ID]...
Checking balance of operator's address (minimum required 25.0000 OLAS):
  - Address: [ADDRESS]
  - Balance: 25.0000 OLAS
    OK.

[2023-11-14 18:39:22,729][WARNING] Unable to send transaction: {'code': -32010, 'message': 'FeeTooLow, EffectivePriorityFeePerGas too low 0 < 1000000000, BaseFee: 14025038534'}
Traceback (most recent call last):
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/bin/autonomy", line 8, in <module>
    sys.exit(cli())
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1126, in __call__
    return self.main(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1051, in main
    rv = self.invoke(ctx)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 1393, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/click/core.py", line 752, in invoke
    return __callback(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/service.py", line 79, in _activate
    ).activate_service()
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/helpers/chain.py", line 709, in activate_service
    self.approve_erc20_usage(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/cli/helpers/chain.py", line 685, in approve_erc20_usage
    approve_erc20_usage(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/chain/service.py", line 204, in approve_erc20_usage
    tx_receipt = transact(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/autonomy/chain/mint.py", line 74, in transact
    return ledger_api.api.eth.get_transaction_receipt(tx_digest)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/eth/eth.py", line 460, in get_transaction_receipt
    return self._transaction_receipt(transaction_hash)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/module.py", line 64, in caller
    (method_str, params), response_formatters = method.process_params(
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/method.py", line 214, in process_params
    _apply_request_formatters(params, self.request_formatters(method)),
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/functional.py", line 45, in inner
    return callback(fn(*args, **kwargs))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/method.py", line 55, in _apply_request_formatters
    formatted_params = pipe(params, request_formatters)
  File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 746, in map_abi_data
    return pipe(data, *pipeline)
  File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 781, in data_tree_map
    return recursive_map(map_to_typed_data, data_tree)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 84, in recursive_map
    items_mapped = map_collection(recurse, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 68, in map_collection
    return datatype(map(func, collection))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 82, in recurse
    return recursive_map(func, item)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/decorators.py", line 30, in wrapped
    wrapped_val = to_wrap(*args)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/formatters.py", line 85, in recursive_map
    return func(items_mapped)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/abi.py", line 777, in map_to_typed_data
    return ABITypedData(func(*elements))
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 80, in wrapper
    modified = to_wrap(type_str, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 135, in new_normalizer
    return old_normalizer(abi_type, type_str, data)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/normalizers.py", line 148, in abi_bytes_to_hex
    bytes_data = hexstr_if_str(to_bytes, data)
  File "cytoolz/functoolz.pyx", line 267, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 263, in cytoolz.functoolz.curry.__call__
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/web3/_utils/encoding.py", line 178, in hexstr_if_str
    return to_type(primitive, hexstr=hexstr)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/decorators.py", line 70, in wrapper
    _assert_one_val(*args, **kwargs)
  File "/home/user1/.cache/pypoetry/virtualenvs/trader-I2NvlnQ5-py3.10/lib/python3.10/site-packages/eth_utils/decorators.py", line 33, in _assert_one_val
    raise TypeError(
TypeError: Exactly one of the passed values can be specified. Instead, values were: (None,), {'hexstr': None}

ATTEMPT 3:
Successfully activated the service.

@angrybayblade and @0xArdi please provide some input. Did we hardcode some gas values or is this due to fast changes in gas prices?

The gas prices are not hardcoded, The txs are build using ledger_api.build_transaction method which updates the gas prices automatically

0xArdi commented

I've seen it before, it tends to happen a bit more often on gnosis. It's the quick price changes, would be good to have some retry by default for this particular case.

Alright, I'll start working on a retry mechanism

Can confirm I also just experienced the same issue @jmoreira-valory . I agree with @0xArdi that it is likely the intense gas price swings there (relatively speaking to the overall low gas costs). I propose not only doing a re-try but maybe also looking into whether we should apply just a higher max gas by default? I.e. multiply whatever the RPC produces by some factor?

I also had this issue - not sure if related:

Screenshot 2023-11-15 at 11 24 05
0xArdi commented

@DavidMinarsch its of the same nature, and should be handled in the same way. @angrybayblade could we also handle this.

0xArdi commented

The following is also the same as the one reported by @DavidMinarsch :

ValueError: {'code': -32000, 'message': 'INTERNAL_ERROR: nonce too low'}