pendulum-chain / pendulum

GNU General Public License v3.0
43 stars 14 forks source link

Audit: PDM-003 - Test Coverage #265

Closed ashneverdawn closed 11 months ago

ashneverdawn commented 1 year ago

The current test coverage of the orml-currencies-allowance-extension pallet is insufficient, with only 22.22% coverage. Moreover, the implementation of ChainExtension in the runtime lacks any test coverage.

ID PDM-003 Scope Code Quality / Testing Status New

Description To evaluate the test coverage, we recommend using the cargo tarpaulin command:

cargo tarpaulin --out Html --output-dir ./tarpaulin-report

Running this command generates an HTML file that provides detailed coverage information for all packages. Specifically, it highlights the orml-currencies-allowance-extension pallet, which currently has a coverage of only 22.22%. Additionally, it reveals the absence of tests for the methods utilized in the runtime to implement ChainExtension , including is_allowed_currency , allowance , do_approve_transfer , and do_transfer_approved , as well as the lack of testing for the overall ChainExtension implementation in the foucoco runtime.

Recommendation To address the low test coverage in the orml-currencies-allowance-extension pallet and the lack of test coverage in the runtime implementation of ChainExtension , it is essential to develop a comprehensive test suite. This suite should include thorough testing to ensure the security, stability, and maintainability of the project. Implementing continuous integration (CI) systems to automate the execution of the test suite is highly recommended. This practice enables the team to identify areas with insufficient test coverage, detect regressions, and uncover areas that require improvement. By incorporating CI into the development workflow, valuable feedback is obtained, ultimately enhancing the overall quality of the codebase.

vadaynujra commented 1 year ago

Hey team! Please add your planning poker estimate with Zenhub @ashneverdawn @ebma @TorstenStueber