Commit 77b087c
authored
calculate sig ops on fly (#597)
* initial impl of calculation sig operations on fly
* refactor/rename add docs
* impl test for runtime calculation of signature ops
* hf activation test
* refactor: rename sig_op_required to used_sig_ops
* fix error message
* add comment
* add comments describing SignatureScriptBuilder used in tests
* impl consume sig op function
* refactor: update test case names for clarity and consistency
* style: fmt
* update misleading comment
* fix misleading comment
* fix doctest
* refactor: ensure signature count is within u8::MAX limit
* add comment describing Compile-time check
* txscript: Make RuntimeSigOpCounter fields private with public accessors
Make the fields of RuntimeSigOpCounter private and add:
- A constructor (new) that ensures consistency between limit and remaining
- Getter methods for accessing the private fields
- Updated example code to use the new API
This change improves encapsulation by ensuring the counter's internal state
can only be modified through the consume_sig_ops method, preventing
potential inconsistencies between sig_op_limit and sig_op_remaining that
could occur with direct field access.
* refactor simulation fn
* rename functions and update documentation related to sig op counting
* txscript: Move sig op counting to signature verification
* txscript: Move RuntimeSigOpCounter to separate module, improve docs
* style: fmt
* fix misleading comment
* decrease cache size due to fact it wont be used1 parent 1ef4bdc commit 77b087c
File tree
14 files changed
+742
-113
lines changed- consensus
- benches
- core/src/config
- src
- consensus
- processes/transaction_validator
- crypto/txscript
- errors/src
- examples
- src
- opcodes
- standard
- mining/src/mempool
- testing/integration/src
- wallet/pskt/src
14 files changed
+742
-113
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| |||
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | | - | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
| 415 | + | |
414 | 416 | | |
415 | 417 | | |
416 | 418 | | |
| |||
476 | 478 | | |
477 | 479 | | |
478 | 480 | | |
| 481 | + | |
479 | 482 | | |
480 | 483 | | |
481 | 484 | | |
| |||
539 | 542 | | |
540 | 543 | | |
541 | 544 | | |
| 545 | + | |
| 546 | + | |
542 | 547 | | |
543 | 548 | | |
544 | 549 | | |
| |||
595 | 600 | | |
596 | 601 | | |
597 | 602 | | |
| 603 | + | |
598 | 604 | | |
599 | 605 | | |
600 | 606 | | |
| |||
654 | 660 | | |
655 | 661 | | |
656 | 662 | | |
| 663 | + | |
657 | 664 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
165 | | - | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| |||
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
174 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
175 | 183 | | |
176 | 184 | | |
177 | 185 | | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
| 190 | + | |
182 | 191 | | |
183 | 192 | | |
184 | | - | |
| 193 | + | |
185 | 194 | | |
186 | | - | |
| 195 | + | |
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
191 | 200 | | |
192 | 201 | | |
193 | 202 | | |
| 203 | + | |
194 | 204 | | |
195 | 205 | | |
196 | 206 | | |
197 | | - | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | 210 | | |
| |||
205 | 215 | | |
206 | 216 | | |
207 | 217 | | |
| 218 | + | |
208 | 219 | | |
209 | 220 | | |
210 | 221 | | |
211 | 222 | | |
212 | | - | |
| 223 | + | |
213 | 224 | | |
214 | 225 | | |
215 | 226 | | |
| |||
220 | 231 | | |
221 | 232 | | |
222 | 233 | | |
| 234 | + | |
223 | 235 | | |
224 | | - | |
| 236 | + | |
225 | 237 | | |
226 | 238 | | |
227 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
150 | | - | |
| 152 | + | |
| 153 | + | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| |||
295 | 298 | | |
296 | 299 | | |
297 | 300 | | |
298 | | - | |
| 301 | + | |
| 302 | + | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
| |||
305 | 309 | | |
306 | 310 | | |
307 | 311 | | |
308 | | - | |
| 312 | + | |
| 313 | + | |
309 | 314 | | |
310 | 315 | | |
311 | 316 | | |
| |||
316 | 321 | | |
317 | 322 | | |
318 | 323 | | |
319 | | - | |
| 324 | + | |
| 325 | + | |
320 | 326 | | |
321 | 327 | | |
322 | 328 | | |
| |||
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| 355 | + | |
349 | 356 | | |
350 | 357 | | |
351 | 358 | | |
| |||
455 | 462 | | |
456 | 463 | | |
457 | 464 | | |
458 | | - | |
| 465 | + | |
| 466 | + | |
459 | 467 | | |
460 | 468 | | |
461 | 469 | | |
| |||
465 | 473 | | |
466 | 474 | | |
467 | 475 | | |
468 | | - | |
| 476 | + | |
| 477 | + | |
469 | 478 | | |
470 | 479 | | |
471 | 480 | | |
| |||
476 | 485 | | |
477 | 486 | | |
478 | 487 | | |
479 | | - | |
| 488 | + | |
| 489 | + | |
480 | 490 | | |
481 | 491 | | |
482 | 492 | | |
| |||
506 | 516 | | |
507 | 517 | | |
508 | 518 | | |
| 519 | + | |
509 | 520 | | |
510 | 521 | | |
511 | 522 | | |
| |||
617 | 628 | | |
618 | 629 | | |
619 | 630 | | |
620 | | - | |
| 631 | + | |
| 632 | + | |
621 | 633 | | |
622 | 634 | | |
623 | 635 | | |
| |||
635 | 647 | | |
636 | 648 | | |
637 | 649 | | |
638 | | - | |
| 650 | + | |
| 651 | + | |
639 | 652 | | |
640 | 653 | | |
641 | 654 | | |
| |||
653 | 666 | | |
654 | 667 | | |
655 | 668 | | |
656 | | - | |
| 669 | + | |
| 670 | + | |
657 | 671 | | |
658 | 672 | | |
659 | 673 | | |
| |||
0 commit comments