Omniscia Badai Tech Audit
BadAIStaking Static Analysis Findings
BadAIStaking Static Analysis Findings
BAS-01S: Illegible Numeric Value Representations
Type | Severity | Location |
---|---|---|
Code Style | ![]() | BadAIStaking.sol: • I-1: L34 • I-2: L35 |
Description:
The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.
Example:
34uint public constant unstakingFeeRatioTimelockPeriod = 600;
Recommendation:
To properly illustrate each value's purpose, we advise the following guidelines to be followed.
For values meant to depict fractions with a base of 1e18
, we advise fractions to be utilized directly (i.e. 1e17
becomes 0.1e18
) as they are supported.
For values meant to represent a percentage base, we advise each value to utilize the underscore (_
) separator to discern the percentage decimal (i.e. 10000
becomes 100_00
, 300
becomes 3_00
and so on).
Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000
becomes 1_000_000
).
Alleviation (d639d227f8b8d90dbd9813ab9d7a5cbee34dd9b1):
Both literals have been updated as advised to better representations addressing this exhibit.
BAS-02S: Inexistent Sanitization of Input Addresses
Type | Severity | Location |
---|---|---|
Input Sanitization | ![]() | BadAIStaking.sol:L72-L94 |
Description:
The linked function(s) accept address
arguments yet do not properly sanitize them.
Impact:
The presence of zero-value addresses, especially in constructor
implementations, can cause the contract to be permanently inoperable. These checks are advised as zero-value inputs are a common side-effect of off-chain software related bugs.
Example:
72function initialize(73 address _stakingToken,74 address _rewardToken,75 uint _unstakingFeeRatio,76 address _feeRecipient,77 address _owner,78 uint emissionStart,79 uint firstCheckPoint,80 uint _rewardPerSecond81) public initializer {82 stakingToken = IERC20(_stakingToken);83 rewardToken = IERC20(_rewardToken);84 unstakingFeeRatio = _unstakingFeeRatio;85 newUnstakingFeeRatio = _unstakingFeeRatio;86 feeRecipient = _feeRecipient;87 if (checkPoints.length == 0) {88 checkPoints.push(emissionStart);89 checkPoints.push(firstCheckPoint);90 rewardPerSecond.push(_rewardPerSecond);91 }92 __ReentrancyGuard_init();93 __Ownable_init(_owner);94}
Recommendation:
We advise some basic sanitization to be put in place by ensuring that each address
specified is non-zero.
Alleviation (d639d227f8b8d90dbd9813ab9d7a5cbee34dd9b1):
All input arguments of the BadAIStaking::constructor
function are adequately sanitized as non-zero in the latest in-scope revision of the codebase, addressing this exhibit.