Refactor Commit Creation and Handling #431
Merged
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::handle
is split out into a few parts:State::handle_proposal
, just a renamedState::cache_proposal
State::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::commit
is broken in a few pieces as well, though there's a little more back-and-forth due to the transcript hash interactions:State::prepare_commit
to 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::successor
to create the next state from the commit data and updated confirmed transcript hash.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 toState::prepare_commit
andState::successor
for the non-format-specific details. On handle, a method parallel toState::handle_commit
can ingest the format and then callState::ratchet
.In the process of this refactoring
State::successor
got 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::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 withmake ctest
or when manually enabled.