Skip to content

fix: correct signed relative approximate assertions - #1166

Open
DicksonWu654 wants to merge 3 commits into
runtimeverification:masterfrom
DicksonWu654:fix/signed-approx-assertions
Open

fix: correct signed relative approximate assertions#1166
DicksonWu654 wants to merge 3 commits into
runtimeverification:masterfrom
DicksonWu654:fix/signed-approx-assertions

Conversation

@DicksonWu654

@DicksonWu654 DicksonWu654 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

  • decode the int256 overload operands as signed big-endian ABI integers before relative-error arithmetic
  • leave the uint256 overload word decoding unchanged
  • enable the existing opposite-sign signed unit regression for both message and no-message overloads

Root cause

Both overloads previously shared a dispatcher that decoded a and b with #asWord. For the signed overload, negative int256 values therefore entered relative-error arithmetic as unsigned two-complement words. For example, 4 and -2 with a 1e18 tolerance could incorrectly pass.

The signed selector now uses Bytes2Int(..., BE, Signed) for a and b; maxPercentDelta remains an unsigned word. The common unbounded-Int relative-error rules continue to handle zero and int256 edge values without overflow. The signed message overload receives the same operand correction, without changing its separate string decoding or percentage formatting behavior.

Regression coverage

The existing passing opposite-sign unit fixture is enabled and exercises both the message and no-message signed overloads in both operand orders under the same tolerance. The already-active same-sign signed fixture remains a positive control. Exact revert-message cases remain skipped because they also depend on pre-existing error-string offset decoding and percentage formatting behavior outside this fix.

Testing

Tests were not run locally under the review constraint. The focused passing end-to-end fixture is enabled for upstream CI.

@DicksonWu654
DicksonWu654 marked this pull request as ready for review September 1, 2026 02:47
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