Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(drive): internal error on querying proofs #1747

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/rs-drive-abci/src/query/proofs/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,36 @@ mod tests {
metadata: Some(_),
}) if !proof.grovedb_proof.is_empty()));
}

#[test]
fn test_prove_all() {
let (platform, state, version) = setup_platform();

let request = GetProofsRequestV0 {
identities: vec![
IdentityRequest {
identity_id: vec![0; 32],
request_type: 0,
}
],
contracts: vec![ContractRequest {
contract_id: vec![0; 32]
}],
documents: vec![DocumentRequest {
contract_id: vec![0; 32],
document_type: "niceDocument".to_string(),
document_type_keeps_history: false,
document_id: vec![1; 32],
}],
};

let validation_result = platform
.query_proofs_v0(request, &state, version)
.expect("expected query to succeed");

assert!(matches!(validation_result.data, Some(GetProofsResponseV0 {
result: Some(get_proofs_response_v0::Result::Proof(proof)),
metadata: Some(_),
}) if !proof.grovedb_proof.is_empty()));
}
}
6 changes: 5 additions & 1 deletion packages/rs-drive/src/drive/prove/prove_multiple/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ impl Drive {
path_queries.extend(
document_queries
.iter()
.map(|drive_query| drive_query.construct_path_query()),
.map(|drive_query| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test here to make sure we fixed the problem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

let mut path_query = drive_query.construct_path_query();
path_query.query.limit = None;
path_query
}),
);
count += document_queries.len();
}
Expand Down
Loading