Refactor Commit Creation and Handling#431
Merged
bifurcation merged 13 commits intomainfrom Nov 1, 2024
Merged
Conversation
suhasHere
approved these changes
Nov 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::handleis split out into a few parts:State::handle_proposal, just a renamedState::cache_proposalState::handle_commit, which handles all the parts of Commit processingthat depend on the structure of the Commit
State::ratchet, which updates the state of the tree based on theinformation gleaned from a Commit
Similarly,
State::commitis broken in a few pieces as well, though there's a little more back-and-forth due to the transcript hash interactions:State::prepare_committo do the actual computations to create the new trees, etc., that need to be done irrespective of the commit format.State::commit, prepare the AuthenticatedContent and the updated confirmed transcript hash.State::successorto create the next state from the commit data and updated confirmed transcript hash.State::welcometo 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::commitcan call through toState::prepare_commitandState::successorfor the non-format-specific details. On handle, a method parallel toState::handle_commitcan ingest the format and then callState::ratchet.In the process of this refactoring
State::successorgot a lot more beefy, and took over the functions ofState::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::resolvewas not properly checking group IDs in a short-circuit branch.Refactored
make formatso 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 withmake ctestor when manually enabled.