Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

[H-1] Insufficient Test Coverage

Root + Impact

[H-1] Insufficient Test Coverage

Description

Insufficient testing, while not a specific vulnerability, implies a high probability of additional undiscovered vulnerabilities and bugs. It also exacerbates multiple interrelated risk factors in a complex code base. This includes a lack of complete, implicit specification of the functionality and exact expected behaviors that tests normally provide, which increases the chances of correctness issues being missed. It also requires more effort to establish basic correctness and reduces the effort spent exploring edge cases, thereby increasing the chances of missing complex issues.

Risk

Moreover, the lack of repeated automated testing of the full specification increases the chances of introducing breaking changes and new vulnerabilities. This applies to both previously audited code and future changes to currently audited code. Underspecified interfaces and assumptions increase the risk of subtle integration issues which testing could reduce by enforcing an exhaustive specification.

Proof of Concept

By cloning and installing the project dependencies, just running forge coverage returns the following:

╭-------------------+-----------------+----------------+---------------+--------------╮
| File | % Lines | % Statements | % Branches | % Funcs |
+=====================================================================================+
| script/Game.s.sol | 0.00% (0/15) | 0.00% (0/14) | 100.00% (0/0) | 0.00% (0/2) |
|-------------------+-----------------+----------------+---------------+--------------|
| src/Game.sol | 14.89% (14/94) | 15.85% (13/82) | 12.82% (5/39) | 6.67% (1/15) |
|-------------------+-----------------+----------------+---------------+--------------|
| Total | 12.84% (14/109) | 13.54% (13/96) | 12.82% (5/39) | 5.88% (1/17) |
╰-------------------+-----------------+----------------+---------------+--------------╯

Recommended Mitigation

To address these issues, consider implementing a comprehensive multi-level test suite. Such a test suite should comprise contract-level tests with 95%-100% coverage, per chain/layer deployment, and integration tests that test the deployment scripts as well as the system as a whole, along with per chain/layer fork tests for planned upgrades. Crucially, the test suite should be documented in such a way that a reviewer can set up and run all these test layers independently of the development team. Some existing examples of such setups can be suggested for use as reference in a follow-up conversation. In addition, consider merging all the test suites into a single one for better maintenance. Implementing such a test suite should be of very high priority to ensure the system's robustness and reduce the risk of vulnerabilities and bugs.

Updates

Appeal created

inallhonesty Lead Judge 10 days ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.