fix(factory): use checked_add for PoolCount, add PoolCountOverflow er… #82 - #104
Open
musameshack461-star wants to merge 1 commit into
Open
Conversation
…ror (SmartDropLabs#82) - Replace bare pool_id + 1 with checked_add(1).ok_or(PoolCountOverflow)? so overflow is caught as a typed contract error regardless of the Cargo profile's overflow-checks setting. - Add FactoryError::PoolCountOverflow = 8 to types.rs. - checked_add is evaluated before deploy_v2, so no deployment side effect can occur at the overflow boundary. - Add test_create_pool_at_max_pool_count_returns_overflow_error: seeds PoolCount to u32::MAX via env.as_contract, asserts the typed error is returned, and verifies PoolCount is not mutated on failure. - Remove stale SmartDropLabs#78 workarounds from factory_pool_integration.rs: two tests were manually calling pool_client.initialize after create_pool, which is now wrong since create_pool initializes pools in the same transaction. Also fix the daily_rate in end_to_end_create_pool_then_lock_and_unlock from 300 (below LEDGERS_PER_DAY) to 34_560 (2 * 17_280 = credit_rate 2). All 45 unit tests and 3 integration tests pass.
✅ Deploy Preview for sdcontracts ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #82
All 45 unit tests and 3 integration tests pass.