Commit cadec00
fix(abstract-substrate): blake2_256 prehash signablePayload over 256 bytes
Substrate signs the raw encoded ExtrinsicPayload when it is at most 256
bytes, but signs the blake2_256 hash of the payload when it exceeds 256
bytes. The signablePayload getter previously always returned the raw
bytes, so for large extrinsics (e.g. POLYX nominate with 6+ validators)
the BitGoJS user signed the raw payload while the HSM signed the hash,
causing TSS signature combination to fail with InvalidSignature.
Return blake2_256(raw) (32 bytes) when the payload is larger than 256
bytes, and the raw bytes otherwise, so all downstream consumers
(sdk-coin-polyx, sdk-coin-dot, recovery flows) get the correct
signableHex without coin-specific logic.
Generated with [Linear](https://linear.app/bitgo/issue/SI-911/fix-signablepayload-to-apply-substrate-blake2-256-prehash-when#agent-session-0bfb5d75)
Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>1 parent 99f90f8 commit cadec00
2 files changed
Lines changed: 45 additions & 2 deletions
File tree
- modules
- abstract-substrate/src/lib
- sdk-coin-polyx/test/unit/transactionBuilder
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
536 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
537 | 547 | | |
538 | 548 | | |
539 | 549 | | |
540 | 550 | | |
541 | | - | |
| 551 | + | |
| 552 | + | |
542 | 553 | | |
543 | 554 | | |
544 | 555 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
182 | 214 | | |
183 | 215 | | |
184 | 216 | | |
| |||
0 commit comments