mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
Compare commits
No commits in common. "a409689c40b8d914f23a1b62271d50282fdc8adc" and "bbba73efb8fcdaf60f184ca468fe503c6c24c0a8" have entirely different histories.
a409689c40
...
bbba73efb8
@ -226,18 +226,18 @@ impl<E: HashElement, A: Algorithm<E>> AppendMerkleTree<E, A> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
proof: RangeProof<E>,
|
proof: RangeProof<E>,
|
||||||
) -> Result<Vec<(usize, usize, E)>> {
|
) -> Result<Vec<(usize, usize, E)>> {
|
||||||
let mut updated_nodes = Vec::new();
|
self.fill_with_proof(
|
||||||
let mut left_nodes = proof.left_proof.proof_nodes_in_tree();
|
proof
|
||||||
if left_nodes.len() >= self.leaf_height {
|
.left_proof
|
||||||
updated_nodes
|
.proof_nodes_in_tree()
|
||||||
.append(&mut self.fill_with_proof(left_nodes.split_off(self.leaf_height))?);
|
.split_off(self.leaf_height),
|
||||||
}
|
)?;
|
||||||
let mut right_nodes = proof.right_proof.proof_nodes_in_tree();
|
self.fill_with_proof(
|
||||||
if right_nodes.len() >= self.leaf_height {
|
proof
|
||||||
updated_nodes
|
.right_proof
|
||||||
.append(&mut self.fill_with_proof(right_nodes.split_off(self.leaf_height))?);
|
.proof_nodes_in_tree()
|
||||||
}
|
.split_off(self.leaf_height),
|
||||||
Ok(updated_nodes)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fill_with_file_proof(
|
pub fn fill_with_file_proof(
|
||||||
|
@ -9,5 +9,5 @@ exit-future = "0.2.0"
|
|||||||
futures = "0.3.21"
|
futures = "0.3.21"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
lighthouse_metrics = { path = "../lighthouse_metrics" }
|
lighthouse_metrics = { path = "../lighthouse_metrics" }
|
||||||
tokio = { version = "1.38.0", features = ["full"] }
|
tokio = { version = "1.19.2", features = ["rt"] }
|
||||||
tracing = "0.1.35"
|
tracing = "0.1.35"
|
||||||
|
@ -29,7 +29,7 @@ itertools = "0.13.0"
|
|||||||
serde = { version = "1.0.197", features = ["derive"] }
|
serde = { version = "1.0.197", features = ["derive"] }
|
||||||
parking_lot = "0.12.3"
|
parking_lot = "0.12.3"
|
||||||
serde_json = "1.0.127"
|
serde_json = "1.0.127"
|
||||||
tokio = { version = "1.38.0", features = ["full"] }
|
tokio = { version = "1.10.0", features = ["sync"] }
|
||||||
task_executor = { path = "../../common/task_executor" }
|
task_executor = { path = "../../common/task_executor" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -712,7 +712,7 @@ impl LogManager {
|
|||||||
tx_store.rebuild_last_chunk_merkle(pora_chunks_merkle.leaves(), tx_seq)?
|
tx_store.rebuild_last_chunk_merkle(pora_chunks_merkle.leaves(), tx_seq)?
|
||||||
}
|
}
|
||||||
// Initialize
|
// Initialize
|
||||||
None => Merkle::new_with_depth(vec![], 1, None),
|
None => Merkle::new_with_depth(vec![], log2_pow2(PORA_CHUNK_SIZE) + 1, None),
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
@ -761,10 +761,6 @@ impl LogManager {
|
|||||||
.merkle
|
.merkle
|
||||||
.write()
|
.write()
|
||||||
.try_initialize(&log_manager.flow_store)?;
|
.try_initialize(&log_manager.flow_store)?;
|
||||||
info!(
|
|
||||||
"Log manager initialized, state={:?}",
|
|
||||||
log_manager.get_context()?
|
|
||||||
);
|
|
||||||
Ok(log_manager)
|
Ok(log_manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +335,11 @@ impl TransactionStore {
|
|||||||
}
|
}
|
||||||
let mut merkle = if last_chunk_start_index == 0 {
|
let mut merkle = if last_chunk_start_index == 0 {
|
||||||
// The first entry hash is initialized as zero.
|
// The first entry hash is initialized as zero.
|
||||||
AppendMerkleTree::<H256, Sha3Algorithm>::new_with_depth(vec![H256::zero()], 1, None)
|
AppendMerkleTree::<H256, Sha3Algorithm>::new_with_depth(
|
||||||
|
vec![H256::zero()],
|
||||||
|
log2_pow2(PORA_CHUNK_SIZE) + 1,
|
||||||
|
None,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
AppendMerkleTree::<H256, Sha3Algorithm>::new_with_depth(
|
AppendMerkleTree::<H256, Sha3Algorithm>::new_with_depth(
|
||||||
vec![],
|
vec![],
|
||||||
|
@ -1 +1 @@
|
|||||||
66ff70bc88547c7467efd35ba500ae5f25cf8960
|
5f2694d043c7b3dfaebe7240262b370fd4f2ce4c
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user