Repository navigation
Commit f16ea92
authored
refactor(blockchain): collapse the greedy selection loop guards (#592)
## 🗒️ Description / Motivation
Follow-up to #590, which made the coverage tie-break in
`extend_proofs_greedily`
deterministic and left the loop around it with three exits for two
conditions.
## What Changed
| File | Change |
|------|--------|
| `crates/blockchain/src/block_builder.rs` | `while
!remaining_indices.is_empty()` made the `None` arm of the best-candidate
lookup unreachable, and that arm in turn made the `proofs.is_empty()`
early return redundant. Now one `loop` with one exit — no candidate, or
none that adds coverage — and `best_count` no longer needs a binding
just to be compared against zero. The comment records that candidates
must stay in ascending order, so the `retain` is not later "optimized"
into a `swap_remove` that would reintroduce the arbitrary tie-break #590
removed |
## Correctness / Behavior Guarantees
Pure refactor — same selection, same order, same stopping point. The
removed guards were
unreachable or redundant, not load-bearing.
## Tests Added / Run
- `extend_proofs_greedily_selects_nothing_from_an_empty_pool` pins the
path the early
return used to shortcut.
- `make fmt`, `make lint`, and the 68 `ethlambda-blockchain` lib tests —
all clean on
current main.
## Related Issues / PRs
- Follow-up to #590
## ✅ Verification Checklist
- [x] Ran `make fmt` — clean
- [x] Ran `make lint` (clippy with `-D warnings`) — clean
- [x] Ran `make test` (`cargo test --workspace --profile release-fast`)
— all passing1 parent 5f04726 commit f16ea92
1 file changed
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | 804 | | |
809 | 805 | | |
810 | 806 | | |
811 | | - | |
| 807 | + | |
812 | 808 | | |
813 | 809 | | |
814 | 810 | | |
815 | 811 | | |
816 | | - | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
817 | 815 | | |
818 | 816 | | |
819 | 817 | | |
| |||
825 | 823 | | |
826 | 824 | | |
827 | 825 | | |
828 | | - | |
| 826 | + | |
| 827 | + | |
829 | 828 | | |
830 | 829 | | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | 830 | | |
835 | 831 | | |
836 | 832 | | |
| |||
1989 | 1985 | | |
1990 | 1986 | | |
1991 | 1987 | | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
1992 | 1998 | | |
0 commit comments