Skip to content

Commit 375e502

Browse files
committed
mina-tree: remove documented code
1 parent 79b3f7b commit 375e502

File tree

2 files changed

+0
-64
lines changed

2 files changed

+0
-64
lines changed

ledger/src/mask/mask.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,6 @@ impl BaseLedger for Mask {
448448
let addr_length = addr.length();
449449
let res = self.with(|this| this.merkle_path(addr.clone()));
450450
assert_eq!(res.len(), addr_length);
451-
452-
// elog!(
453-
// "merkle_path addr={:?} path_len={:?} path={:?}",
454-
// addr,
455-
// res.len(),
456-
// res
457-
// );
458-
459451
res
460452
}
461453

ledger/src/tree.rs

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct Leaf<T: TreeVersion> {
1616
#[derive(PartialEq)]
1717
pub struct HashesMatrix {
1818
/// 2 dimensions matrix
19-
// matrix: Vec<Option<Fp>>,
2019
matrix: BTreeMap<u64, Fp>,
2120
empty_hashes: Vec<Option<Fp>>,
2221
ledger_depth: usize,
@@ -36,46 +35,16 @@ impl Clone for HashesMatrix {
3635

3736
impl Debug for HashesMatrix {
3837
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39-
// const SPACES: &[usize] = &[
40-
// 0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,
41-
// ];
42-
43-
// let mut s = String::with_capacity(self.matrix.len() * 2);
44-
// let mut spaces = SPACES;
45-
// let mut current = 0;
46-
// let naccounts = 2u64.pow(self.ledger_depth as u32) as usize;
47-
48-
// for h in self.matrix.iter() {
49-
// let c = if h.is_some() { 'I' } else { '0' };
50-
// s.push(c);
51-
52-
// if current == spaces[0] && current != naccounts {
53-
// s.push(' ');
54-
// current = 0;
55-
// spaces = &spaces[1..];
56-
// }
57-
58-
// current += 1;
59-
// }
60-
6138
f.debug_struct("HashesMatrix")
62-
// .field("matrix", &s)
6339
.field("matrix_len", &self.matrix.len())
64-
// .field("real_matrix", &real)
65-
// .field("empty_hashes", &self.empty_hashes)
66-
// .field("ledger_depth", &self.ledger_depth)
6740
.field("nhashes", &self.nhashes)
68-
// .field("capacity", &self.matrix.capacity())
6941
.finish()
7042
}
7143
}
7244

7345
impl HashesMatrix {
7446
pub fn new(ledger_depth: usize) -> Self {
75-
// let capacity = 2 * 2usize.pow(ledger_depth as u32) - 1;
76-
7747
Self {
78-
// matrix: vec![None; capacity],
7948
matrix: BTreeMap::new(),
8049
ledger_depth,
8150
empty_hashes: vec![None; ledger_depth],
@@ -85,20 +54,11 @@ impl HashesMatrix {
8554

8655
pub fn get(&self, addr: &Address) -> Option<&Fp> {
8756
let linear: u64 = addr.to_linear_index();
88-
89-
// self.matrix.get(linear)?.as_ref()
9057
self.matrix.get(&linear)
9158
}
9259

9360
pub fn set(&mut self, addr: &Address, hash: Fp) {
9461
let linear: u64 = addr.to_linear_index();
95-
96-
// if self.matrix.len() <= linear {
97-
// self.matrix.resize(linear + 1, None);
98-
// }
99-
100-
// assert!(self.matrix[linear].is_none());
101-
// self.matrix[linear] = Some(hash);
10262
let old = self.matrix.insert(linear, hash);
10363
assert!(old.is_none());
10464
self.nhashes += 1;
@@ -122,16 +82,6 @@ impl HashesMatrix {
12282
if old.is_some() {
12383
self.nhashes -= 1;
12484
}
125-
126-
// let hash = match self.matrix.get_mut(index) {
127-
// Some(hash) => hash,
128-
// None => return,
129-
// };
130-
131-
// if hash.is_some() {
132-
// self.nhashes -= 1;
133-
// *hash = None;
134-
// }
13585
}
13686

13787
pub(super) fn transfert_hashes(&mut self, hashes: HashesMatrix) {
@@ -170,18 +120,12 @@ impl HashesMatrix {
170120

171121
pub fn clear(&mut self) {
172122
let ledger_depth = self.ledger_depth;
173-
// let capacity = 2 * 2usize.pow(ledger_depth as u32) - 1;
174-
175123
*self = Self {
176-
// matrix: vec![None; capacity],
177124
matrix: BTreeMap::new(),
178125
ledger_depth,
179126
empty_hashes: vec![None; ledger_depth],
180127
nhashes: 0,
181128
}
182-
// self.matrix.clear();
183-
// self.empty_hashes.clear();
184-
// self.nhashes = 0;
185129
}
186130

187131
pub fn take(&mut self) -> Self {

0 commit comments

Comments
 (0)