Skip to content

trees/checkpoint: Add checkpoint.Checkpoint#8830

Open
beautifulentropy wants to merge 5 commits into
mainfrom
trees-checkpoint
Open

trees/checkpoint: Add checkpoint.Checkpoint#8830
beautifulentropy wants to merge 5 commits into
mainfrom
trees-checkpoint

Conversation

@beautifulentropy

@beautifulentropy beautifulentropy commented Jun 30, 2026

Copy link
Copy Markdown
Member

Add Checkpoint to represent a tlog-checkpoint note body, with .String() to serialize it and .Marshal() to serialize with field validation. Add Parse() to parse an unsigned body and Open() to verify a signed note and parse its body into a Checkpoint.

A note to reviewers: this package and its tests were written with assistance from Claude Opus 4.8. That being said, it has been reviewed and extensively revised by myself before submission.

@beautifulentropy beautifulentropy marked this pull request as ready for review June 30, 2026 17:11
@beautifulentropy beautifulentropy requested a review from a team as a code owner June 30, 2026 17:11
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
@aarongable aarongable requested review from ezekiel and jsha July 3, 2026 00:50

@jsha jsha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, thanks for working on this. Sharing something that confused me, in hopes it helps other reviewers:

The signed note format defines different signature types:

  • 0x01 — Ed25519 signatures as specified by this document.
  • 0x04 — Timestamped Ed25519 checkpoint cosignatures, as specified by c2sp.org/tlog-cosignature.
  • 0x06 — Timestamped ML-DSA-44 (sub)tree cosignatures, as specified by c2sp.org/tlog-cosignature.

We want 0x04, 0x06, or both - but probably just 0x06. Importantly, 0x06 specifies a transformation to cosigned_message before signing / verifying.

We can implement our own note.Verifier that does the transfomation at verification time, and I'm assuming that's the intended followup from this PR.

Right now the tests use note.NewVerifier, which creates a key of type 0x01. Once we implement a verifier for 0x06, we'll probably want to update the tests for verisimilitude.

Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated

@jsha jsha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, one other nit: This PR, in the description and comments, refers to the "note body", but https://github.com/C2SP/C2SP/blob/main/signed-note.md calls the same concept the "note text". We should use "note text" or "text" here too, with "note" or "signed note" for the overall object.

aarongable
aarongable previously approved these changes Jul 10, 2026

@aarongable aarongable left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one comment. The new clarity on when to use Unmarshal vs when to use Open is really great!

Comment thread trees/checkpoint/checkpoint.go Outdated

@jsha jsha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically ready to go; a few small comments. Thanks for working on this!

Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
Comment thread trees/checkpoint/checkpoint.go Outdated
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.

4 participants