Commit 4c9f06c
committed
Merge #362: fix(bitmachine): fix frame data offsets send to tracker (fixes Execution reached a pruned branch)
9cd3446 fix(bit_machine): use cursor position instead of frame start for tracker read iterator (stringhandler)
Pull request description:
Fixes some bugs where the data sent from the bitmachine to trackers would not start at the current cursor, resulting in some random junk being seen by the tracker. This doesn't have an effect on full programs, but when pruning this seems to generate an incorrect pruning, as seen in #337.
The following code now prunes and runs correctly:
```rust
fn add(elt: u32, acc: u32) -> u32 {
let (_, sum): (bool, u32) = jet::add_32(elt, acc);
sum
}
fn main() {
let list: List<u32, 4> = list![5];
let result: u32 = fold::<add, 4>(list, 0);
assert!(jet::eq_32(result, 5));
}
```
Whereas previously it would fail on `Execution failed: Execution reached a pruned branch: fd6503b9fd020b8d4ed75deb14cc05bbcb91da392ba4b675f2b2345dabb1cde5`
Some excerpts from StderrTracker:
```
// Before fix
[ 45] exec iden 2^32 → 2^32
input 0x00000002
output 0x00000005
// After fix
[ 45] exec iden 2^32 → 2^32
input 0x00000005
output 0x00000005
```
```
/// Before fix
[ 46] exec iden (2^64? × 2^32?) × 1 → (2^64? × 2^32?) × 1
input ((L(ε),R(0x00000005)),ε)
output ((L(ε),L(ε)),ε)
// After fix
[ 46] exec iden (2 × 2^32?) × 1 → (2 × 2^32?) × 1
input ((0b0,R(0x00000005)),ε)
output ((0b0,R(0x00000005)),ε)
```
I haven't tried it on KyrylR 's specific SHRINCS test on that issue.
NOTE: I have based this off an older commit so I could test it with SimplicityHL, which doesn't compile with the latest `rust-simplicity`
NOTE: the unit test is written by Claude (Happy to remove it if needed)
ACKs for top commit:
apoelstra:
ACK 9cd3446; successfully ran local tests
Tree-SHA512: 606b75f928e253a7b9734bf6511c9663481cefd16fcc7b9d84b33927d2e06cb0f3caaa8971f46d772857f1991f272a56b554c3fbe69527c6803ca25ada5803ae2 files changed
Lines changed: 42 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 118 | + | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
| 123 | + | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
281 | 283 | | |
| 284 | + | |
282 | 285 | | |
283 | 286 | | |
284 | 287 | | |
| |||
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
394 | | - | |
| 397 | + | |
395 | 398 | | |
396 | 399 | | |
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
401 | | - | |
402 | | - | |
403 | | - | |
| 404 | + | |
| 405 | + | |
404 | 406 | | |
405 | 407 | | |
406 | 408 | | |
| |||
430 | 432 | | |
431 | 433 | | |
432 | 434 | | |
433 | | - | |
| 435 | + | |
434 | 436 | | |
435 | 437 | | |
436 | 438 | | |
| |||
669 | 671 | | |
670 | 672 | | |
671 | 673 | | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
672 | 705 | | |
673 | 706 | | |
674 | 707 | | |
| |||
0 commit comments