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

Various improvements to VIDPF #1177

Merged
merged 8 commits into from
Jan 3, 2025
Merged

Various improvements to VIDPF #1177

merged 8 commits into from
Jan 3, 2025

Conversation

cjpatton
Copy link
Collaborator

@cjpatton cjpatton commented Dec 27, 2024

Partially addresses #947.

I'm working on completing Mastic. This first PR cleans up several aspects of VIDPF that should make it easier to bring it up to spec.

It's best to review this PR commit-by-commit.

src/vidpf.rs Show resolved Hide resolved
src/vidpf.rs Outdated Show resolved Hide resolved
@cjpatton cjpatton marked this pull request as ready for review December 27, 2024 15:32
@cjpatton cjpatton requested a review from a team as a code owner December 27, 2024 15:32
@cjpatton cjpatton marked this pull request as draft December 27, 2024 18:49
@cjpatton cjpatton force-pushed the cjpatton/947-working branch from 2a2e9e8 to 4e90f46 Compare December 28, 2024 20:11
@cjpatton cjpatton marked this pull request as ready for review December 29, 2024 17:56
src/vidpf.rs Outdated Show resolved Hide resolved
src/vidpf.rs Outdated Show resolved Hide resolved
src/vidpf.rs Outdated Show resolved Hide resolved
src/vidpf.rs Outdated Show resolved Hide resolved
The "cs" field is merely a correction word for the node proof.
Clean up comments a bit and move a couple of things out of the public
API.
This simplifies the API a bit and improves parity with the idpf module.
Create an iterator over a `VidpfInput` that consolidates some error
handling common to VIDPF generation and evaluation. This allows us to
reduce the amount of error handling necessary and improve control flow
in a few places.
We're currently computing the onehot proof via the following tree
traversal: for each prefix, visit each node along the path from the root
to the node labeled by the prefix. The Mastic spec calls for a
breadth-first traversal of the sub-tree composed of the nodes of the
prefixes.

This commit makes three improvements towards aligning Mastic with the
spec.

First, de-couple the onehot proof computation from `eval_next()`
completely. At the moment, the "latest onehot proof" is stored in the
evaluation state, a value that is dependent on the tree traversal. This
forces us to handle Mastic-specific details in VIDPF. Instead we store
the node proof in the evaluation state, which is independent of the
traversal.

Second, modify `eval()` and `eval_cache()` to return a onehot proof for
the single prefix they traverse.

Third, consolidate the `eval_root()` APIs into a single function.
Rename `VidpfEvalCache` to `VidpfEvalResult` and have `eval_enxt()`
output it.
This is needed in order to properly compute the path and payload checks.
@cjpatton cjpatton force-pushed the cjpatton/947-working branch from 4e90f46 to 9ea8c7b Compare January 3, 2025 15:12
@cjpatton cjpatton merged commit b4a71a8 into main Jan 3, 2025
6 checks passed
@cjpatton cjpatton deleted the cjpatton/947-working branch January 3, 2025 15:19
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.

2 participants