Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: medium
Invalid

Incomplete Set of Tests and Low Test Coverage.

Description

The current test suite for the in-scope smart contracts is incomplete, resulting in insufficient test coverage. The coverage can be assessed using the command forge coverage --ir-minimum, which reveals the extent of testing across the contracts in scope, as shown in the table below.

Ran 1 test suite in 68.62ms (61.20ms CPU time): 9 tests passed, 0 failed, 0 skipped (9 total tests)
| File | % Lines | % Statements | % Branches | % Funcs |
|--------------------------------------------|------------------|------------------|-----------------|----------------|
| src/core/CapitalPool.sol | 0.00% (0/4) | 0.00% (0/6) | 0.00% (0/2) | 0.00% (0/2) |
| src/core/DeliveryPlace.sol | 60.48% (75/124) | 60.65% (94/155) | 38.57% (27/70) | 66.67% (4/6) |
| src/core/PreMarkets.sol | 79.07% (170/215) | 82.14% (230/280) | 50.00% (42/84) | 88.89% (16/18) |
| src/core/SystemConfig.sol | 38.46% (20/52) | 36.67% (22/60) | 15.00% (3/20) | 50.00% (6/12) |
| src/core/TokenManager.sol | 60.00% (27/45) | 66.10% (39/59) | 35.00% (7/20) | 77.78% (7/9) |
| src/factory/TadleFactory.sol | 55.56% (5/9) | 58.33% (7/12) | 50.00% (2/4) | 66.67% (2/3) |
| src/libraries/MarketPlaceLibraries.sol | 69.23% (9/13) | 71.43% (10/14) | 60.00% (6/10) | 100.00% (2/2) |
| src/libraries/OfferLibraries.sol | 90.91% (10/11) | 87.50% (14/16) | 83.33% (5/6) | 100.00% (2/2) |

Despite the presence of 9 tests covering certain key functionalities (such as creating and aborting buy/sell offers, etc.), these tests mostly explore predefined code execution paths and do not comprehensively assess all possible scenarios. Notably, the CapitalPool.sol contract currently has 0% test coverage, and other critical contracts are only partially tested.

Achieving near-complete test coverage is crucial for the robustness of smart contract systems, especially given the internal complexity of Tadle. Comprehensive testing, including unit tests and fuzzing, should be implemented across all code paths to ensure the system's security and reliability.

Impact

The lack of comprehensive test coverage poses significant risks to the integrity and security of the smart contract system. Without thorough testing, vulnerabilities may go undetected, leading to potential exploitation by malicious actors. This could result in financial loss, data breaches, and a loss of user trust.
This issue can be rated with a severity level of "medium", as was the case in previous audits, such as: [https://solodit.xyz/issues/m04-incomplete-set-of-unit-tests-openzeppelin-notional-governance-contracts-v2-audit-markdown], [https://solodit.xyz/issues/incomplete-test-suite-openzeppelin-origin-governance-audit-markdown]. [https://solodit.xyz/issues/insufficient-tests-consensys-nuts-finance-btcplus-markdown].

Tools Used

manual review, vscode, foundry

Recommendation

To mitigate these risks, it is essential to write proper tests for all possible code flows, especially edge cases, to ensure that the system works as intended under all conditions.

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

v1vah0us3 Submitter
over 1 year ago
0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!