binius_core/merkle_tree/
errors.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2024-2025 Irreducible Inc.

use crate::transcript;

#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("Length of the input vector is incorrect, expected {expected}")]
	IncorrectVectorLen { expected: usize },
	#[error("Index exceeds Merkle tree base size: {max}")]
	IndexOutOfRange { max: usize },
	#[error("values length must be a multiple of the batch size")]
	IncorrectBatchSize,
	#[error("The argument length must be a power of two.")]
	PowerOfTwoLengthRequired,
	#[error("The layer does not exist in the Merkle tree")]
	IncorrectLayerDepth,
	#[error("transcript error: {0}")]
	Transcript(#[from] transcript::Error),
	#[error("verification failure: {0}")]
	Verification(#[from] VerificationError),
}

#[derive(Debug, thiserror::Error)]
pub enum VerificationError {
	#[error("the length of the vector does not match the committed length")]
	IncorrectVectorLength,
	#[error("the shape of the proof is incorrect")]
	IncorrectProofShape,
	#[error("the proof is invalid")]
	InvalidProof,
}