Omniscia XFai Audit

Manual Review

Manual Review

A thorough line-by-line review was conducted on the codebase to identify potential malfunctions and vulnerabilities in the novel staking implementation of XFai.

As the project at hand implements a multi-LP staking implementation, intricate care was put into ensuring that the flow of funds within the system conforms to the specifications and restrictions laid forth within the protocol's specification.

We validated that all state transitions of the system occur within sane criteria and that all rudimentary formulas within the system execute as expected. We pinpointed multiple issues within the system which could have had severe ramifications to its overall operation, however, they were conveyed ahead of time to the XFai team to be promptly remediated.

Notably, the calculation error within the contract zapper that converts one-sided liquidity to two-sided liquidity contained an inaccuracy we pointed out and certain features of the staking implementation were incomplete or unenforced, causing discrepancies in the system's overall operation.

Additionally, the system was investigated for any other commonly present attack vectors such as re-entrancy attacks, mathematical truncations, logical flaws and ERC / EIP standard inconsistencies. The documentation of the project was satisfactory to a certain extent, however, we strongly recommend the documentation of the project to be expanded at certain complex points such as the normalization of liquidity which we also identified as an issue in the contracts.

A total of 19 findings were identified over the course of the manual review of which 13 findings concerned the behaviour and security of the system. The non-security related findings, such as optimizations, are included in the separate Code Style chapter.

Of the findings detected, all but one were alleviated thus bringing the XFai system to a mature state.

The finding table below enumerates all these security / behavioural findings:

IDSeverityAddressedTitle
XPH-01MMediumYesIncorrect Evaluation of Swapped Amount
XPH-02MMinorNoIncompatibility w/ Fee Tokens
XPH-03MMinorYesIncorrect Rounding Assumption
XPH-04MMinorYesIndirect Function Freeze
XPH-05MMinorYesInexistent Input Sanitization
XPO-01MMinorYesSmall TWAP Window
XFA-01MMediumYesIneffectual Check
XFA-02MMediumYesSide-Effect of Inexistent Access Control
XFA-03MMinorYesFaulty Addition Logic
XFA-04MMinorYesInexplicable Functionality
XFA-05MMinorYesUnconditional Transfer
XFA-06MMinorYesWithdrawals Remain Unpaused
XFA-07MInformationalYesPotentially Redundant Functionality