feat: Add DLC Input support for spliced contracts#228
Merged
Conversation
- add new DlcInput message with localFundPubkey, remoteFundPubkey, fundValue - implement full TLV serialization and JSON support - export DlcInput from messaging package index
- add optional dlcInput field to FundingInput class - implement rust-dlc compatible optional format (0x00/0x01 prefix) - support DlcInput in JSON serialization/deserialization - maintain backward compatibility with existing FundingInput usage
- add DlcInput serialization/deserialization tests - test FundingInput with and without DlcInput scenarios - verify rust-dlc optional format byte prefix (0x00/0x01) - test JSON round-trip compatibility - ensure backward compatibility validation
- switch to bennyhodl/rust-dlc@spliced-contract branch - update dlc-messages and dlc dependencies to support DLC input features - update dependency versions in Cargo.lock
- update dlcspecs test vectors with DlcInput test cases - ensure compatibility with rust-dlc spliced-contract branch - maintain existing test vector structure while adding new capabilities
- update any package-level dependencies for DlcInput support
- add update-dlcspecs-vectors.sh script for regenerating test vectors - update .gitignore to exclude test vector backup directories - script helps maintain test vectors when updating rust-dlc dependencies
- reduce CLI timeout to 1min in CI environments (vs 5min locally) - increase test timeouts to 90s in CI (vs 15s locally) - improve CI cargo caching for git dependencies - pre-fetch dependencies to avoid network timeouts - add environment-aware timeout configuration
BREAKING CHANGE: DlcInput message format changed from fundValue to contractId - replace fundValue (8-byte BigInt) with contractId (32-byte Buffer) - update DlcInput validation to check 32-byte contractId length - update all tests to use contractId instead of fundValue - remove unused imports (bigIntToNumber, toBigInt, validPublicKey) - update JSON interface to use contractId string field This enables contract identification in DLC inputs for spliced contracts (allows finding the relevant contractId of the DLC Input)
- add dust filtering (1000 sat threshold) to match C++ behavior - add calculateMaxCollateral() utility for precise DLC amounts - fix single-funded DLC fee handling for zero-input parties - resolves 'No Change' DLC splicing issue
- add DlcInput.ts with 32-byte contractId field and full serialization - support optional DlcInput nesting in FundingInput messages - enable DlcInput in DlcOffer and DlcAccept messages - generate enum_3_of_5_with_dlc_input_test.json test vector - include generation script for future test vector updates - skip Rust compatibility tests (Rust implementation pending)
Collaborator
|
No comments, LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements DLC Input support within FundingInput messages to enable advanced DLC functionality like spliced contracts. This is a breaking change to the FundingInput serialization format.
BREAKING CHANGE Warning
This PR introduces breaking changes to FundingInput serialization:
New Features
DlcInput Message Type
DlcInput(42773)localFundPubkey,remoteFundPubkey,fundValueEnhanced FundingInput Format
[existing fields][0x00]or[existing fields][0x01][DlcInput data]Technical Implementation
New Serialization Format
JSON Schema Extension
{ "inputSerialId": 1, "prevTx": "02000000...", "prevTxVout": 0, "sequence": 4294967295, "maxWitnessLen": 108, "redeemScript": "", "dlcInput": { // NEW: Optional field "localFundPubkey": "023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb", "remoteFundPubkey": "025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357", "fundValue": 100000000 } }Migration Required
For Applications Using FundingInput
Dependencies & Tooling
bennyhodl/rust-dlc@spliced-contractbranchupdate-dlcspecs-vectors.shfor regenerating test dataTesting