Skip to content

Compare buffer lengths in SMT buffer equality - #1204

Merged
msooseth merged 1 commit into
mainfrom
fix-smt-buf-eq-length
Oct 19, 2026
Merged

msooseth merged 1 commit into
mainfrom
fix-smt-buf-eq-length

Conversation

@msooseth

Copy link
Copy Markdown
Collaborator

Description

PEq on buffers was encoded in SMT as array equality only, ignoring length. Buffers that differ only in length then compared equal: revert(4, 32) vs mstore(31, byte(0, iszero(calldataload(0)))); revert(32, 31) was reported equivalent, although one reverts with 32 zero bytes and the other with 31. Found by eq-fuzz-cex-replays.

The encoding now also asserts that the buffer lengths are equal. This matches peq on concrete buffers and the keccak injectivity assumptions. Return data was affected the same way; both cases have regression tests.

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

PEq on buffers was encoded as array equality only, so buffers differing
only in length (e.g. all-zero revert data of 31 vs 32 bytes) compared
equal and the equivalence checker missed the difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@msooseth
msooseth merged commit 04fe341 into main Oct 19, 2026
9 checks passed
@msooseth
msooseth deleted the fix-smt-buf-eq-length branch October 19, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant