Skip to content

fix: guard factory pool count overflow - #90

Merged
prodbycorne merged 5 commits into
SmartDropLabs:mainfrom
jamilahmadzai:codex/smartdrop-poolcount-overflow-82
Jul 26, 2026
Merged

fix: guard factory pool count overflow#90
prodbycorne merged 5 commits into
SmartDropLabs:mainfrom
jamilahmadzai:codex/smartdrop-poolcount-overflow-82

Conversation

@jamilahmadzai

Copy link
Copy Markdown
Contributor

Closes #82

Bounty: GrantFox OSS campaign for issue #82

Summary

  • return a typed FactoryError::PoolCountOverflow when the factory cannot allocate the next pool ID
  • compute PoolCount with checked_add(1) before deploying or writing a pool record
  • cover the u32::MAX boundary so overflow leaves the count unchanged and does not create a Pool(u32::MAX) record

Validation

  • cargo fmt --all -- --check
  • cargo test -p factory pool_count -- --nocapture
  • cargo test -p factory create_pool -- --nocapture
  • cargo test -p factory -- --nocapture
  • cargo build
  • cargo test --workspace -- --nocapture
  • git diff --check

Notes

  • factory/src/lib.rs now only uses saturating_add for bounded pagination and checked_add for the pool-count increment
  • existing Soroban Events::publish deprecation warnings remain unchanged

@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for sdcontracts ready!

Name Link
🔨 Latest commit 7158cf1
🔍 Latest deploy log https://app.netlify.com/projects/sdcontracts/deploys/6a660553a221c6000800b088
😎 Deploy Preview https://deploy-preview-90--sdcontracts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jamilahmadzai
jamilahmadzai force-pushed the codex/smartdrop-poolcount-overflow-82 branch from 304c3d1 to 0434d1d Compare July 17, 2026 07:46
@prodbycorne

Copy link
Copy Markdown
Contributor

fix Ci build

@jamilahmadzai

Copy link
Copy Markdown
Contributor Author

Fixed the CI breakage after the upstream merge and updated the branch to current main at 9d36584. The merge had left a malformed workflow step, overlapping error code, stale factory integration-test API calls, and two adjacent function insertions without closing delimiters. Local validation now passes cargo fmt --all -- --check, release WASM builds, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace (130 tests).

@prodbycorne
prodbycorne merged commit 6f920c6 into SmartDropLabs:main Jul 26, 2026
3 of 5 checks 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.

factory: PoolCount increment via pool_id + 1 has no checked_add, risking wraparound and clobbering pool 0's record

2 participants