feat(val): add checked registry insertion tracking leanSpec#1184 - #58
Merged
Conversation
The maintainers invited a fix PR for leanEthereum/leanSpec#1184; this prepares the Lean side of that loop. addChecked rejects a same-seed entry at insertion - every one-time key of an XMSS secret key derives from its master PRF seed, so two keys collide in OTS state exactly when their seeds coincide (upstream will compare the manifest's two public keys, which equivalently fingerprint the seeds). addChecked_wellFormed: an accepted entry passed the comparison, so checked insertion discharges the WellFormed distinctness at construction - once upstream enforces the check, every loaded registry is well-formed by construction, closing the loop the way #1179 did for the store invariants. Re-align the shape with the merged fix when it lands.
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.
Summary
Prepares the Lean side of the leanEthereum/leanSpec#1184 loop (the maintainers have invited a fix PR upstream). Unlike #57 this does not mirror pending upstream code — it implements the fix shape suggested in the issue, so it is safe to merge now and re-align (if needed) when the upstream fix lands.
What it adds (
LeanSpec/Validator/Registry.lean)addChecked— reject a same-seed entry at insertion (nonemirrors the loader'sValueError). Every one-time key of an XMSS secret key derives from its master PRF seed, so two keys collide in OTS state exactly when their seeds coincide — the check compares the seeds; upstream will compare the manifest's two public keys, which equivalently fingerprint themaddChecked_wellFormed— an accepted entry passed the comparison, so checked insertion discharges theWellFormeddistinctness at construction: once upstream enforces the check, every loaded registry is well-formed by construction — closing the loop the way #1179 did for the store invariants (Store.WellFormed)lake buildpasses with nosorry.