mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-10 10:05:17 +00:00
Add log for proof generation errors.
This commit is contained in:
parent
e20be63026
commit
79734637b4
@ -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)]
|
||||
|
@ -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`.
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -768,7 +768,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))]
|
||||
|
Loading…
Reference in New Issue
Block a user