Skip to content

test: add unit tests for buy slippage protection guard (#676) - #685

Merged
Chucks1093 merged 4 commits into
accesslayerorg:mainfrom
Trovic1:add-buy-slippage-protection-unit-tests
Jul 29, 2026
Merged

Chucks1093 merged 4 commits into
accesslayerorg:mainfrom
Trovic1:add-buy-slippage-protection-unit-tests

Conversation

@Trovic1

@Trovic1 Trovic1 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR adds comprehensive unit tests for the buy slippage protection guard in \creator-keys.

Covered Scenarios:

  • **Actual cost equal to \max_price**: Succeeds as expected.
  • Actual cost exceeding \max_price\ by 1 stroop: Reverts with \ContractError::SlippageExceeded.
  • \max_price\ of \u128::MAX\ (\i128::MAX\ max boundary): Never triggers the slippage guard and succeeds.
  • \max_price\ set to 0: Reverts with \ContractError::SlippageExceeded\ unless the key is free (base price = 0), in which case it succeeds.
  • No state mutation on panic: Verifies state snapshot remains unchanged when the guard panics.

Closes #676

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Trovic1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit 0c0251c into accesslayerorg:main Jul 29, 2026
1 check 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.

Add unit tests for the slippage protection guard rejecting buys where the price exceeds max_price

2 participants