def METHOD_NAME(
    tmp_path_factory,
    testerchain,
    threshold_staking,
    application_economics,
    test_registry,
):
    """
    Generate a random keypair & password and create a local keystore. Then prepare a staking provider
    for ursula. Then check that the correct ursula ethereum key signs the commitment.
    """
    keystore = tmp_path_factory.mktemp("keystore", numbered=True)
    password = secrets.token_urlsafe(12)
    account = Account.create()
    path = keystore / f"{account.address}"
    json.dump(account.encrypt(password), open(path, "x+t"))
    testerchain.wait_for_receipt(
        testerchain.client.w3.eth.send_transaction(
            {
                "to": account.address,
                "from": testerchain.etherbase_account,
                "value": Web3.to_wei("100", "ether"),
            }
        )
    )
    # initialize threshold stake
    provider_address = testerchain.unassigned_accounts[0]
    tx = threshold_staking.functions.setRoles(provider_address).transact()
    testerchain.wait_for_receipt(tx)
    tx = threshold_staking.functions.setStakes(
        provider_address, application_economics.min_authorization, 0, 0
    ).transact()
    testerchain.wait_for_receipt(tx)
    provider_power = TransactingPower(
        account=provider_address, signer=Web3Signer(testerchain.client)
    )
    provider_power.unlock(password=INSECURE_DEVELOPMENT_PASSWORD)
    pre_application_agent = ContractAgency.get_agent(
        PREApplicationAgent,
        registry=test_registry,
        provider_uri=TEST_ETH_PROVIDER_URI,
    )
    pre_application_agent.bond_operator(
        staking_provider=provider_address,
        operator=account.address,
        transacting_power=provider_power,
    )
    return account, password, keystore