Repository navigation
v2.0.0-rc.8
Pre-release
Pre-release
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_locktimeis nowOption<u32>(50ff28d). PassNoneto havecreate_offeruse the current time. PassSome(t)to set a locktime explicitly. Callers that passed a bareu32need to wrap it inSome(..).OfferedContract::newtakes the CET locktime as a parameter again (50ff28d). In rc.7 it derived the locktime from the closest announcement maturity. Callers that build anOfferedContractdirectly must now pass it in.- Manager offers default to the current time (
50ff28d).Manager::offer_contractsets 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::validaterequiredcet_locktime == closest maturity. The CET locktime is the transaction'snLockTime, so this rule made every CET unbroadcastable until maturity, even after an oracle attested early. Offers withcet_locktime = now, which are used to close loans early on attestation, failed on every accept. The rule is nowcet_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_offerusedcet_locktimeas 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.validatecalls it when an offer is received.create_offerandManager::offer_contractcall 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_spliceand the shared stateless example are updated for theOption<u32>locktime.
⬆️ Upgrading
- Wire compatibility:
- rc.8 accepts every offer that rc.7 accepted. An offer whose
cet_locktimeequals the closest maturity still meetscet_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.
- rc.8 accepts every offer that rc.7 accepted. An offer whose
- 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 passNonefor the default. Update any direct calls toOfferedContract::newto 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 |