CertiK reviewed NEST Protocol on 15 Jul 2022: 13 findings, 0 critical; 7 marked fixed, 2 acknowledged, 4 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 | 0 | 2 | 0 |
| Medium | 0 | 0 | 1 |
| Low | 4 | 0 | 6 |
In function `post()`, Miners will transfer tokens to post the price for all of the pairs in the channel, and the amount of paid ETH will record in the local variable `fee`. If the `channel.token0` or `pair.target` is ETH, the value of `fee` will decrease which means the tokens are frozen in this contract. But if more ETH is paid than is needed, the `msg.sender` will lose this part of ETH.
Since the value of `scale` must be 1, `scale` is not needed in the multiplication formula. ```solidity=356 // 1. Check arguments require(scale == 1, "NOM:!scale"); ``` ```solidity=379 // Freeze token0 fee = _freeze(balances, channel.token0, cn * uint(channel.unit) * scale, fee); ``` ```solidity=387 fee = _freeze(balances, pair.target, scale * equivalent, fee); ``` Also, `scale` can be replaced by fixed value 1 when emit event `Post` or call function `_create()` in function `post()`. ```solidity=394 // 6. Create token price sheet emit Post(channelId, cn, msg.sender, pair.sheets.length, scale, equivalent); // Only pairIndex 0 has reward _create(pair.sheets, accountIndex, uint32(scale), uint(config.pledgeNest), cn == 0 ? 1 : 0, equivalent); ``` In section 2.3 of [white paper](https://www.nestprotocol.org/doc/ennestwhitepaper.pdf), the scale looks like it can be any value. Please describe why the value of `scale` must be 1 in the function `post()`.
According to our understanding, for each channel, there is no essential difference between `pair[0]` and the other pairs, but in real logic only `pair[0]` has a reward. Please teach us why only `pair[0]` has a reward and teach us what part of the official documentation is this reward mechanism documented in. ```solidity=396 // Only pairIndex 0 has reward ``` ```solidity=613 // Only pairIndex 0 has reward ```
The condition of the `if` statement in line 856 is inconsistent with the comment in line 855. ```solidity=855 // Not the same block (or flag is false), calculate the price and update it if (flag || prev != height) { ```
File : NestBatchMining.sol (function `take()`, line 444) The is no variable named `ethNum` in struct `PriceSheet`. ```solidity=444 // sheet.token0Scales + sheet.token1Scales is always two times to sheet.ethNum uint needNest1k = (takeNum << 2) * uint(sheet.nestNum1k) / (uint(sheet.token0Scales) + uint(sheet.token1Scales)); ```
The **require** can be used to check for conditions and throw an exception if the condition is not met. It is better to provide a string message containing details about the error that will be passed back to the caller.
Addresses should be checked before assignment or external calls to make sure they are not zero addresses. ```solidity=740 payable(to).transfer(value); ``` - `to` is not zero-checked before being used.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (3)
1,044 projects reviewed · 1,375 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