Skip to content

v2.0.0-rc.8

Pre-release
Pre-release

Choose a tag to compare

@bennyhodl bennyhodl released this 28 Sep 16:58
· 19 commits to master since this release
cae51dc

DLC DevKit v2.0.0-rc.8

This release restores the 1.x rule for an offer's CET locktime. The locktime may again be earlier than the closest oracle event maturity. As a result, CETs can be broadcast as soon as the oracles attest, and contracts can close early. In rc.7, every CET was pinned to the event maturity. That blocked early closes and made peers reject offers whose cet_locktime was set to the current time.

⚠️ Breaking Changes

  • CreateOfferParams::cet_locktime is now Option<u32> (50ff28d). Pass None to have create_offer use the current time. Pass Some(t) to set a locktime explicitly. Callers that passed a bare u32 need to wrap it in Some(..).
  • OfferedContract::new takes the CET locktime as a parameter again (50ff28d). In rc.7 it derived the locktime from the closest announcement maturity. Callers that build an OfferedContract directly must now pass it in.
  • Manager offers default to the current time (50ff28d). Manager::offer_contract sets the CET locktime from the manager's clock, as in 1.x, not from the closest maturity. CETs on new offers are valid as soon as the offer is created.

🐛 Bug Fixes

  • CET locktime may precede the event maturity (68c643f). OfferDlc::validate required cet_locktime == closest maturity. The CET locktime is the transaction's nLockTime, so this rule made every CET unbroadcastable until maturity, even after an oracle attested early. Offers with cet_locktime = now, which are used to close loans early on attestation, failed on every accept. The rule is now cet_locktime <= closest maturity, as in 1.x. The refund interval check is unchanged.
  • Accept compares the clock with maturity, not the CET locktime (68c643f). Manager::accept_contract_offer used cet_locktime as a stand-in for maturity, so it rejected offers with an early locktime at accept. It now checks against the closest announcement maturity. That value comes from the same helper the manager uses to set its own offer locktime.
  • Offers are validated at creation (50ff28d). The locktime rule now lives in one place, OfferDlc::validate_cet_locktime. validate calls it when an offer is received. create_offer and Manager::offer_contract call it when an offer is built, so neither can produce an offer the counterparty would reject.

🔧 Other Changes

  • Tests (68c643f, 50ff28d):
    • The stateless execution harness now takes the event maturity and the CET locktime as separate inputs.
    • A new regtest test confirms a CET weeks before maturity.
    • The manual close in the manager execution tests now runs before maturity.
    • Every manager offer is checked to carry its creation time as its CET locktime.
    • The regtest early-close test leaves the locktime to create_offer.
  • Examples (50ff28d): stateless_splice and the shared stateless example are updated for the Option<u32> locktime.

⬆️ Upgrading

  • Wire compatibility:
    • rc.8 accepts every offer that rc.7 accepted. An offer whose cet_locktime equals the closest maturity still meets cet_locktime <= closest maturity.
    • rc.8 also accepts offers with an earlier locktime, including those from 1.x peers and Lygos offers with cet_locktime = now.
    • Offers from rc.8 managers use the creation time as their locktime by default, so peers still on rc.7 will reject them. Upgrade both sides before exchanging new offers.
  • Existing contracts: Contracts negotiated under rc.7 keep the CET locktime they were signed with. They still settle as before, at or after maturity.
  • Code changes: Wrap explicit locktimes in Some(..) or pass None for the default. Update any direct calls to OfferedContract::new to pass the locktime.

📦 Installation

Add DDK to your Cargo.toml:

[dependencies]
ddk = "2.0.0-rc.8"

All workspace crates are published at 2.0.0-rc.8:

Crate Description
ddk Main DLC DevKit library
ddk-manager DLC management and coordination
ddk-dlc Core DLC functionality
ddk-messages DLC message protocol implementation
ddk-trie Trie data structure for DLC
ddk-payouts Payout calculation utilities
ddk-node DLC node implementation
kormir Oracle implementation