# Counted Clear

Retrieves the number of consecutive unsubmitted proofs for the miner's current challenge. This metric tracks the number of times the miner has failed to submit the required proof for the ongoing challenge. Once the miner submits the proof, the record will be reset to 0.

***

## Function Definition

```rust
pub async fn counted_clear(
    account: &str,
    block_hash: Option<H256>,
) -> Result<Option<u8>, Error>
```

***

## Description

This asynchronous query retrieves the count of consecutive unsubmitted service proofs for a given account. Each time a miner fails to submit the required proof, the count is incremented. If the miner submits the proof, the count is reset to 0.

You can provide a block\_hash to query the state at a specific block or omit it to get the most recent state of the chain.

***

## Parameters

| Name        | Type   | Description                                                                                                                          |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| account     | \&str  | A valid SS58-encoded account representing the miner or storage provider to query.                                                    |
| block\_hash | Option | (Optional) Block hash for querying state at a specific point in the blockchain. If omitted, the query returns the most recent state. |

***

## Returns

| Type         | Description                                                                                                                               |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Ok(Some(u8)) | The number of consecutive unsubmitted proofs for the given account.                                                                       |
| Ok(None)     | No record of unsubmitted proofs for the account, meaning the miner has either submitted proofs consistently or there is no relevant data. |
| Err(Error)   | If the query fails due to invalid data, connectivity issues, or other errors.                                                             |

***

## Example

```rust
use cess_rust_sdk::chain::audit::query::StorageQuery as AuditQuery;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let account = "cXgaee2N8E77JJv9gdsGAckv1Qsf3hqWYf7NL4q6ZuQzuAUtB";

    let result = AuditQuery::counted_clear(account, None).await?;

    match result {
        Some(count) => println!("Account {} has {} consecutive unsubmitted service proofs.", account, count),
        None => println!("No record of consecutive unsubmitted service proofs found for account {}.", account),
    }

    Ok(())
}

```


---

# 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://doc.cess.network/developer/cess-sdk/sdk-rust/chain/audit/counted_clear.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.
