# Buggy code
def confirm_activity(
    click_config,
    # API Options
    geth,
    provider_uri,
    network,
    registry_filepath,
    staker_address,
    worker_address,
    federated_only,
    rest_host,
    rest_port,
    db_filepath,
    poa,
    light,
    config_file,
    dev,
    lonely,
    teacher_uri,
    min_stake,
):
    """
    Manually confirm-activity for the current period.
    """

    ### Setup ###
    _validate_args(geth, federated_only, staker_address, registry_filepath)

    emitter = _setup_emitter(click_config, worker_address)

    _pre_launch_warnings(emitter, dev=dev, force=None)

    ursula_config, provider_uri = _get_ursula_config(
        emitter,
        geth,
        provider_uri,
        network,
        registry_filepath,
        dev,
        config_file,
        staker_address,
        worker_address,
        federated_only,
        rest_host,
        rest_port,
        db_filepath,
        poa,
        light,
    )
    #############

    URSULA = _create_ursula(
        ursula_config, click_config, dev, emitter, lonely, teacher_uri, min_stake
    )

    receipt = URSULA.confirm_activity()

    confirmed_period = URSULA.staking_agent.get_current_period() + 1
    date = datetime_at_period(
        period=confirmed_period, seconds_per_period=URSULA.economics.seconds_per_period
    )

    # TODO: Double-check dates here
    emitter.echo(
        f"\nActivity confirmed for period #{confirmed_period} (starting at {date})",
        bold=True,
        color="blue",
    )
    painting.paint_receipt_summary(
        emitter=emitter,
        receipt=receipt,
        chain_name=URSULA.staking_agent.blockchain.client.chain_name,
    )


# Traceback (nucypher.blockchain.eth.interfaces.InterfaceError)
(nucypher) derek@derek-home-server:~/nucypher/forks/david/nucypher$ nucypher ursula run --teacher <teacher_uri> --interactive



,ggg,     	gg
dP""Y8a    	88                               	,dPYb,
Yb, `88    	88                               	IP'`Yb
`"  88    	88                               	I8  8I
88    	88                               	I8  8'
88    	88   ,gggggg,	,g, 	gg  	gg  I8 dP	,gggg,gg
88    	88   dP""""8I   ,8'8,	I8  	8I  I8dP	dP"  "Y8I
88    	88  ,8'	8I  ,8'  Yb   I8,	,8I  I8P	i8'	,8I
Y8b,____,d88,,dP 	Y8,,8'_   8) ,d8b,  ,d8b,,d8b,_ ,d8,   ,d8b,
"Y888888P"Y88P  	`Y8P' "YY8P8P8P'"Y88P"`Y88P'"Y88P"Y8888P"`Y8


the Untrusted Re-Encryption Proxy.


Enter password to unlock account 0x4a0A9e421B624410DAf3AF42707F7c5973a2C963:
Enter NuCypher keyring password:
Decrypting NuCypher keyring...
Starting Ursula on <my_ip>:9151
Connecting to goerli
Working ~ Keep Ursula Online!
Attached 0xf6B42791C096C94F92AA0938fA13C93B0eD1EB2A@<my_ip>:9151
⛰ ⚘ | Ivory Mountain DarkOrchid Flower

Type 'help' or '?' for help
Ursula(0xf6B4279) >>> confirm_activity
Unhandled Error
Traceback (most recent call last):
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/internet/process.py", line 291, in doRead
return fdesc.readFromFD(self.fd, self.dataReceived)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/internet/fdesc.py", line 94, in readFromFD
callback(output)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/internet/process.py", line 295, in dataReceived
self.proc.childDataReceived(self.name, data)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/internet/_posixstdio.py", line 77, in childDataReceived
self.protocol.dataReceived(data)
File "/home/derek/.local/share/virtualenvs/nucypher-yyLOaW15/lib/python3.6/site-packages/twisted/protocols/basic.py", line 572, in dataReceived
why = self.lineReceived(line)
File "/home/derek/nucypher/forks/david/nucypher/nucypher/cli/processes.py", line 148, in lineReceived
self.__commands[line]()
File "/home/derek/nucypher/forks/david/nucypher/nucypher/cli/processes.py", line 183, in confirm_activity
return self.ursula.confirm_activity()
File "/home/derek/nucypher/forks/david/nucypher/nucypher/blockchain/eth/actors.py", line 70, in wrapped
return func(actor, *args, **kwargs)
File "/home/derek/nucypher/forks/david/nucypher/nucypher/blockchain/eth/actors.py", line 77, in wrapped
receipt = actor_method(self, *args, **kwargs)
File "/home/derek/nucypher/forks/david/nucypher/nucypher/blockchain/eth/actors.py", line 662, in confirm_activity
receipt = self.staking_agent.confirm_activity(worker_address=self.__worker_address)
File "/home/derek/nucypher/forks/david/nucypher/nucypher/blockchain/eth/agents.py", line 279, in confirm_activity
receipt = self.blockchain.send_transaction(contract_function=contract_function, sender_address=worker_address)
File "/home/derek/nucypher/forks/david/nucypher/nucypher/blockchain/eth/interfaces.py", line 353, in send_transaction
raise self.InterfaceError(str(READ_ONLY_INTERFACE))
nucypher.blockchain.eth.interfaces.InterfaceError: READ_ONLY_INTERFACE

# Fixed code
def confirm_activity(
    click_config,
    # API Options
    geth,
    provider_uri,
    network,
    registry_filepath,
    staker_address,
    worker_address,
    federated_only,
    rest_host,
    rest_port,
    db_filepath,
    poa,
    light,
    config_file,
    dev,
    lonely,
    teacher_uri,
    min_stake,
):
    """
    Manually confirm-activity for the current period.
    """

    ### Setup ###
    _validate_args(geth, federated_only, staker_address, registry_filepath)

    emitter = _setup_emitter(click_config, worker_address)

    _pre_launch_warnings(emitter, dev=dev, force=None)

    ursula_config, provider_uri = _get_ursula_config(
        emitter,
        geth,
        provider_uri,
        network,
        registry_filepath,
        dev,
        config_file,
        staker_address,
        worker_address,
        federated_only,
        rest_host,
        rest_port,
        db_filepath,
        poa,
        light,
    )
    #############

    URSULA = _create_ursula(
        ursula_config,
        click_config,
        dev,
        emitter,
        lonely,
        teacher_uri,
        min_stake,
        load_seednodes=False,
    )

    confirmed_period = URSULA.staking_agent.get_current_period() + 1
    click.echo(f"Confirming activity for period {confirmed_period}", color="blue")
    receipt = URSULA.confirm_activity()

    economics = TokenEconomicsFactory.get_economics(registry=URSULA.registry)
    date = datetime_at_period(
        period=confirmed_period, seconds_per_period=economics.seconds_per_period
    )

    # TODO: Double-check dates here
    emitter.echo(
        f"\nActivity confirmed for period #{confirmed_period} (starting at {date})",
        bold=True,
        color="blue",
    )
    painting.paint_receipt_summary(
        emitter=emitter,
        receipt=receipt,
        chain_name=URSULA.staking_agent.blockchain.client.chain_name,
    )