Skip to content

test: pin pow round-trip second-leg revert#233

Merged
thedavidmeister merged 1 commit into
mainfrom
2026-06-12-issue-209
Jun 13, 2026
Merged

test: pin pow round-trip second-leg revert#233
thedavidmeister merged 1 commit into
mainfrom
2026-06-12-issue-209

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Summary

Adds a dedicated concrete test testRoundTripSecondLegRevert next to testRoundTripFuzzPow in test/src/lib/LibDecimalFloat.pow.t.sol, pinning the pow round-trip second-leg revert path that the fuzz test currently absorbs in a try/catch.

The test constructs the exact counterexample surfaced by fuzzing:

  • a = bytes32(1), b = bytes32(0xea5a58dfdcc79c60ac38b8284569e4519fda5eaaffec2a3d22027a4af1969e13)

and asserts:

  1. The first leg a.pow(b) succeeds.
  2. The round-trip leg c.pow(b.inv()) reverts with the exact WithTargetExponentOverflow(2696051936649033486196409040598252262955326698850935392994226984449, 363177628, 0) selector and args.

Why

A tiny coefficient combined with the large inverted exponent produces an unrepresentable rescale target during the round-trip. The fuzz test treats this as "can't round-trip this input" and silently catches it. This named test pins exactly which leg reverts and with which error, so a regression that shifts the revert boundary (which inputs revert vs round-trip cleanly) surfaces in a named test instead of being absorbed by the fuzz catch.

Verification

  • forge test --mt testRoundTripSecondLegRevert → PASS (the asserted error selector and args match the live revert exactly).
  • Full test/src/lib/LibDecimalFloat.pow.t.sol suite → 9 passed, including testRoundTripFuzzPow (5096 runs).
  • Full forge test → 452 passed; the only 5 failures are the pre-existing testProdDeployment* fork tests that require live RPC env vars (ARBITRUM_RPC_URL etc.) not set in the local sandbox — unrelated to this change (which is test-only and touches no source).

Fixes #209

🤖 Generated with Claude Code

Add a dedicated concrete test `testRoundTripSecondLegRevert` next to
`testRoundTripFuzzPow` that constructs the exact counterexample surfaced
by fuzzing (a = bytes32(1), b = 0xea5a...9e13). It asserts the first leg
`a.pow(b)` succeeds and the round-trip leg `c.pow(b.inv())` reverts with
the exact `WithTargetExponentOverflow(...)` selector and args.

The fuzz test absorbs this revert in a try/catch as "can't round-trip
this input". This named test pins which leg reverts and with which
error so a regression that shifts the revert boundary surfaces in a
named test instead of being silently swallowed by the fuzz catch.

Fixes #209

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 13, 2026
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@thedavidmeister, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 24 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1d88dbc4-7fe4-4d5e-971b-9af1eeaa61fe

📥 Commits

Reviewing files that changed from the base of the PR and between 90aa415 and fd88461.

📒 Files selected for processing (1)
  • test/src/lib/LibDecimalFloat.pow.t.sol
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-06-12-issue-209

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thedavidmeister

Copy link
Copy Markdown
Contributor Author

Reviewed fd88461: pin the pow round-trip second-leg ExponentOverflow revert with an exact counterexample; mutation-validated discriminating test (not enshrining). All checks green. LGTM.

@thedavidmeister thedavidmeister merged commit d205930 into main Jun 13, 2026
9 checks passed
@github-actions

Copy link
Copy Markdown

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

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.

test: add dedicated case for pow round-trip second-leg revert

1 participant