Skip to content

fix(uint256): align Lsh truncation safety#1272

Open
junghoon-vans wants to merge 3 commits intomainfrom
GSW-2609-uint256-lsh-semantics
Open

fix(uint256): align Lsh truncation safety#1272
junghoon-vans wants to merge 3 commits intomainfrom
GSW-2609-uint256-lsh-semantics

Conversation

@junghoon-vans
Copy link
Copy Markdown
Member

@junghoon-vans junghoon-vans commented Apr 24, 2026

Summary

  • align uint256.Lsh with truncation semantics and update the affected sqrt-price and swap fuzz expectations
  • add a overflow/range guard to getNextPriceAmount1Add so the final sqrt-price add path cannot wrap or exceed the uint160 cast boundary
  • harden launchpad tier ratio validation by rejecting negative ratios before the sum-to-100 check

Testing

  • make test PKG=gno.land/p/gnoswap/gnsmath RUN=TestSqrtPriceMath_getNextPriceAmount1Add
  • make test PKG=gno.land/p/gnoswap/gnsmath

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@junghoon-vans has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 31 minutes and 39 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 31 minutes and 39 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a2cbfa40-51c6-4098-9d1c-c7b1da55433f

📥 Commits

Reviewing files that changed from the base of the PR and between b9754cd and 2403c3b.

📒 Files selected for processing (9)
  • contract/p/gnoswap/gnsmath/errors.gno
  • contract/p/gnoswap/gnsmath/sqrt_price_math.gno
  • contract/p/gnoswap/gnsmath/sqrt_price_math_fuzz_params_test.gno
  • contract/p/gnoswap/gnsmath/sqrt_price_math_test.gno
  • contract/p/gnoswap/gnsmath/swap_math_fuzz_params_test.gno
  • contract/p/gnoswap/uint256/bitwise.gno
  • contract/p/gnoswap/uint256/bitwise_test.gno
  • contract/r/gnoswap/launchpad/v1/launchpad_project.gno
  • contract/r/gnoswap/launchpad/v1/launchpad_project_test.gno
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch GSW-2609-uint256-lsh-semantics

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.

@sonarqubecloud
Copy link
Copy Markdown

@junghoon-vans junghoon-vans self-assigned this Apr 24, 2026
@junghoon-vans junghoon-vans added the enhancement New feature or request label Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant