Add log for proof generation errors. (#182)
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled

This commit is contained in:
peilun-conflux 2024-09-06 17:56:04 +08:00 committed by GitHub
parent bf3694d138
commit 29fcc415a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 3 deletions

View File

@ -90,6 +90,14 @@ impl FlowStore {
}
self.db.delete_batch_list(batch_list)
}
pub fn get_raw_batch(&self, batch_index: u64) -> Result<Option<EntryBatch>> {
self.db.get_entry_batch(batch_index)
}
pub fn get_batch_root(&self, batch_index: u64) -> Result<Option<DataRoot>> {
self.db.get_batch_root(batch_index)
}
}
#[derive(Clone, Debug)]
@ -575,6 +583,13 @@ impl FlowDBStore {
}
Ok(self.kvdb.write(tx)?)
}
fn get_batch_root(&self, batch_index: u64) -> Result<Option<DataRoot>> {
Ok(self
.kvdb
.get(COL_ENTRY_BATCH_ROOT, &batch_index.to_be_bytes())?
.map(|v| DataRoot::from_slice(&v)))
}
}
#[derive(DeriveEncode, DeriveDecode, Clone, Debug)]

View File

@ -6,6 +6,7 @@ use std::mem;
use tracing::error;
use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
#[derive(Debug)]
pub enum EntryBatchData {
Complete(Vec<u8>),
/// All `PartialBatch`s are ordered based on `start_index`.

View File

@ -23,7 +23,7 @@ use super::SealAnswer;
use chunk_data::EntryBatchData;
use seal::SealInfo;
#[derive(Encode, Decode)]
#[derive(Debug, Encode, Decode)]
pub struct EntryBatch {
seal: SealInfo,
// the inner data

View File

@ -19,7 +19,7 @@ pub struct SealContextInfo {
type ChunkSealBitmap = WrappedBitmap<SEALS_PER_LOAD>;
const_assert!(SEALS_PER_LOAD <= u128::BITS as usize);
#[derive(Default, DeriveEncode, DeriveDecode)]
#[derive(Debug, Default, DeriveEncode, DeriveDecode)]
pub struct SealInfo {
// a bitmap specify which sealing chunks have been sealed
bitmap: ChunkSealBitmap,

View File

@ -776,7 +776,21 @@ impl LogManager {
.gen_proof(flow_index as usize % PORA_CHUNK_SIZE)?,
}
};
entry_proof(&top_proof, &sub_proof)
let r = entry_proof(&top_proof, &sub_proof);
if r.is_err() {
let raw_batch = self.flow_store.get_raw_batch(seg_index as u64)?;
let db_root = self.flow_store.get_batch_root(seg_index as u64)?;
error!(
?r,
?raw_batch,
?db_root,
?seg_index,
"gen proof error: top_leaves={}, last={}",
merkle.pora_chunks_merkle.leaves(),
merkle.last_chunk_merkle.leaves()
);
}
r
}
#[instrument(skip(self, merkle))]