Commit 939b879
fix(interpreter): use IntoAddress in pop_address to avoid const-eval panic (#3735)
* fix(interpreter): use IntoAddress in pop_address to avoid const-eval panic
`StackTr::pop_address` converted the popped word with
`Address::from(value.to_be_bytes())`. Since `Address: From<[u8; 20]>`, type
inference forces ruint's const-generic `Uint::<256, 4>::to_be_bytes::<20>()`,
whose `const { Self::assert_bytes(BYTES) }` requires `BYTES == Self::BYTES`
(32 for U256). That unreachable const block is only sometimes dead-code
eliminated; build profiles that actually evaluate it (cargo-fuzz coverage,
release codegen) hit `error[E0080]: BYTES must be equal to Self::BYTES`,
breaking downstream builds (#3728).
Use the crate's existing `IntoAddress` converter (`value.into_address()`),
which does `Address::from_word(B256::from(value.to_be_bytes()))`. Its
`to_be_bytes()` infers the correct `[u8; 32]` size, so there is no fragile
const-generic instantiation, and `pop_address` now reuses the canonical
U256->Address conversion instead of inlining its own.
Add a regression test asserting `pop_address` truncates a full 32-byte word to
its low 20 bytes and returns `None` on an empty stack.
Closes #3728
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(interpreter): drop pop_address regression test per review
Remove `pop_address_truncates_to_low_20_bytes` as requested in review on
#3735 — the truncation behaviour is covered by the shared `IntoAddress`
conversion path and the dedicated test is not needed.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent eea3e18 commit 939b879
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
0 commit comments