Skip to content

Conversation

@aso20455
Copy link
Contributor

The test was using 1n << (32n - 1n) which gives 2^31 instead of the actual max value 2^32-1. Same issue with MAX_UINT48.

This meant only half of the valid uint32/uint48 range was being tested - values from 2,147,483,649 to 4,294,967,295 were never checked.

Changed to 2n ** 32n - 1n to match what Solidity actually allows (type(uint32).max) and to be consistent with test/helpers/constants.js.

@aso20455 aso20455 requested a review from a team as a code owner November 11, 2025 12:26
@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

⚠️ No Changeset found

Latest commit: 92aff7f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Walkthrough

The changes update maximum value constants for unsigned 32-bit and 48-bit integers in the test file. The computation method is modified from bit-shift operations (1n << (size - 1n)) to exponentiation (2n ** size - 1n). This recalculates the upper bounds from 2^(size-1) to 2^size - 1, affecting how maximum values are validated during testing. The modifications remain internal to the test file with no impact on public exports.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: fixing incorrect MAX_UINT32 and MAX_UINT48 constants in the Time.test.js file.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug fix with specific details about the incorrect bit shift operations and the corrected values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6308fdc and 4a3011d.

📒 Files selected for processing (1)
  • test/utils/types/Time.test.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: halmos
  • GitHub Check: coverage
  • GitHub Check: tests-foundry
  • GitHub Check: tests-upgradeable
  • GitHub Check: slither
  • GitHub Check: tests
  • GitHub Check: Redirect rules - solidity-contracts
  • GitHub Check: Header rules - solidity-contracts
  • GitHub Check: Pages changed - solidity-contracts
🔇 Additional comments (1)
test/utils/types/Time.test.js (1)

9-10: Constants correctly defined and consistent with test/helpers/constants.js.

The fix properly computes maximum unsigned integer values:

  • MAX_UINT32: 2^32 - 1 = 4,294,967,295
  • MAX_UINT48: 2^48 - 1 = 281,474,976,710,655

Verification confirms these match the definitions in test/helpers/constants.js. The constants are correctly used throughout the test file.


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.

@ernestognw ernestognw changed the title test: fix MAX_UINT32 and MAX_UINT48 constants in Time.test.js Adjust MAX_UINT32 and MAX_UINT48 constants in Time.test.js Nov 13, 2025
@ernestognw ernestognw changed the base branch from master to typo-fixes November 13, 2025 15:06
@ernestognw ernestognw merged commit fe75ac0 into OpenZeppelin:typo-fixes Nov 13, 2025
17 of 19 checks passed
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.

2 participants