ethereum / ethereum/mpz

[L-1] Transcript hashing uses native-endian bit storage

Open
#372 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
298
Forks
82
PR merge metrics
No merged PRs in 30d

Description

**Context**: `crates/zk-core/src/store/prover.rs`

### Description

The transcript is updated using `adjust.as_raw_slice().as_bytes()`, which hashes the underlying `u32` storage in native endianness. This makes the transcript non-portable across architectures with different endianness and can cause cross-platform prover/verifier transcript mismatches (protocol abort/DoS).

**Impacted Code**
```rust
let adjust_len = adjust.len();
transcript.update(&adjust.as_raw_slice().as_bytes()[..adjust_len.div_ceil(8)]);
```

### `Recommendation`

Hash a canonical byte encoding of the bitstring (e.g., pack bits into bytes in a defined endianness such as little-endian, or use a serialization format that defines byte order) rather than `as_raw_slice().as_bytes()` on native words.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.