Skip to content

Security, optimizations, and README improvements - #9

Merged
buzzkillb merged 12 commits into
mainfrom
dev
Mar 10, 2026
Merged

Security, optimizations, and README improvements#9
buzzkillb merged 12 commits into
mainfrom
dev

Add CONTRIBUTING.md, LICENSE, and rustfmt.toml for professional open …

42dd612
Select commit
Loading
Failed to load commit list.
GitzillaBot / gitzilla required action Mar 10, 2026 in 2m 47s

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

  1. [HIGH] Test expects validate_price(0.0) to fail but implementation allows it
    Location: src/utils.rs:131
    The test test_validate_price_invalid in src/utils.rs incorrectly asserts that validate_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's save_price() rejects prices <= 0.0. Either the test should expect Ok(()) for 0.0, or validate_price should 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(...); }