Commit 0b10743
authored
refactor(blockchain): use Store::head_state in update_safe_target (#571)
## 🗒️ Description / Motivation
Extracted from #561. Independent of the heartbeat work, so it lands on
its own.
`update_safe_target` open-coded the `get_state(&head())` chain that
`Store::head_state()` already encapsulates, carrying an extra `unwrap`
for no reason.
## What Changed
- `crates/blockchain/src/store.rs` — `update_safe_target` reads the
validator count through `store.head_state()`.
## Correctness / Behavior Guarantees
Equivalent, checked rather than assumed: `Store::head_state()`
(`crates/storage/src/store.rs:1696`) is exactly
`self.get_state(&self.head().expect(..)).expect(..).unwrap()` — the same
Result→panic, Result→panic, Option→panic chain the inline version had.
Only the `expect` messages differ.
This is the only site in the codebase that open-coded the chain.
## Tests Added / Run
No new tests — no behavior change to cover.
```
make fmt
make lint
make leanSpec/fixtures # fixtures were absent in the worktree
cargo test --workspace --profile release-fast --no-fail-fast
```
## Related Issues / PRs
- Extracted from #561
## ✅ 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 350bda7 commit 0b10743
1 file changed
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 151 | + | |
155 | 152 | | |
156 | 153 | | |
157 | 154 | | |
| |||
0 commit comments