test: improve test coverage#16
test: improve test coverage#16think-in-universe wants to merge 26 commits intofix/create-liquidity-poolfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
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. Comment |
There was a problem hiding this comment.
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.
082375d to
6822f51
Compare
There was a problem hiding this comment.
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.
Fixes TOB-TEESOLVER-3. Tests for below functions:
deposit_into_pooldeposit_into_pooldeposit_into_poolThe PR is for fixing audit reported issues. Please hold on the merge before we finish the review.