Overview
In the rapidly evolving landscape of blockchain technology and decentralized finance, ensuring the security and integrity of smart contracts has become paramount. StarkDeFi, with its forward-thinking vision in the DeFi space, recognized this imperative and approached Blaize – an industry-leading expert in blockchain solutions and security audits.
StarkDeFi, appreciating the gravity of this responsibility, teamed up with Blaize – renowned experts in smart contract auditing – to meticulously scrutinize their underlying systems and ensure not only their functionality but also their invulnerability against potential breaches.
Task
During our audit, we scrutinized the codebase for various vulnerabilities in several stages:
1) Standard vulnerabilities checklists, including but not limited to:
- L1-L2 Addresses Conversion
- Transaction-ordering dependence
- Validation of input data
- Vulnerability for Denial-of-Service (DoS) attacks
- Slippage and Flashloans/Big liquidity vulnerabilities
- Storage issues (uninitialized, unused, etc) and incorrect local variables usage
- Upgradeability issues
- Correct calculations and precision
and other potential Cairo vulnerabilities and attack vectors;
2) Business logic decompositions to find loopholes, deadlocks, hidden backdoors, incorrect math and calculations, malicious code injections and other flow-related issues;
3) Review of dependencies, integrations and 3rd parties, verified with appropriate integration tests;
4) Our own internal security checklists, additionally verified during the testing stage.
The team had the main focus on:
- Verification of the correctness of AMM K-invariant and correctness of reserves changes;
- Verification of fee calculation and distribution;
- Checking the flow of volatile or stable pair creation, adding/removing liquidity, and exchanging tokens, including ensuring common DEX protection measures such as slippage protection and deadline of any action such as exchange of tokens;
- Checking the upgradeability flow;
- Analysis of smart contracts against the list of common Cairo vulnerabilities, including access control protection measures;
- A comprehensive unit testing of smart contracts, including edge-case scenarios for invariant, slippage protection, different amounts of tokens, and flashloan attacks.