channeldb+migration: add type-prefixed waiting proof records#10633
channeldb+migration: add type-prefixed waiting proof records#10633ellemouton wants to merge 2 commits intolightningnetwork:masterfrom
Conversation
Existing waiting proof records encode a bare isRemote flag followed by a
raw AnnounceSignatures1 payload. A future gossip v2 implementation will
store AnnounceSignatures2 (taproot) proofs in the same bucket, so each
record needs a discriminator byte to select the correct decoder.
This commit:
1. Defines WaitingProofTypeV1 (= 0x00) for the current
AnnounceSignatures1-based proofs.
2. Adds migration 35, which rewrites every existing record to prepend
the type byte.
3. Updates WaitingProof.Encode/Decode to always write/expect the prefix.
The migration, codec changes, and tests are kept in one atomic commit so
there is no intermediate revision where the new Decode can encounter
unmigrated records.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces foundational changes to the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@codex review this |
|
@claude review this |
There was a problem hiding this comment.
Code Review
This pull request introduces a type prefix to WaitingProof records to support different gossip versions, specifically for upcoming Taproot channel support. It includes a database migration to update existing records to the new format. The WaitingProof struct is refactored to use an interface, making it extensible for future proof types. The changes are well-tested, including migration tests and unit tests for the new V2 proof logic. My review focuses on adherence to the repository's style guide regarding code documentation and formatting. I've suggested adding more in-body comments to explain the intention of code blocks, as recommended by the style guide.
1588533 to
d014f8f
Compare
d014f8f to
e583bdf
Compare
Introduce the WaitingProofInner interface and two concrete implementations — V1WaitingProof (AnnounceSignatures1) and V2WaitingProof (AnnounceSignatures2 + optional aggregate MuSig2 nonce). WaitingProof.Encode/Decode now dispatch on the type prefix byte added in the previous commit, so the store can transparently persist either proof variant. The gossiper is updated with a V1 type assertion to maintain existing behaviour; full V2 gossiper integration will follow when taproot channel announcements are wired up. No live code path creates V2 waiting proofs yet — this commit only lands the codec and storage readiness so the schema is in place before new writers are introduced.
e583bdf to
93b713c
Compare
Summary
Part of #10293 (Gossip 1.75 epic).
The waiting proof store holds half-proofs (
AnnounceSignatures) whilewe wait for the remote peer's matching half. To support gossip v2
(taproot channels), the store needs to handle both
AnnounceSignatures1and
AnnounceSignatures2payloads.This PR adds a 1-byte type discriminator to every record so
Decodeknows which wire message to parse, and introduces the codec machinery
for both proof types.
Record format
Before (legacy):
After:
Type byte values
0x00WaitingProofTypeV1AnnounceSignatures10x01WaitingProofTypeV2AnnounceSignatures2+ optional aggregate MuSig2 nonceV2 payload detail
V2 records carry an optional aggregate nonce needed to reconstruct the
final MuSig2 signature:
Commits
channeldb: add type-prefix to waiting proof store recordsa
0x00type prefixWaitingProof.Encode/Decodeto write/expect the prefixencounter unmigrated records
channeldb: add V2 (taproot) waiting proof codec supportWaitingProofInnerinterface withV1WaitingProofandV2WaitingProofimplementationsintegration will follow separately)
Test plan
WaitingProofStoremake lintpasses on both commits