-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lnwire+lnwallet: add LocalNonces field for splice nonce coordination w/ taproot channels #9982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: taproot-final-scripts
Are you sure you want to change the base?
lnwire+lnwallet: add LocalNonces field for splice nonce coordination w/ taproot channels #9982
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This commit introduces a new TLV structure LocalNoncesData that contains a map of transaction IDs to MuSig2 nonces. This structure enables coordinating multiple nonces for different purposes (e.g., channel commits, splice operations) within a single wire message. The implementation includes: - LocalNoncesData struct with deterministic TLV encoding/decoding - Comprehensive unit tests covering encoding, decoding, and edge cases - Helper functions for creating optional LocalNonces values This is a prep for upcoming spec changes to allow a party that has in-prorgess splices to tell the remote party which nonces to use for which splice.
Extends the ChannelReestablish message to include a new optional LocalNonces field alongside the existing LocalNonce field. This enables backwards-compatible transmission of multiple nonces for different purposes during channel reestablishment. Changes include: - Add LocalNonces field to ChannelReestablish struct - Update Encode/Decode methods to handle the new TLV field - Extend property-based testing to randomly include LocalNonces - Maintain full backwards compatibility with existing LocalNonce field
Updates channel synchronization to support the new LocalNonces field while maintaining backwards compatibility with the legacy LocalNonce field. This enables coordinated nonce exchange for splice operations and other multi-commitment scenarios. Key changes: - ChanSyncMsg now populates both LocalNonce and LocalNonces fields - ProcessChanSyncMsg prioritizes LocalNonces over LocalNonce - Uses empty hash key for primary commitment nonce in LocalNonces map - Maintains full backwards compatibility with existing implementations
Adds extensive test coverage for the new LocalNonces functionality in channel synchronization, ensuring both legacy and new nonce fields work correctly together. Test additions include: - Helper function to extract nonces from either LocalNonces or LocalNonce - Comprehensive TestChanSyncTaprootLocalNonces covering all scenarios - Tests for backwards compatibility when only one field is present - Error handling tests for missing nonce scenarios - Updates to existing sync tests to handle both nonce field types
This is dependent on #9639 |
Hope to see this soon! |
This PR implements support for the upcoming BOLT specification change that enables coordinated nonce exchange for splice operations in taproot channels. The current
LocalNonce
field inChannelReestablish
only supports a single nonce, but splice operations require coordination of multiple nonces for different transaction purposes.Note that we don't support splicing yet, but we aim to make sure the final version of taproot channels is fully compatible with splicing. This new set of fields is only intended to be set with the production taproot channel feature bit. A follow up PR will actually start to gate the script and p2p message changes (like this).
Ultimately for the foreseeable future, we'll support both the staging and prod taproot channel feature bit. Dynamic commitments can be used in the future to upgrade all the staging versions off-chain, which will allow us to eventually remove that feature bit.
Changes
This PR introduces a new
LocalNonces
field alongside the existingLocalNonce
field to enable:Implementation Details
Wire Protocol Changes
LocalNoncesData
TLV structure containing a map of transaction IDs to MuSig2 noncesChannelReestablish
message with optionalLocalNonces
field (TLV)LocalNonce
fieldChannel Synchronization Logic
ChanSyncMsg()
now populates both legacy and new nonce fields for taproot channelsProcessChanSyncMsg()
prioritizesLocalNonces
overLocalNonce
when both are presentchainhash.Hash{}
for primary commitment nonce in the mapKey Design Decisions
Testing
LocalNoncesData
encoding/decodingRandTestMessage
TestChanSyncTaprootLocalNonces
covering all sync scenarios