Skip to content

Add zero-supply sell underflow test#384

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
kitWarse:test/370-zero-supply-sell-revert
May 31, 2026
Merged

Add zero-supply sell underflow test#384
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
kitWarse:test/370-zero-supply-sell-revert

Conversation

@kitWarse
Copy link
Copy Markdown
Contributor

Summary

  • Adds a targeted sell-path regression test for the impossible state where a registered creator has zero total supply while the seller balance is nonzero.
  • The test confirms sell_key returns ContractError::SellUnderflow instead of panicking on arithmetic underflow, and verifies the failed call leaves observable state unchanged.

Issue

Changes

  • Updated creator-keys/tests/sell_underflow.rs with a distinct zero-supply creator sell test.
  • Sets up the impossible state by writing only the seller balance key under the test contract context while leaving creator supply at zero.
  • Uses capture_snapshot before and after the failed sell to assert supply, holder count, and seller key balance are unchanged.

Validation

  • Ran cargo fmt.
  • Ran git diff --check.
  • Ran cargo test -p creator-keys test_sell_registered_zero_supply_creator_returns_sell_underflow_without_state_change, but local compilation could not proceed because this Windows environment is missing the MSVC linker link.exe before repo code compiled.

Notes

  • The local test failure appears environment-related: Rust MSVC targets require Visual Studio Build Tools with the C++ linker installed.
  • Fork relationship verified: kitWarse/accesslayer-contracts is a fork of accesslayerorg/accesslayer-contracts.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@kitWarse 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 515665c into accesslayerorg:main May 31, 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 sell revert when creator has zero total supply

2 participants