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

Refactor Commit Creation and Handling #431

Merged
merged 13 commits into from
Nov 1, 2024
Merged

Conversation

bifurcation
Copy link
Contributor

@bifurcation bifurcation commented Aug 30, 2024

This PR is a restructuring PR to prepare MLSpp for some variations on Commit structure, as discussed in the light MLS I-D and this issue.

State::handle is split out into a few parts:

  • State::handle_proposal, just a renamed State::cache_proposal
  • State::handle_commit, which handles all the parts of Commit processing
    that depend on the structure of the Commit
  • State::ratchet, which updates the state of the tree based on the
    information gleaned from a Commit

Similarly, State::commit is broken in a few pieces as well, though there's a little more back-and-forth due to the transcript hash interactions:

  1. Call State::prepare_commit to do the actual computations to create the new trees, etc., that need to be done irrespective of the commit format.
  2. Back in State::commit, prepare the AuthenticatedContent and the updated confirmed transcript hash.
  3. Call State::successor to create the next state from the commit data and updated confirmed transcript hash.
  4. Use the resulting confirmation tag to complete the AuthenticatedContent, and encapsulate as an MLSMessage.
  5. Call State::welcome to create the Welcome message.

Overall, the idea is that to support a new format for commits, you should just have to touch the format-specific code. On creation, a method parallel to State::commit can call through to State::prepare_commit and State::successor for the non-format-specific details. On handle, a method parallel to State::handle_commit can ingest the format and then call State::ratchet.

In the process of this refactoring State::successor got a lot more beefy, and took over the functions of State::update_epoch_secrets, which was then removed. I also updated the API to the transcript to reflect that the confirmed transcript hash is never update all at once, but instead computed and stored on two sides of an API call.

There are a couple of drive-by fixes in here as well:

  • Fixed a bug where State::resolve was not properly checking group IDs in a short-circuit branch.

  • Refactored make format so that it actually excludes test vectors and thus goes much faster.

  • Disabled long-running interop tests by default in make dtest. They will still run with make ctest or when manually enabled.

@bifurcation bifurcation merged commit f977de9 into main Nov 1, 2024
14 checks passed
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