Skip to content

Conversation

@0xJepsen
Copy link
Contributor

Pull Request

This is a very small change but very important feature for the user. This change just ensures that the data from the response (that we are proving) is returned to the user.

devloper
devloper previously approved these changes Mar 11, 2025
@devloper devloper self-requested a review March 12, 2025 01:31
@devloper devloper dismissed their stale review March 12, 2025 01:32

wrong values

@devloper
Copy link
Contributor

devloper commented Mar 12, 2025

This current approach dumps the entire body, not the extract value. This is inconsistent with the old APIs. It should only output the value.

FYI @piotr-roslaniec , this probably needs to reflect the output of the ManifestV2 multi-extractions as well. The approach I took in my other PR is naive.

pluto@d66d0d9

@piotr-roslaniec
Copy link
Contributor

I must have misled you @0xJepsen, you need the extraction implemented as proposed by @devloper

I recall I already implemented this as an intermediate step somewhere. We could also merge #541, but I think we want to avoid breaking changes (new release) here.

@0xJepsen
Copy link
Contributor Author

Okay lets merge in the V2 and then i will rebase and take a look here.

@0xJepsen 0xJepsen force-pushed the feat/return_value branch from f2921d0 to a6402ec Compare March 12, 2025 20:36
let path = manifest.response.body.json_path().clone();
let body = serde_json::from_slice(&response.notary_response_body.clone().body.unwrap()).unwrap();
let value = get_value_from_json_path(&body, &path);
let manifest_hash = KeccakHasher::hash(serde_json::to_string(&manifest)?.as_bytes());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@piotr-roslaniec we need to make the hash like this so that the same proof produces the same hash. This is because in the on chain verifier, we shouldn't let users submit duplicate proofs. and we need to enable users to recreate the root hash.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. This is not going to work for HTML extraction. I will look into that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@0xJepsen 0xJepsen Mar 13, 2025

Choose a reason for hiding this comment

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

yes these seems reasonable as long as the keccak digest is deterministic such that the users can recreate it if need be.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this simple approach from Piotr, let's update to use that and merge this PR.

@devloper
Copy link
Contributor

Would also be nice to have support for these extractions all the way out to the contract. I created an issue on solidity-verifier for that: pluto/solidity-verifier#4 (comment)

@0xJepsen
Copy link
Contributor Author

This should be ready for review


validate_notarization_legal(manifest, request, response)?;
let path = manifest.response.body.json_path().clone();
let body = serde_json::from_slice(&response.notary_response_body.clone().body.unwrap()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still breaking for the HTML format. Shall we disable HTML support for the time, or reconsider with this approach: #563 (comment) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants