feat(trie): witness (#9803)

This commit is contained in:
Roman Krasiuk
2024-07-30 13:18:20 -07:00
committed by GitHub
parent d90f2396e5
commit 2c2a782bb8
8 changed files with 324 additions and 11 deletions

View File

@ -20,6 +20,7 @@ alloy-primitives.workspace = true
alloy-rlp.workspace = true
alloy-eips.workspace = true
revm-primitives.workspace = true
nybbles.workspace = true
thiserror-no-std = { workspace = true, default-features = false }

View File

@ -1,5 +1,7 @@
//! Errors when computing the state root.
use alloy_primitives::B256;
use nybbles::Nibbles;
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
use thiserror_no_std::Error;
@ -23,6 +25,26 @@ impl From<StateProofError> for ProviderError {
}
}
/// Trie witness errors.
#[derive(Error, Debug, PartialEq, Eq, Clone)]
pub enum TrieWitnessError {
/// Error gather proofs.
#[error(transparent)]
Proof(#[from] StateProofError),
/// RLP decoding error.
#[error(transparent)]
Rlp(#[from] alloy_rlp::Error),
/// Missing storage multiproof.
#[error("missing storage multiproof for {0}")]
MissingStorageMultiProof(B256),
/// Missing account.
#[error("missing account {0}")]
MissingAccount(B256),
/// Missing target node.
#[error("target node missing from proof {0:?}")]
MissingTargetNode(Nibbles),
}
/// State root errors.
#[derive(Error, Debug, PartialEq, Eq, Clone)]
pub enum StateRootError {