# Buggy code
def __init__(
    self,
    chain: SubstrateChain,
    greenlet_manager: GreenletManager,
    msg_aggregator: MessagesAggregator,
    connect_at_start: Sequence[NodeName],
    connect_on_startup: bool,
    own_rpc_endpoint: str,
) -> None:
    """An interface to any Substrate chain supported by Rotki.

    It uses Polkascan py-substrate-interface for interacting with the
    substrate blockchains and the Subscan API as a chain explorer.

    Official substrate chains documentation:
    https://substrate.dev/rustdocs/v2.0.0/sc_service/index.html
    https://guide.kusama.network/docs/en/kusama-index
    https://wiki.polkadot.network/en/

    External Address Format (SS58) documentation:
    https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)

    Polkascan py-scale-codec:
    https://github.com/polkascan/py-scale-codec/tree/master

    Polkascan py-substrate-interface:
    https://github.com/polkascan/py-substrate-interface
    https://polkascan.github.io/py-substrate-interface/base.html

    Subscan API documentation:
    https://docs.api.subscan.io
    """
    if chain not in SubstrateChain:
        raise AttributeError(f"Unexpected SubstrateManager chain: {chain}")

    log.debug(f"Initializing {chain} manager")
    self.chain = chain
    self.greenlet_manager = greenlet_manager
    self.msg_aggregator = msg_aggregator
    self.connect_at_start = connect_at_start
    self.own_rpc_endpoint = own_rpc_endpoint
    self.available_node_attributes_map: DictNodeNameNodeAttributes = {}
    self.available_nodes_call_order: NodesCallOrder = []
    self.chain_properties: SubstrateChainProperties
    if connect_on_startup and len(connect_at_start) != 0:
        self.attempt_connections()
    else:
        log.warning(
            f"{self.chain} manager won't attempt to connect to nodes",
            connect_at_start=connect_at_start,
            connect_on_startup=connect_on_startup,
            own_rpc_endpoint=own_rpc_endpoint,
        )


# 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 __init__(
    self,
    chain: SubstrateChain,
    greenlet_manager: GreenletManager,
    msg_aggregator: MessagesAggregator,
    connect_at_start: Sequence[NodeName],
    connect_on_startup: bool,
    own_rpc_endpoint: str,
) -> None:
    """An interface to any Substrate chain supported by Rotki.

    It uses Polkascan py-substrate-interface for interacting with the
    substrate blockchains and the Subscan API as a chain explorer.

    Official substrate chains documentation:
    https://substrate.dev/rustdocs/v2.0.0/sc_service/index.html
    https://guide.kusama.network/docs/en/kusama-index
    https://wiki.polkadot.network/en/

    External Address Format (SS58) documentation:
    https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)

    Polkascan py-scale-codec:
    https://github.com/polkascan/py-scale-codec/tree/master

    Polkascan py-substrate-interface:
    https://github.com/polkascan/py-substrate-interface
    https://polkascan.github.io/py-substrate-interface/base.html

    Subscan API documentation:
    https://docs.api.subscan.io
    """
    if chain not in SubstrateChain:
        raise AssertionError(f"Unexpected SubstrateManager chain: {chain}")

    log.debug(f"Initializing {chain} manager")
    self.chain = chain
    self.greenlet_manager = greenlet_manager
    self.msg_aggregator = msg_aggregator
    self.connect_at_start = connect_at_start
    self.own_rpc_endpoint = own_rpc_endpoint
    self.available_node_attributes_map: DictNodeNameNodeAttributes = {}
    self.available_nodes_call_order: NodesCallOrder = []
    self.chain_properties: SubstrateChainProperties
    if connect_on_startup and len(connect_at_start) != 0:
        self.attempt_connections()
    else:
        log.warning(
            f"{self.chain} manager won't attempt to connect to nodes",
            connect_at_start=connect_at_start,
            connect_on_startup=connect_on_startup,
            own_rpc_endpoint=own_rpc_endpoint,
        )