Skip to content

Commit dcde89d

Browse files
committed
fix: tests
1 parent 9817c89 commit dcde89d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/api/method/get_validity_proof/common.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct GetValidityProofResponse {
7575
pub context: Context,
7676
}
7777

78-
#[derive(Serialize, Deserialize, Default, ToSchema)]
78+
#[derive(Serialize, Deserialize, Default, ToSchema, Debug)]
7979
#[serde(deny_unknown_fields, rename_all = "camelCase")]
8080
pub struct GetValidityProofResponseV2 {
8181
pub value: CompressedProofWithContextV2,
@@ -88,7 +88,15 @@ impl From<GetValidityProofResponse> for GetValidityProofResponseV2 {
8888
value: CompressedProofWithContextV2 {
8989
compressedProof: response.value.compressedProof,
9090
roots: response.value.roots,
91-
rootIndices: response.value.rootIndices.into_iter().map(|x| RootIndex { root_index: x, in_tree: true}).collect(),
91+
rootIndices: response
92+
.value
93+
.rootIndices
94+
.into_iter()
95+
.map(|x| RootIndex {
96+
root_index: x,
97+
in_tree: true,
98+
})
99+
.collect(),
92100
leafIndices: response.value.leafIndices,
93101
leaves: response.value.leaves,
94102
merkleTrees: response.value.merkleTrees,

tests/integration_tests/batched_state_tree_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async fn test_batched_tree_transactions(
188188
println!("i {}, validity_proof {:?}", i, validity_proof.value);
189189

190190
// No value has been inserted into the tree yet -> all proof by index.
191-
assert!(validity_proof.value.rootIndices.iter().all(|x| x.is_none()));
191+
assert!(validity_proof.value.rootIndices.iter().all(|x| !x.in_tree));
192192
assert!(validity_proof
193193
.value
194194
.merkleTrees
@@ -366,9 +366,9 @@ async fn test_batched_tree_transactions(
366366
println!("z + base index {} {}", z, base_index);
367367
println!("last inserted index {}", last_inserted_index);
368368
if base_index < last_inserted_index {
369-
assert!(root_index.is_some());
369+
assert!(root_index.in_tree);
370370
} else {
371-
assert!(root_index.is_none());
371+
assert!(!root_index.in_tree);
372372
assert_eq!(root, "");
373373
}
374374
base_index += 2;

0 commit comments

Comments
 (0)