# Audit Layer

The audit layer employs statistical methods to ensure the integrity of task validations.

**Zero-knowledge proof validation:**

For certain types of tasks, the Audit Layer implements zero-knowledge proofs to verify task completion without revealing sensitive information:

```javascript
JavaScriptCopy codedef generate_zkp(task_result, private_data):
    # Implementation of zero-knowledge proof generation
    pass

def verify_zkp(task_result, proof):
    # Implementation of zero-knowledge proof verification
    pass
```

**Byzantine fault tolerance (BFT):**

The audit layer implements a BFT consensus algorithm to handle potentially malicious validators:

*Consensus threshold:*

$$
\[(2n+1)/3]+1
$$

*where:* 𝑛 n is the total number of validators participating in the audit.

**Quality assessment formula:**

The quality score Q(t) for task t is now calculated using a weighted average of auditor reliability and task complexity:

$$
Q(t)=
∑
v∈A
t
​

​
C(t)
1/2

∑
v∈A
t
​

​
R(v)×C(t)
1/2

​
$$

*where:* 𝐴𝑡 is the set of auditors for task 𝑡, and 𝐶 (𝑡) is the task complexity.

{% hint style="info" %}
We invite developers, researchers, and enthusiasts to work with our contributors for this section. [Start contributing here.](https://app.deform.cc/form/21842244-e1c1-479f-a8b3-3877903ecd44)&#x20;
{% endhint %}


---

# 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://flexecosystem.gitbook.io/flex-docs/protocol/flex-validator-nodes/audit-layer.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.
