Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed May 22, 2024
1 parent cd441a2 commit 44c9201
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/node/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,11 @@ mod tests {
// Prepare written keys for non-probable data, probable data (IBC), and
// no diffed data
let make_key = |suffix: u64| {
// For three type keys
match suffix % 3u64 {
// for non-probable data
0 => Key::parse(format!("key{suffix}")).unwrap(),
// for probable data
1 => ibc_key(format!("key{suffix}")).unwrap(),
// for no diff
_ => client_counter_key(),
Expand Down Expand Up @@ -543,17 +546,20 @@ mod tests {
assert_eq!(tree.root().0, roots.get(&height).unwrap().0);
match write_type {
0 => {
// data was not updated
if *current_state.get(&key).unwrap() {
assert!(tree.has_key(&key)?);
} else {
assert!(!tree.has_key(&key)?);
}
}
1 | 3 => {
// data was deleted
assert!(!tree.has_key(&key)?);
current_state.insert(key, false);
}
_ => {
// data was updated
assert!(tree.has_key(&key)?);
current_state.insert(key, true);
}
Expand All @@ -579,17 +585,20 @@ mod tests {
assert_eq!(tree.root().0, roots.get(&height).unwrap().0);
match write_type {
0 => {
// data was not updated
if *current_state.get(&key).unwrap() {
assert!(tree.has_key(&merkle_key)?);
} else {
assert!(!tree.has_key(&merkle_key)?);
}
}
1 | 3 => {
// data was deleted
assert!(!tree.has_key(&merkle_key)?);
current_state.insert(key, false);
}
_ => {
// data was updated
assert!(tree.has_key(&merkle_key)?);
current_state.insert(key, true);
}
Expand Down

0 comments on commit 44c9201

Please sign in to comment.