Skip to content

const-eval panic in revm-interpreter 19.1.0: Uint<256>::to_be_bytes::<20> hits ruint 1.17.2 assert_bytes on rustc 1.93+ #3728

Description

@bajpainaman

Summary

`revm-interpreter` v19.1.0 calls `Uint<256>::to_be_bytes::<20>()` at `crates/interpreter/src/interpreter_types.rs:225`. On rustc 1.93+ (both stable and nightly), this triggers `ruint` v1.17.2's `const { Self::assert_bytes(BYTES) }` panic at `ruint-1.17.2/src/bytes.rs:96`:

```
error[E0080]: evaluation panicked: BYTES must be equal to Self::BYTES
note: instantiating fn ruint::bytes::<impl Uint<256, 4>>::to_be_bytes::<20>
note: at revm-interpreter-19.1.0/src/interpreter_types.rs:225
self.pop().map(|value| Address::from(value.to_be_bytes()))
```

The const block is asserting BYTES (20) == Self::BYTES (32 for U256), which is structurally impossible. Earlier rustc versions silently dead-code-eliminated the assert; recent toolchains evaluate it.

Reproduction

```bash
git clone <gevm fuzz crate that depends on revm-interpreter 19.1.0>
cargo +nightly fuzz run fuzz_revm_diff --features cuda --release --sanitizer none
```

(Reproduces under stable 1.93 with `cargo fuzz run` since cargo-fuzz uses libfuzzer-sys's coverage instrumentation.)

Affected versions

  • revm-interpreter v19.1.0
  • (Likely fixed in later versions but not bug-fix-released into the 19.x line)

Suggested fix

The call site should use `value.to_be_bytes::<32>()` and slice `[12..]` to extract the 20-byte address, OR use `Address::from_word(value.into())` if a U256→Address conversion already exists in alloy-primitives.

Workaround

Pin to revm-interpreter ≤18.0.0 (via revm 22) — though this introduces API delta with anything using revm 23.

Why this matters

revm-interpreter 19.1.0 is a recent dependency chain that compiles fine on older rustc but blocks all downstream projects on rustc 1.93+. Specifically blocks GPU EVM differential fuzzing in gevm (bajpainaman/gevm).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions