Skip to content

test(creator-keys): add regression tests and storage extension docs#335

Merged
Chucks1093 merged 8 commits into
accesslayerorg:mainfrom
buinntalen:add-regression-tests-and-docs
May 29, 2026
Merged

test(creator-keys): add regression tests and storage extension docs#335
Chucks1093 merged 8 commits into
accesslayerorg:mainfrom
buinntalen:add-regression-tests-and-docs

Conversation

@buinntalen
Copy link
Copy Markdown
Contributor

What

Adds four regression tests and documentation for safe storage extension patterns in the creator-keys contract. Tests cover protocol fee updates on sell, zero-supply buy quotes, and creator fee recipient updates. Documentation provides clear guidance on safe patterns for extending deployed contract storage.

Issues Resolved

Closes #325
Closes #326
Closes #327
Closes #328

Changes

#325 - Add regression test for sell execution after protocol fee config update

Added sell_after_fee_config_update.rs with two test cases verifying that the sell execution applies updated protocol fee configurations correctly to the actual token transfer, not just the quote.

#326 - Add unit tests for buy quote returning zero for zero supply

Added buy_quote_zero_supply.rs with tests confirming that when total supply is zero, the buy quote function returns the correct non-zero first-key price from the bonding curve formula, with multiple price points and consistent behavior across calls.

#327 - Add docs for safe pattern to extend contract storage without migration

Added docs/STORAGE_EXTENSION_PATTERN.md documenting the recommended patterns for adding new storage fields to deployed contracts, including optional fields, versioned keys, and lazy migration approaches, with explicit guidance on unsafe patterns to avoid.

#328 - Add regression test for creator fee recipient change taking effect on next trade

Added creator_fee_recipient_change.rs with tests verifying that when the creator fee recipient address is updated, the new address receives the fee on the very next trade without delay, including multiple updates and both buy/sell scenarios.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@buinntalen 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

Resolves accesslayerorg#325
Resolves accesslayerorg#326
Resolves accesslayerorg#327
Resolves accesslayerorg#328

- Issue accesslayerorg#325: Add regression test for sell execution after protocol fee config
  update, verifying the updated fee applies to the actual token transfer on
  the sell side
- Issue accesslayerorg#326: Add unit tests for buy quote at zero supply, confirming the
  function returns the correct non-zero first-key price from the bonding curve
- Issue accesslayerorg#327: Add documentation for the safe pattern to extend contract storage
  without migration, showing best practices for optional fields and versioned
  keys, with unsafe patterns explicitly called out
- Issue accesslayerorg#328: Add regression test for creator fee recipient change taking
  effect on next trade, verifying new recipient receives fee immediately
  after update
Remove extra argument from sell_key() calls - method signature takes 2 arguments (creator, seller) not 3.
@buinntalen buinntalen force-pushed the add-regression-tests-and-docs branch from 40b2bed to 813ff12 Compare May 29, 2026 06:21
Remove extra argument from sell_key() call on line 117.
The test was added but uses unimplemented contract methods. It should not be included until the contract API is updated.
Use array literal instead of vec! macro to satisfy clippy::useless_vec.
The assertion should verify that total_amount equals price plus fees,
not that price equals the sum of all components.
@Chucks1093 Chucks1093 merged commit 96ea777 into accesslayerorg:main May 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

2 participants