Skip to content

trees/mirror: Add mirror wire protocol - #8951

Merged
beautifulentropy merged 2 commits into
mainfrom
paving-a-path-to-a-proper-publisher-04
Aug 19, 2026
Merged

trees/mirror: Add mirror wire protocol#8951
beautifulentropy merged 2 commits into
mainfrom
paving-a-path-to-a-proper-publisher-04

Conversation

@beautifulentropy

@beautifulentropy beautifulentropy commented Aug 17, 2026

Copy link
Copy Markdown
Member

Implement the wire protocol specified in the https://c2sp.org/tlog-witness and https://c2sp.org/tlog-mirror.

Closes #8945

@beautifulentropy
beautifulentropy marked this pull request as ready for review August 17, 2026 21:46
@beautifulentropy
beautifulentropy requested a review from a team as a code owner August 17, 2026 21:46
@beautifulentropy
beautifulentropy requested review from aarongable, ezekiel and jsha and removed request for jsha August 17, 2026 21:46

@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.

As far as I can tell, the publisher's add-entries flow is going to be:

  • compute set of entries it needs to send
  • call mirror.Packages to compute start and end of each package
  • for each package:
    • use a TileReader to get all the entries
    • use a HashReader to get the subtree consistency proof
    • call mirror.EntryPackage to serialize it
  • call mirror.AddEntriesRequest to serialize all of those into the actual request

Something about this feels a little too manual? I totally understand not wanting to pass a TileReader and/or HashReader into these functions so it can look up all the data itself -- that feels a bit messy. But what if AddEntriesRequest took the entries and their proofs directly, instead of requiring the caller to have first called EntryPackage? Maybe that ends up even worse. Worth thinking about, but feel free to ignore.

Comment thread trees/mirror/mirror.go Outdated
Comment thread trees/mirror/mirror.go Outdated
@beautifulentropy
beautifulentropy merged commit 76f6514 into main Aug 19, 2026
32 of 34 checks passed
@beautifulentropy
beautifulentropy deleted the paving-a-path-to-a-proper-publisher-04 branch August 19, 2026 22:16
Comment thread trees/mirror/mirror.go
Comment on lines +172 to +174
if len(entry) > 0xFFFF {
return nil, fmt.Errorf("entry is %d bytes, want at most %d", len(entry), 0xFFFF)
}

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.

FYI, cryptobyte checks this for us, so we could save a few lines here and below:

https://pkg.go.dev/golang.org/x/crypto/cryptobyte#BuilderContinuation

It is an error to write more bytes to the child than allowed by the reserved length prefix.

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.

trees/mirror: Add mirror wire protocol

4 participants