fix: improve mint/melt limit ux - #2161
Conversation
Default min/max mint/melt on `Ln` and `Onchain` so a single `[ln]`/`[onchain]` table that omits them loads again — the multi-backend `Vec<Ln>` deserializer had made these fields de facto required. Backends stay mandatory. Updates the example config and adds parse tests for the bounds-omitted case.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2161 +/- ##
==========================================
+ Coverage 71.88% 71.89% +0.01%
==========================================
Files 356 356
Lines 74532 74574 +42
==========================================
+ Hits 53574 53612 +38
- Misses 20958 20962 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I am OK with setting min to 1 by default. Not sure how I feel about having some default max value. Maybe it is fine that the mint does not boot until an admin sets the proper maximum values? |
|
A min of one can't really be used for onchain as it would be dust the mint could never move. I would prefer we force this being set by the operator and fix the example to show this must be set and recommend something higher. |
|
Tend to agree here that they should be required configs, with more sensible defaults per backend. These values have increased implications with onchain. Will rework with new intent and sensible defaults. |
Replace the untagged `[ln]` deserializer with a visitor so a missing min/max mint/melt reports the field (e.g. `missing field "ln.min_mint"`) instead of the opaque "untagged enum LnOneOrMany" error. Bounds remain required; the example config now sets them explicitly. Tests updated to assert the clear error.
[ln]/[onchain]mint/melt bounds stay required, but a missing config now reports explicitly instead of an opaque error. Example config also sets values to more appropriate default values to align with network policy.Description
Since 0.17.0 a single
[ln]/[onchain]block missing the mint/melt bounds fails with:The
#[serde(untagged)]deserializer (from the multi-backendVec<Ln>change) masks the real cause. This swaps it for a visitor that deserializes the single table directly, yieldingmissing field "ln.min_mint".Notes to the reviewers
min_receive_amount_sat,min_send_amount_satSuggested CHANGELOG Updates
FIXED
cdk-mintd:[ln]/[onchain]missingmin_mint/max_mint/min_melt/max_meltnow fails with a clear "missing field" error instead of the untagged-enum message (regressed in 0.17.0).Checklist
just quick-checkbefore committingcrates/cdk-ffi) — N/A