feat: full dlcspecs #163 compliance#223
Merged
Merged
Conversation
- Add protocol version support (PROTOCOL_VERSION = 1) - Update serialization format from legacy TLV to modern DLC spec - Add temporary_contract_id field support - Implement sibling sub-type format with bigsize identifiers - Change collection prefixes from u16 to bigsize - Add TLV stream support with unknown TLV handling - Add robust type validation and error handling - Fix cross-package import compatibility (DlcOfferV0 → DlcOffer) This transforms node-dlc from legacy format to modern DLC specification standards.
• Update payout curve implementations (Hyperbola, Polynomial) • Update transaction building logic for new format • Update financial instruments (options, covered calls, puts) • Update finance builder test for dlcspecs compliance • Enhance DLC contract construction utilities
• Update DLC store for new message serialization • Update oracle store for new oracle message format • Update order store for dlcspecs compliance • Update corresponding test files for new format • Maintain storage compatibility across format changes
• Update ContractInfo tests for new sibling types • Update negotiation field tests for dlcspecs format • Update oracle info tests for new oracle structure • Update order-related test suites • Update payout function tests for new serialization • Update messaging package README documentation
31036fc to
880a1be
Compare
• Add comprehensive dlcspecs compatibility test suite • Add rust-dlc cross-language compatibility tests • Add 24 test vector files (dlcspecs + rust-dlc formats) • Add rust-dlc CLI tool for cross-implementation testing • Add test vector update and validation utilities • Enable automated cross-ecosystem compatibility validation
• Update DLC message type expectations (DlcOfferV0 → DlcOffer) • Fix compatibility test assertions for new format • Update order message test references (OrderAcceptV0 → OrderAccept) • Ensure all test assertions use modern new types
• Add Rust toolchain setup for compatibility tests • Cache cargo registry and git dependencies • Build rust-dlc-cli before running tests • Add conditional build for backward compatibility • Set 10-minute timeout to prevent hanging builds
• Increase timeout from 30s to 5 minutes (300000ms) • Handle Rust compilation and dependency downloads • Prevent ETIMEDOUT errors in CI/CD environments • Fix timeout issues in both compatibility test files
• Set all required properties in OrderOffer test instances • Add missing properties: contractFlags, temporaryContractId, fundingPubkey • Add missing properties: payoutSpk, changeSpk, serial IDs • Fix OrderNegotiationFields tests that create OrderOffer instances • Ensure all Buffer properties are initialized before serialization • Align test setup with DlcOffer.spec.ts pattern
• Set all required properties in buildCsoDlcOfferFixture function • Add missing properties: contractFlags, temporaryContractId, fundingPubkey • Add missing properties: payoutSpk, changeSpk, serial IDs, timelock values • Fix PayoutFunction property access: pieces → payoutFunctionPieces • Align test setup with DlcOffer.spec.ts pattern for consistency
• Add F64 class in @node-dlc/bufio for IEEE 754 precision handling • Update HyperbolaPayoutCurvePiece to use F64 for all f64 parameters • Smart JSON serialization: numbers for safe values, strings for large • Rename EnumEventDescriptorV0 to EnumEventDescriptor with compat • Update OptionInfo imports to simplified class names • Simplify OrderOffer by removing complex funding fields • Add comprehensive F64 and PayoutCurvePiece precision tests • Fix fromJSON() zero value parsing with explicit undefined checks • Add decimal.js dependency and export F64 from bufio
- Implement F64 class for precise floating-point handling - Fix critical contractSize calculation bug in OptionInfo extraction - Remove V0 suffixes from class names (PayoutFunction, etc.) - Update tests to use F64 types and new PayoutFunction structure - Fix OrderOffer validation with missing contractFlags field - Prevent splitIntoRanges errors with identical from/to values - Replace number comparisons with F64.isZero() for precision - Maintain rust-dlc JSON compatibility with exact binary precision
- Replace hardcoded test data with programmatic object creation - Update imports to remove V0 suffixes (OrderOffer, OrderAccept) - Create proper ContractInfo with oracle and event descriptors - Fix test assertions to compare key fields vs full serialization - Add missing OracleEvent properties (eventId, oracleNonces) - Use correct property names for all message objects
- Replace hardcoded hex test data with helper functions - Add backward compatibility for DlcAccept message parsing - Fix test assertions using round-trip serialization - Improve test data structure and consistency in all stores - Add error handling for malformed/old format message parsing - Update funding input amounts to cover collateral requirements - Sort test arrays for consistent comparison results
- remvoes transport package entirely - irc unreliable, should be replaced with nostr
• Move toBigInt and bigIntToNumber helpers to shared util.ts • Remove unused imports from test and message files • Fix F64 import in PayoutCurvePiece test • Remove unused variables and commented test data
- replace versioned classes with Single/Disjoint enum variants - add proper JSON serialization/deserialization support - update all tests to use new variant-based structure - remove unused PayoutCurvePiece MessageType entries - implement discriminator-based wire format serialization - add backward compatibility exports for legacy code
- Add missing lint:fix script to wire package - Fix TypeScript Buffer compatibility issues in tests - Update ESLint config to allow while(true) in tests - Sync yarn format:fix with VSCode formatting behavior - Add formatting and linting checks to CI workflow - Configure proper import sorting with spacing - Add .editorconfig and .prettierignore files"
880a1be to
535e1b0
Compare
- replace FundingInputV0 with FundingInput across codebase - update DlcCloseV0 to DlcClose with protocol_version field - fix imports and type casting in core, leveldb packages - update test files to use new class names
- remove V0 suffixes from DlcTransactions, DlcCancel, DlcIds, DlcInfo - update OracleInfo to use SingleOracleInfo/MultiOracleInfo concrete types - replace OracleIdentifierV0 with OracleIdentifier concrete class - update MessageType enum with concrete names and backward compatibility - migrate leveldb store prefixes to use concrete naming scheme - update all imports and references across packages and tests - add backward compatibility aliases for V0 classes and types - update chain manager and store interfaces to use concrete types - remove deprecated V0 test files and update remaining test suites
8514aae to
ce4a439
Compare
- mv F64.ts from bufio to messaging/lib/serialize/ - export F64 from messaging package index - rm F64 export from bufio package index
- update core pkg to import F64 from messaging - mv messaging from devDeps to deps in core - add decimal.js dep to messaging pkg
- rm v0 suffix from EventDescriptor classes - add backward compatibility aliases - update Messagetype enum with aliases - update all references to use simplified names
- improve OracleAttestation format detection - add comprehensive test vectors for oracle messages - support both rust-dlc and DlcSpecs formats - add better error handling for edge cases
- add loop counter to prevent infinite loops in CETCalculator - fix hyperbola curve inverse function edge cases - improve polynomial curve outcome calculations - handle constant payout curves properly
- add proper endpoint handling for hyperbola curves - fix PayoutFunction constructor initialization - improve CoveredCall payout function building - add defensive fixes for array initialization
- add create-oracle-announcement cmd - add create-oracle-attestation cmd - improve TLV format support - add valid sig generation for testing purposes
- add input validation in TxFinalizer - imrove err messages and debugging - update package-lock with decimal.js dep - handle edge cases more gracefully
- remove `as any` casts throughout codebase for type safety - replace duck typing with switch statements using discriminators - update OrderNegotiationFields to use variant-based approach - make negotiationFields optional in OrderAccept message - use proper type discrimination for ContractInfo/OracleInfo - fix imports and add proper TypeScript type annotations
- rm any types and add explicit return type annotations - fix bigIntToNumber to handle large integers safely - add eslint-disable comments for unavoidable any usage - update varIntBytes to properly handle number|BigInt union
This was referenced Jun 30, 2025
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.
feat: Implement Full dlcspecs PR #163 Compliance
BREAKING CHANGES
This is a major breaking change that completely overhauls the DLC message serialization format.
Overview
This PR implements complete dlcspecs PR #163 compliance in node-dlc, transforming it from the legacy TLV format to the modern DLC specification. This massive update ensures full compatibility with rust-dlc and other modern DLC implementations.
What's Included
Core Infra Updates
PROTOCOL_VERSION = 1constantComplete @node-dlc/messaging package update
DlcOffer- Added protocolVersion, temporaryContractId, bigsize collectionsDlcAccept- Updated with new format compatibilityDlcSign- Updated with new format compatibilityContractInfo→SingleContractInfo/DisjointContractInfowith sibling typesContractDescriptor→EnumeratedContractDescriptor/NumericOutcomeContractDescriptorOracleInfo→SingleOracleInfo/MultiOracleInfoTesting
Finance Lib Logic Updates
Key Achievements
100% Rust-DLC Compatibility
cetSignatures→cetAdaptorSignaturesModern DLC Specification
Technical Details
Breaking Changes
Testing