Closed zvolin closed 1 year ago
@zvolin If I'm understanding correctly that the go
version operates on raw (unhashed) leaves, then NamespacedProof.verify_complete_namespace
should be semantically identical to the go
function VerifyNamespace
except that the hasher is set at compile time.
NamespacedProofverify_range
is currently equivalent to VerifyLeafHashes(false, ...)
except that it operates on raw (unhashed) leaves. We should be able to make it exactly equivalent with a by removing the logic that hashes the inputs, adding the verify_completeness
parameter, and making a small change to the function body:
// Change lines 74-80 of nmt_proof.rs from...
tree.inner.check_range_proof(
root,
&mut &leaf_hashes[..],
&mut siblings,
start_idx as usize,
)?;
// to...
let range_proof_type = tree.check_range_proof(
root,
&mut &leaf_hashes[..],
&mut siblings,
start_idx as usize,
)?;
if verify_completeness {
if let RangeProofType::Partial = range_proof_type {
return Err(RangeProofError::MissingLeaf);
}
}
VerifyInclusion
looks to me like it's identical to NamespacedProof.verify_range
I'm happy to accept a PR to adjust the APIs as necessary here. If you do plan to expose methods that verify namespace completeness, though, lets make sure those APIs have test coverage.
So with those 2 PR's that I linked, we're currently fine verifying all the proofs received from celestia share/blob API, tho there may be other things needed in the future that we don't see yet
@zvolin, is there any remaining work to be done on this issue?
no that I'm aware of, so far we haven't spot anything else, thanks
Hi, I have a question about the API. When it comes to proving, in Go implementation I can see those methods:
How does those compare to the interface exposed by this crate? Can I achieve the same functionality as in Go using those methods? From
NamespacedProof
:From
NamespacedMerkleTree