chore: improve error msg (#1003)

This commit is contained in:
dan
2025-10-03 05:43:58 +00:00
committed by GitHub
parent d25fb320d4
commit d5ad768e7c
3 changed files with 21 additions and 3 deletions

View File

@@ -91,6 +91,13 @@ impl RecordProofError {
{
Self(ErrorRepr::Vm(err.into()))
}
pub(crate) fn is_insufficient(&self) -> bool {
match &self.0 {
ErrorRepr::Aes(err) => err.is_insufficient(),
_ => false,
}
}
}
#[derive(Debug, thiserror::Error)]

View File

@@ -281,8 +281,8 @@ impl Prover<state::Setup> {
)
.map_err(ProverError::zk)?;
// Prove received plaintext. Prover drops the proof output, as
// they trust themselves.
// Prove sent and received plaintext. Prover drops the proof
// output, as they trust themselves.
let (sent_refs, _) = commit_records(
&mut vm,
&mut zk_aes_ctr_sent,
@@ -293,6 +293,7 @@ impl Prover<state::Setup> {
)
.map_err(ProverError::zk)?;
let (recv_refs, _) = commit_records(
&mut vm,
&mut zk_aes_ctr_recv,
@@ -301,7 +302,13 @@ impl Prover<state::Setup> {
.iter()
.filter(|record| record.typ == ContentType::ApplicationData),
)
.map_err(ProverError::zk)?;
.map_err(|e| {
if e.is_insufficient() {
ProverError::zk(format!("{e}. Attempted to prove more received data than was configured, increase `max_recv_data` in the config."))
} else {
ProverError::zk(e)
}
})?;
mux_fut
.poll_with(vm.execute_all(&mut ctx).map_err(ProverError::zk))

View File

@@ -184,6 +184,10 @@ impl ZkAesCtrError {
{
Self(ErrorRepr::Vm(err.into()))
}
pub fn is_insufficient(&self) -> bool {
matches!(self.0, ErrorRepr::InsufficientPreprocessing { .. })
}
}
#[derive(Debug, thiserror::Error)]