Skip to content

test: improve test coverage#16

Open
think-in-universe wants to merge 26 commits intofix/create-liquidity-poolfrom
test/improve-test-coverage
Open

test: improve test coverage#16
think-in-universe wants to merge 26 commits intofix/create-liquidity-poolfrom
test/improve-test-coverage

Conversation

@think-in-universe
Copy link
Copy Markdown
Collaborator

@think-in-universe think-in-universe commented Jan 15, 2026

Fixes TOB-TEESOLVER-3. Tests for below functions:

  1. Function remove_compose_hash: covered in this PR
  2. Function change_owner: skip because the function has been removed
  3. Error case in find_approved_compose_hash: covered in this PR
  4. Error case in on_create_liquidity_pool_account: covered in this PR
  5. Function on_deposit_into_pool: No new tests are needed. Already covered by the helper function deposit_into_pool
  6. Function deposit_into_pool: No new tests are needed. Already covered by the helper function deposit_into_pool
  7. Function ft_on_transfer: No new tests are needed. Already covered by the helper function deposit_into_pool
  8. Function migrate: covered in this PR
  9. Function upgrade: covered in this PR
  10. Function get_owner_id: skip because the function has been removed
  11. Function get_approved_compose_hash: covered in this PR
  12. Function get_pool_len: covered in this PR
  13. Function get_worker_len: covered in this PR
  14. Function get_workers: covered in this PR
  15. Function get_worker_ping_timeout: covered in this PR

The PR is for fixing audit reported issues. Please hold on the merge before we finish the review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds test coverage for multiple functions in the solver-registry contract as part of fixing audit-reported issues (TOB-TEESOLVER-3). The changes include new test files, helper functions, and minor code improvements to support better testing.

Changes:

  • Added comprehensive tests for admin functions (remove_compose_hash, upgrade, migrate)
  • Added test for parallel pool creation race condition scenario
  • Added helper functions and view methods for testing
  • Introduced constant for default worker ping timeout to improve maintainability
  • Fixed typo in comment and updated upgrade function to use access control

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
contracts/solver-registry/tests/test_admin.rs New file with tests for compose hash removal, contract upgrade, and non-owner access scenarios
contracts/solver-registry/tests/test_pool.rs New file with test for parallel pool creation race condition
contracts/solver-registry/tests/test_register_worker.rs Added tests for invalid app_compose JSON and getter functions; replaced hardcoded timeout values
contracts/solver-registry/tests/test_single_active_worker.rs Replaced hardcoded timeout values with constant
contracts/solver-registry/tests/common/utils.rs Added helper functions for remove_compose_hash and various view methods
contracts/solver-registry/tests/common/constants.rs Added DEFAULT_WORKER_PING_TIMEOUT_MS constant
contracts/solver-registry/src/upgrade.rs Replaced assert_owner() with access control decorator and updated function call references
contracts/solver-registry/src/lib.rs Added upgrade module
contracts/solver-registry/src/admin.rs Fixed typo in comment ("has" -> "hash")
.gitignore Removed .cargo/ from ignore list
.cargo/config.toml New file with build optimizations for memory usage and test compilation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@think-in-universe think-in-universe force-pushed the test/improve-test-coverage branch from 082375d to 6822f51 Compare January 19, 2026 08:33
Copy link
Copy Markdown
Collaborator Author

@think-in-universe think-in-universe Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK to remove this upgrade module because near-plugins has already support contract upgradability.

Just let me know what's your thoughts about this.

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.

2 participants