# Prover selection

Novanet supports scriptable prover selection with Rhai. Each orchestrator keeps track of the performance of the provers that it knows about and each prover profile contains information such as how many shards they have proven and how many times they have disconnected while proving. When an orchestrator receives a request from client to prove a job, it fetches these prover profiles and calls a prover selection script which is fed these profiles and the number of provers the selector must choose from the set of available provers. The current prover selection strategy for NovaNet orchestrators is to ignore disconnected provers and sort the rest of provers in increasing order by their job queue size:

```rust
fn generate_list_a(provers, num_provers_needed, _num_opcodes) {
    provers.filter_disconnected();

    if provers.len() < num_provers_needed {
        return ();
    }

    provers.sort_by_job_queue_size_asc();
    return provers.select(num_provers_needed);
}
```

The selection can be fallible, meaning if there isn't enough suitable provers to complete the job, the script can return `()` to indicate that it failed. This will cause the job to be rejected and either some other orchestrator will pick up the job or the client has to try with a lower shard count.

Currently, the prover file exports the following fields:

* `prover` - on-chain address of the prover
* `num_shards_proven` - how many shards has the prover proven
* `num_disconnections` - how many times has the prover disconnected while proving
* `job_queue_size` - how many jobs does the prover have in queue
* `connected` - is the prover currently connected to the orchestrator


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devs.novanet.xyz/for-developers/prover-selection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
