> For the complete documentation index, see [llms.txt](https://flexecosystem.gitbook.io/flex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flexecosystem.gitbook.io/flex-docs/protocol/flex-validator-nodes/audit-layer.md).

# 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 %}
