Repository navigation
fix: enforce legacy multisig public key limit - #166
Harshil-1603 wants to merge 2 commits into
Conversation
Assisted-by: Codex
fametrano
left a comment
There was a problem hiding this comment.
tACK 1bdd763
I ran 30 descriptors through getdescriptorinfo on Core v31.1.0 and through Descriptor.from_string on master and on this branch. Happy to share the script. With 21 keys, multi and sortedmulti are rejected under wsh(), sh(wsh()) and sh(), and multi nested in or_d(), as in Core. Master accepts all of these. Twenty keys still pass, and so do multi_a and sortedmulti_a with 21.
Two gaps remain. Core rejects sh(multi(...)) and sh(sortedmulti(...)) once the redeem script exceeds 520 bytes, which is 16 or more compressed keys. embit still accepts both with 16 to 20 keys, and that output cannot be spent. #168 closes it. Core also rejects sortedmulti nested in miniscript, as in wsh(or_d(sortedmulti(...),pk(...))), which embit accepts. #170 closes that.
|
Code looks good at 1bdd763: 21 keys are rejected for One thing to fix before merging: the new tests won't run under MicroPython.
CI only runs pytest, so this doesn't show up there. A plain |
Use plain loops instead of unsupported subTest contexts, preserving all assertions. Use hexlify for older MicroPython builds where applicable. Assisted-by: OpenAI Codex
Legacy
multiandsortedmulticurrently pass verification with more than 20 public keys, producing scripts that Bitcoin'sCHECKMULTISIGcannot execute. Reject these oversized legacy fragments during verification, including when they are parsed through a descriptor. Keep Taprootmulti_aandsortedmulti_aindependent of this legacy limit.Fixes #139.
Validation:
git diff --checkpassed. Whole-file Black checks report pre-existing spacing differences outside the changed code; those unrelated lines are preserved.Implemented and tested with Codex assistance.