# Buggy code
def _get_node_interface(self, endpoint: str) -> SubstrateInterface:
    """Get an instance of SubstrateInterface, a specialized class in
    interfacing with a Substrate node that deals with SCALE encoding/decoding,
    metadata parsing, type registry management and versioning of types.

    May raise (most common):
    - RemoteError: from RequestException, problems requesting the url.
    - FileNotFound: via `load_type_registry_preset()` if it doesn't exist
    a preset file for the given `type_registry_preset` argument.
    - ValueError and TypeError: invalid constructor arguments.
    """
    si_attributes = self.chain.substrate_interface_attributes()
    try:
        node_interface = SubstrateInterface(
            url=endpoint,
            type_registry_preset=si_attributes.type_registry_preset,
        )
    except requests.exceptions.RequestException as e:
        message = (
            f"{self.chain} could not connect to node at endpoint: {endpoint}. "
            f"Connection error: {str(e)}.",
        )
        log.error(message)
        raise RemoteError(message) from e
    except (FileNotFoundError, ValueError, TypeError) as e:
        raise AttributeError("Invalid SubstrateInterface instantiation") from e

    return node_interface


# Traceback (ValueError)
2021-01-17T09:45:53.929Z: Starting packaged python subprocess: /tmp/lefteris/.mount_rotki-bd0Awo/resources/rotkehlchen_py_dist/rotkehlchen-1.12.1-linux --api-port 4242 --loglevel debug --api-cors app://* --logfile /home/lefteris/.config/rotki/logs/rotkehlchen.log
2021-01-17T09:45:53.935Z: The Python sub-process started on port: 4242 (PID: 19124)
^C2021-01-17T09:54:44.510Z: Exiting the application
2021-01-17T09:54:44.675Z: Traceback (most recent call last):
File "rotkehlchen/chain/substrate/manager.py", line 408, in _get_node_interface
File "site-packages/substrateinterface/base.py", line 450, in __init__
ValueError: Type registry preset 'kusama' not found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "src/gevent/greenlet.py", line 818, in gevent._greenlet.Greenlet.run
File "rotkehlchen/chain/substrate/manager.py", line 240, in _connect_node
File "rotkehlchen/chain/substrate/manager.py", line 418, in _get_node_interface
AttributeError: Invalid SubstrateInterface instantiation
2021-01-17T09:47:30Z <Greenlet at 0x7fcc0ff06cb0: <bound method SubstrateManager._connect_node of <rotkehlchen.chain.substrate.manager.SubstrateManager object at 0x7fcc167b5f90>>(node=<KusamaNodeName.OWN: 0>, endpoint='http://localhost:9933')> failed with AttributeError

Traceback (most recent call last):
File "rotkehlchen/chain/substrate/manager.py", line 408, in _get_node_interface
File "site-packages/substrateinterface/base.py", line 450, in __init__
ValueError: Type registry preset 'kusama' not found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "src/gevent/greenlet.py", line 818, in gevent._greenlet.Greenlet.run
File "rotkehlchen/chain/substrate/manager.py", line 240, in _connect_node
File "rotkehlchen/chain/substrate/manager.py", line 418, in _get_node_interface
AttributeError: Invalid SubstrateInterface instantiation
2021-01-17T09:47:30Z <Greenlet at 0x7fcc0fe8d5f0: <bound method SubstrateManager._connect_node of <rotkehlchen.chain.substrate.manager.SubstrateManager object at 0x7fcc167b5f90>>(node=<KusamaNodeName.PARITY: 1>, endpoint='https://kusama-rpc.polkadot.io/')> failed with AttributeError

# Fixed code
def _get_node_interface(self, endpoint: str) -> SubstrateInterface:
    """Get an instance of SubstrateInterface, a specialized class in
    interfacing with a Substrate node that deals with SCALE encoding/decoding,
    metadata parsing, type registry management and versioning of types.

    May raise (most common):
    - RemoteError: from RequestException, problems requesting the url.
    - FileNotFound: via `load_type_registry_preset()` if it doesn't exist
    a preset file for the given `type_registry_preset` argument.
    - ValueError and TypeError: invalid constructor arguments.
    """
    si_attributes = self.chain.substrate_interface_attributes()
    try:
        node_interface = SubstrateInterface(
            url=endpoint,
            type_registry_preset=si_attributes.type_registry_preset,
        )
    except requests.exceptions.RequestException as e:
        message = (
            f"{self.chain} could not connect to node at endpoint: {endpoint}. "
            f"Connection error: {str(e)}."
        )
        log.error(message)
        raise RemoteError(message) from e
    except (FileNotFoundError, ValueError, TypeError) as e:
        message = (
            f"{self.chain} could not connect to node at endpoint: {endpoint}. "
            f"Unexpected error during SubstrateInterface instantiation: {str(e)}."
        )
        log.error(message)
        raise RemoteError("Invalid SubstrateInterface instantiation") from e

    return node_interface