Add a tlog-policy parser - #269
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #269 +/- ##
==========================================
- Coverage 82.57% 79.97% -2.60%
==========================================
Files 5 9 +4
Lines 241 884 +643
==========================================
+ Hits 199 707 +508
- Misses 30 97 +67
- Partials 12 80 +68 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A new `TLogPolicy` type exposing `Marshal`/`Unmarshal` functions, and `Satisfied`/`Verified` for checking quorum satisfaction / verifying checkpoints.
c3b8c21 to
d94901d
Compare
mhutchinson
left a comment
There was a problem hiding this comment.
Looks good to me, but I'd like to have @AlCutter approve too.
| // log <vkey> [<url>] | ||
| type Log struct { | ||
| // Verifier verifies this log's checkpoint signatures. Its Name() is the | ||
| // key name from the vkey, which per the spec MUST correspond to the |
There was a problem hiding this comment.
FWIW, tlog-checkpoint says "The log’s key name in its signature line SHOULD match the origin line".
While mostly it'd be cool if everyone treated that as a MUST, MTC unfortunately doesn't. I think it's okay, in that Satisfied will still works even if Verify doesn't, so mostly just flagging it for thoughts rather than requesting any particular changes.
| // Witness keys must be tlog-cosignature verifier keys: key types 0x04 | ||
| // (Ed25519 cosignature/v1) and 0x06 (ML-DSA-44) are supported, and any | ||
| // other key type, including plain Ed25519 (0x01), is rejected. | ||
| // Log keys may use any note signature algorithm known to the note |
There was a problem hiding this comment.
nitty - note resolves to sumbdb/note in the imports of this file, and that package only knows about 0x01 signatures, whereas f_note knows about ~all the important ones for tlogs.
You use f_note when parsing verifiers, so it'll work as expected I think, so just the comment is a bit misleading.
| } | ||
|
|
||
| visiting := make(map[string]bool) | ||
| var satisfied func(name string) bool |
There was a problem hiding this comment.
nitty: can shrink this a tad if you want by dropping the param name
| var satisfied func(name string) bool | |
| var satisfied func(string) bool |
| // checkpoint for the group to be considered to have witnessed it. | ||
| // The "any" and "all" keywords are resolved to 1 and len(Members) | ||
| // respectively during parsing, so 1 <= Threshold <= len(Members). | ||
| Threshold int |
There was a problem hiding this comment.
Make it uint and avoid possibility of it being negative?
No description provided.