mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-10 10:05:17 +00:00
Merge 97a3cb6b08
into 041f5f12b6
This commit is contained in:
commit
7b56ba2784
@ -90,6 +90,14 @@ impl FlowStore {
|
|||||||
}
|
}
|
||||||
self.db.delete_batch_list(batch_list)
|
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)]
|
#[derive(Clone, Debug)]
|
||||||
@ -575,6 +583,13 @@ impl FlowDBStore {
|
|||||||
}
|
}
|
||||||
Ok(self.kvdb.write(tx)?)
|
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)]
|
#[derive(DeriveEncode, DeriveDecode, Clone, Debug)]
|
||||||
|
@ -6,6 +6,7 @@ use std::mem;
|
|||||||
use tracing::error;
|
use tracing::error;
|
||||||
use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
|
use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum EntryBatchData {
|
pub enum EntryBatchData {
|
||||||
Complete(Vec<u8>),
|
Complete(Vec<u8>),
|
||||||
/// All `PartialBatch`s are ordered based on `start_index`.
|
/// All `PartialBatch`s are ordered based on `start_index`.
|
||||||
|
@ -23,7 +23,7 @@ use super::SealAnswer;
|
|||||||
use chunk_data::EntryBatchData;
|
use chunk_data::EntryBatchData;
|
||||||
use seal::SealInfo;
|
use seal::SealInfo;
|
||||||
|
|
||||||
#[derive(Encode, Decode)]
|
#[derive(Debug, Encode, Decode)]
|
||||||
pub struct EntryBatch {
|
pub struct EntryBatch {
|
||||||
seal: SealInfo,
|
seal: SealInfo,
|
||||||
// the inner data
|
// the inner data
|
||||||
|
@ -19,7 +19,7 @@ pub struct SealContextInfo {
|
|||||||
type ChunkSealBitmap = WrappedBitmap<SEALS_PER_LOAD>;
|
type ChunkSealBitmap = WrappedBitmap<SEALS_PER_LOAD>;
|
||||||
const_assert!(SEALS_PER_LOAD <= u128::BITS as usize);
|
const_assert!(SEALS_PER_LOAD <= u128::BITS as usize);
|
||||||
|
|
||||||
#[derive(Default, DeriveEncode, DeriveDecode)]
|
#[derive(Debug, Default, DeriveEncode, DeriveDecode)]
|
||||||
pub struct SealInfo {
|
pub struct SealInfo {
|
||||||
// a bitmap specify which sealing chunks have been sealed
|
// a bitmap specify which sealing chunks have been sealed
|
||||||
bitmap: ChunkSealBitmap,
|
bitmap: ChunkSealBitmap,
|
||||||
|
@ -776,7 +776,21 @@ impl LogManager {
|
|||||||
.gen_proof(flow_index as usize % PORA_CHUNK_SIZE)?,
|
.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))]
|
#[instrument(skip(self, merkle))]
|
||||||
|
Loading…
Reference in New Issue
Block a user