Commit 78a215d
authored
chore: refactor avm tx execution to generate "empty phase" events (#16676)
This simplifies tracegen so that it doesn't need to know about setup
snapshots and rollbacks anymore, doesn't need special handling for
situations when a phase is empty, and omits rows for phases skipped due
to reverts.
Note that there are two different relevant scenarios:
1. A phase is just "empty". The phase is encountered normally, but has
no contents, like when there are no revertible nullifiers to insert, or
when app logic has no enqueued calls to execute. **In this case, the
phase gets a padding row**.
2. A phase is "skipped" entirely because of a revert. Like if revertible
nullifier insertions fail, app-logic won't ever be encountered. **In
this case, app-logic doesn't even get a row.**
This PR specifically generates events for scenario 1, when a phase is
encountered, but "empty". This "empty" event drives tracegen of a
"padding" row.
Creation of an event that drives padding rows means that tracegen no
longer needs to know about setup snapshots and rollbacks to ensure that
a padding row after a revert gets the post-revert state! Because now the
post-revert state will be in the `EmptyPhaseEvent`, so tracegen can just
generate a row from the phase event as it does for other rows.
Also note that this now lets us easily differentiate between "empty"
phases versus skipped phases. Now, in tracegen, if a phase has no
events, it means that it was _skipped_ because if it was "empty" in
simulation, it would've generated an `EmptyPhaseEvent`. So, this PR also
stops generating padding rows for _skipped_ phases, which was the
originally intended mechanism proposed by @IlyasRidhuan, but it was not
implemented that way.1 parent 614ee22 commit 78a215d
File tree
7 files changed
+165
-130
lines changed- barretenberg/cpp/src/barretenberg/vm2
- common
- simulation
- events
- tracegen
- yarn-project/bb-prover/src/avm_proving_tests
7 files changed
+165
-130
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
Lines changed: 105 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
130 | 91 | | |
131 | 92 | | |
132 | 93 | | |
| |||
137 | 98 | | |
138 | 99 | | |
139 | 100 | | |
140 | | - | |
| 101 | + | |
141 | 102 | | |
142 | 103 | | |
143 | 104 | | |
144 | 105 | | |
145 | 106 | | |
146 | | - | |
| 107 | + | |
147 | 108 | | |
148 | 109 | | |
149 | 110 | | |
150 | 111 | | |
151 | 112 | | |
152 | 113 | | |
153 | 114 | | |
154 | | - | |
| 115 | + | |
155 | 116 | | |
156 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 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 | + | |
157 | 165 | | |
158 | 166 | | |
159 | 167 | | |
| |||
175 | 183 | | |
176 | 184 | | |
177 | 185 | | |
178 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
| |||
334 | 344 | | |
335 | 345 | | |
336 | 346 | | |
337 | | - | |
338 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
339 | 353 | | |
340 | 354 | | |
341 | 355 | | |
342 | | - | |
343 | | - | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
344 | 362 | | |
345 | 363 | | |
346 | 364 | | |
347 | | - | |
348 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
349 | 371 | | |
350 | 372 | | |
351 | 373 | | |
| |||
362 | 384 | | |
363 | 385 | | |
364 | 386 | | |
365 | | - | |
366 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
367 | 393 | | |
368 | 394 | | |
369 | 395 | | |
370 | | - | |
371 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
372 | 402 | | |
373 | 403 | | |
374 | 404 | | |
375 | | - | |
376 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
377 | 411 | | |
378 | 412 | | |
379 | 413 | | |
| |||
426 | 460 | | |
427 | 461 | | |
428 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
429 | 473 | | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
Lines changed: 15 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
533 | 532 | | |
534 | 533 | | |
535 | 534 | | |
| |||
538 | 537 | | |
539 | 538 | | |
540 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
| |||
555 | 560 | | |
556 | 561 | | |
557 | 562 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | 563 | | |
577 | 564 | | |
578 | 565 | | |
| |||
591 | 578 | | |
592 | 579 | | |
593 | 580 | | |
594 | | - | |
| 581 | + | |
595 | 582 | | |
596 | 583 | | |
597 | 584 | | |
| |||
640 | 627 | | |
641 | 628 | | |
642 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
643 | 637 | | |
644 | 638 | | |
645 | 639 | | |
646 | 640 | | |
647 | 641 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | 642 | | |
657 | 643 | | |
658 | 644 | | |
659 | 645 | | |
660 | 646 | | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | 647 | | |
678 | 648 | | |
679 | 649 | | |
| |||
0 commit comments