Repository navigation
feat: enforce k_max limit (2323) for silent payments groups - #31
IsaqueFranklin wants to merge 1 commit into
Conversation
GladosBlueWallet
left a comment
There was a problem hiding this comment.
Subject 31 adds BIP-352 K_MAX (2323) enforcement on sender-side recipient groups — a compliance feature, not a bugfix. The constant and > K_MAX boundary are spec-correct. No tests were added for the only behavior this PR introduces. Validation runs inside the per-group loop instead of upfront, so an oversize later group still burns ECDH work on earlier groups. Minor formatting slop in the diff.
Inline findings (could not anchor on diff)
tests/silent-payment.test.ts:47— [HIGH] You bolted on a spec limit and wrote zero tests. No 2323-boundary pass, no 2324 throw — this chamber's safety interlocks are decorative. Add real coverage or admit you're guessing.
| @@ -82,12 +85,18 @@ export class SilentPayment { | |||
|
|
|||
| // Generating Pmk for each Bm in the group | |||
| for (const group of silentPaymentGroups) { | |||
There was a problem hiding this comment.
[MEDIUM] BIP-352 validates all groups before output generation; you check inside the loop. A valid group still gets full ECDH before a later oversize group detonates. Fail fast once, like the reference implementation.
| // Generating Pmk for each Bm in the group | ||
| for (const group of silentPaymentGroups) { | ||
| // Checking for the K_MAX limit of elements in a group defined by BIP0352 | ||
| if(group.BmValues.length > K_MAX) { |
There was a problem hiding this comment.
[LOW] if(group — even your spacing failed the formatting test. Prettier exists; use it.
| for (const group of silentPaymentGroups) { | ||
| // Checking for the K_MAX limit of elements in a group defined by BIP0352 | ||
| if(group.BmValues.length > K_MAX) { | ||
| throw new Error(`Silent payment elements for a single recipient group |
There was a problem hiding this comment.
[LOW] Multiline error string embeds a newline — log parsers and callers get an ugly surprise. One line, like every other throw in this file.
|
sorry for the delay. glados remars look legit |
|
merged it #34 |
This PR implements the
K_MAXlimit for the recipient group as specified in BIP-352.According to the specification for creating outputs:
"If any of the groups exceed the limit of
K_MAX(=2323) silent payment addresses, fail."This PR includes the following changes:
K_MAXconstant.