Repository navigation
Commit b45d6d9
committed
Pin the envelope opcode allowlist
parse_envelope_script accepts four opcodes: OP_FALSE, OP_RETURN, PUSHDATA1
and PUSHDATA2. That is the whole on-chain surface of this protocol - a
root_id and a state hash, under a hundred bytes - and it is deliberately
narrow.
PUSHDATA4 was already rejected, but nothing held it there. The existing tests
cover truncation and the push-length ranges, so widening the allowlist later
would not have failed anything.
PUSHDATA4 is the case worth pinning rather than any other unused opcode: it
declares its length in four bytes, so accepting it would mean a
four-gigabyte length prefix read from a hostile script. That is the one
unused opcode whose mishandling costs memory rather than correctness.
Prompted by reading a BSV opcode table and asking which of the ~185 this
protocol actually touches. The answer is four, which is worth a test saying so.1 parent 14832a7 commit b45d6d9
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
0 commit comments