-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement proof generation and verification #662
Implement proof generation and verification #662
Conversation
9b1b45d
to
129a23e
Compare
firewood/src/db.rs
Outdated
@@ -79,7 +77,7 @@ impl<T: ReadLinearStore> api::DbView for HistoricalRev<T> { | |||
async fn single_key_proof<K: api::KeyType>( | |||
&self, | |||
_key: K, | |||
) -> Result<Option<Proof<Vec<u8>>>, api::Error> { | |||
) -> Result<Option<Proof>, api::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this generic means each ProofNode can be of a different type, which isn't what we want I think. All ProofNodes within a proof should either be owned or borrowed (currently all of them are borrowed).
I'd rather see the generic here and have ProofNode use the type from it's parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generic is added back in https://github.com/ava-labs/firewood/pull/682/files. I could merge that PR into this one if you want.
firewood/tests/db.rs
Outdated
// TODO do type assertion on error | ||
} | ||
} | ||
// #[ignore = "unimplemented"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure this still compiles. Why was it commented out?
This PR implements a first pass on proof generation and verification. It:
ValueDigest
type to be genericPreimage
type. I couldn't figure out how to implement a blanket implementation forto_hash
andwrite
with the additional genericsV
andH
.Merkle.prove
andProof.verify