Tighten nut-11 spending conditions #358
No reviewers
Labels
No labels
breaking change
bug
documentation
enhancement
needs discussion
needs implementation
new nut
ready
wallet-only
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-admin/nuts!358
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "robwoodgate/nut11-malformed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR removes ambiguity by tightening the spending conditions to specifically reject malformed P2PK secrets.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)- `n_sigs_refund: <int>` specifies the minimum number of [Refund Multisig](#refund-multisig) public keys providing valid signatures after `locktime` expiresThis PR tightens tag-count rules well, but n_sigs and n_sigs_refund values themselves are still underspecified. Three edge cases remain unaddressed:
n_sigs = 0: is this a valid anyone can spend shorthand or a malformed proof?n_sigs > total available keys: unsatisfiable condition, should the proof be immediately rejected at mint time or only at spend time?A non-integer string value like
"two": the existing spec already says wallets/mints must cast types, but there's no rejection rule here comparable to the new duplicate-tag rule.i suggest adding a line such as: "If
n_sigsorn_sigs_refundis not a positive integer, or exceeds the total number of keys in its pathway, the P2PK secret is malformed and the Proof MUST be rejected as invalid."the sentence "A public key may appear in both the Locktime Multisig and Refund Multisig pathways at the same time, but only ONCE in each pathway" could be interpreted as blanket permission for duplicates as long as they span two pathways.
I suggest we reword to something like this:
"Within a single pathway (Locktime or Refund), each key MUST be unique by its x-coordinate. A key that is unique within each pathway MAY appear in both pathways simultaneously."
this makes it constraint first, then the permission, which is the safer reading order for implementers.
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)- `n_sigs_refund: <int>` specifies the minimum number of [Refund Multisig](#refund-multisig) public keys providing valid signatures after `locktime` expiresGood point. I think malformed.
Secret is blinded at mint time, so only rejectable at spend time. This condition is "unspendable" (malformed).
Malformed - the spec clearly defines these as "integer"
I like that. Will add.
Thanks @KvngMikey - I cleaned it up and went constraint first
lgtm
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)I think rejected is not clear that it means the proof is unspendable.
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)so if I change to 'be rejected as unspendable`?
Or just 'and the Proof MUST be treated as unspendable`?
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)changed invalid to unspendable.
@thesimplekid @callebtc - we have merged implementations across the core repos.
Can we consider merging, unless any other wording tweaks required?
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)- `n_sigs_refund: <int>` specifies the minimum number of [Refund Multisig](#refund-multisig) public keys providing valid signatures after `locktime` expiresEach of the above tags may appear exactly **ONCE** in a P2PK secret. If a tag appears more than once, the P2PK secret is malformed and the Proof **MUST** be rejected as unspendable.As per discussion, we could enforce split handling on the mint and wallet sides.
@ -82,6 +82,10 @@ Supported tags are:- `refund: <hex_str>` are additional public keys that can provide signatures after `locktime` (_allows multiple entries_)- `n_sigs_refund: <int>` specifies the minimum number of [Refund Multisig](#refund-multisig) public keys providing valid signatures after `locktime` expiresEach of the above tags may appear exactly **ONCE** in a P2PK secret. If a tag appears more than once, the P2PK secret is malformed and the Proof **MUST** be rejected as unspendable.What change in wording would work for you?
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.