# Buggy code
def __init__(
    self,
    name: str,
    api_key: ApiKey,
    secret: ApiSecret,
    database: "DBHandler",
):
    print("Exchange interface ctor called")
    assert isinstance(api_key, T_ApiKey), "api key for {} should be a string".format(
        name
    )
    assert isinstance(secret, T_ApiSecret), (
        "secret for {} should be a bytestring".format(name)
    )
    super().__init__()
    self.name = name
    self.db = database
    self.api_key = api_key
    self.secret = secret
    self.first_connection_made = False
    self.session = requests.session()
    self.session.headers.update({"User-Agent": "rotkehlchen"})
    log.info(f"Initialized {name} exchange")


# 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,
    name: str,
    api_key: ApiKey,
    secret: ApiSecret,
    database: "DBHandler",
):
    assert isinstance(api_key, T_ApiKey), "api key for {} should be a string".format(
        name
    )
    assert isinstance(secret, T_ApiSecret), (
        "secret for {} should be a bytestring".format(name)
    )
    super().__init__()
    self.name = name
    self.db = database
    self.api_key = api_key
    self.secret = secret
    self.first_connection_made = False
    self.session = requests.session()
    self.session.headers.update({"User-Agent": "rotkehlchen"})
    log.info(f"Initialized {name} exchange")