Part of CertiK’s series
CertiK reviewed Venus Protocol (Venus - Prime and Oracle Changes) on 19 Dec 2023: 13 findings, 0 critical; 8 marked fixed, 5 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 1 | 0 | 0 |
| Medium | 0 | 0 | 0 |
| Low | 4 | 0 | 8 |
Throughout the codebase when emitting events for addresses changing, the convention is to first emit the event with the old address being the current state of the variable and the new address being the input, and then afterwards setting the variable to the input.
The `PrimeLiquidityProvider` contract now inherits `TimeManager` to allow the use of block numbers or timestamps. As such the language referring to block numbers should now reflect that it is a block number or possibly a timestamp.
Other external functions that have the `onlyAdmin` modifier do not include a leading underscore.
The interface for `IPrime` does not include all external facing functions.
Many of the added files use specific imports, however, some import the entire file.
### TimeManager.sol - Function `getBlockNumberOrTimestamp()` includes the following comment above its declaration: "This exists mainly for inheriting test contracts to stub this result." This contract and this function specifically will be used in production-level contracts. ### Prime.sol - The comment above error `InvalidTimestamp` misspells the word "invalid" as "invalud."
The following check is made in the newly added `redeemVerify()` logic of the `Comptroller` contract for Isolated Pools: ```solidity if (redeemAmount == 0 && redeemTokens == 0) revert NoRedeemTokensOrAmount(); ``` This check requires one of `redeemAmount` or `redeemTokens` is nonzero. The check is unnecessary because the logic within the function `_redeemFresh()` of the Isolated Pools VToken contract ensures that either both values `redeemAmount` and `redeemTokens` are positive, or else the function call reverts (justification for this claim is outlined below). In particular, the check in `redeemVerify()` alone would not prevent the case where `redeemTokens` is 0 while `redeemAmount` is positive, which is the case prevented in the core pool's `redeemVerify()` function: ```solidity require(redeemTokens != 0 || redeemAmount == 0, "redeemTokens zero"); ``` The justification below also shows why the check done in the Core pool `redeemVerify()` function is unneeded for the Isolated Pool `redeemVerify()` function - namely, that there is never a case where `redeemTokens` is 0 while `redeemAmount` is positive. --- ### Justification The `_redeemFresh()` function of the Isolated Pools `VToken` contract ensures that `redeemAmount` and `redeemTokens` are either both positive, or the function reverts. The input parameters `redeemTokensIn` and `redeemAmountIn` provided by the user are required to be values where at least one is zero. **Case 1 `redeemTokensIn` is 0 and `redeemAmountIn` is positive.** Then `redeemTokens = div_(redeemAmountIn, exchangeRate)`. If `exchangeRate > redeemAmountIn`, then `redeemTokens` is 0. If that is true, then `redeemAmount = mul_ScalarTruncate(exchangeRate, redeemTokens); = 0` where the `redeemTokens` value of 0 is used, so the check that ```solidity if (redeemAmount == 0) { revert("redeemAmount is zero"); } ``` will cause a revert. If `redeemTokens` is set to a positive value, then either `redeemAmount` is positive or 0. If `redeemAmount` is 0, then a revert will occur for the same reason above, so necessarily, both values will be positive if used within the `redeemVerify()` function call at the end. **Case 2 `redeemAmountIn` is 0 and `redeemTokensIn` is positive.** Then `redeemTokens = redeemTokensIn > 0` and `redeemAmount = mul_ScalarTruncate(exchangeRate, redeemTokens)`. If `redeemAmount` is zero, then the check outlined above will cause a revert so that both values will be positive if used within the `redeemVerify()` function call at the end. **Case 3 both `redeemTokensIn` and `redeemAmountIn` are 0.** Then `redeemTokens = div_(redeemAmountIn, exchangeRate) = 0` and consequently `redeemAmount` will be 0 (like in case 1), causing a revert.
The input `comptroller` was added to the function `addMarket()`, which is controlled by the ACM. However, the input string for `_checkAccessAllowed()` does not include the new address parameter.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (14)
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us