Gitzilla review complete
1 issue found.
This pull request introduces several security, performance, and documentation improvements to the RustyMcPriceface cryptocurrency tracking bot. The changes include binding the health endpoint to localhost via docker-compose for security, replacing unsafe unwrap calls throughout the codebase with safer error handling, and optimizing the update interval from 300 seconds to 12 seconds. The database cleanup interval was increased to 48 hours, and the docker-compose configuration was simplified using env_file. The database module now validates and skips saving invalid (zero or negative) prices. Documentation was improved with updated Pyth Network URLs, a health check curl example, and tech stack details. A new test suite was added for the database and utils modules, along with CI workflow, CONTRIBUTING guidelines, and an MIT license. The standalone db_query.rs CLI tool was removed as it was not integrated into the main application flow.
Details
- [HIGH] Test expects validate_price(0.0) to fail but implementation allows it
Location: src/utils.rs:131
The testtest_validate_price_invalidin src/utils.rs incorrectly asserts thatvalidate_price(0.0)should return an error. However, the actual implementation only rejects negative prices (price < 0.0), not zero. This causes the test to fail, blocking the PR. Additionally, there is an inconsistency:validate_price()allows 0.0 but the database'ssave_price()rejects prices <= 0.0. Either the test should expectOk(())for 0.0, orvalidate_priceshould be updated to reject 0.0 to match the database behavior.
Suggested fix: Change test to:assert!(validate_price(0.0).is_ok());OR update validate_price to reject 0.0:if price <= 0.0 { return Err(...); }