Introduction
We express our gratitude to the Nucleon team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Conflux enables creators, communities, and markets to connect across borders and protocols.
| title | content |
|---|---|
| Platform | Conflux |
| Language | Solidity |
| Tags | Voting, Yield Farming |
| Timeline | 08/10/2022 - 24/01/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/article-i/espace/tree/in-test; https://github.com/article-i/core-pos-pool/tree/test→ |
| Commit | b793f4db6cf6644bd046ae25c1c5c19682c45fb0; 35299a5071cda0ee1b51659c5608127b7ca92e9f |
Review Scope
- Commit
- b793f4db6cf6644bd046ae25c1c5c19682c45fb0; 35299a5071cda0ee1b51659c5608127b7ca92e9f
Audit Summary
10/10
78.86%
3/10
8/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Nucleon |
| Audited By | Hacken |
| Website | https://confluxnetwork.org/→ |
| Changelog | 13/10/2022 – Initial Review |
| 09/12/2022 - Second Review | |
| 19/01/2023 - Third Review | |
| 24/01/2023 - Fourth Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Nucleon
- Audited By
- Hacken
- Website
- https://confluxnetwork.org/→
- Changelog
- 13/10/2022 – Initial Review
- 09/12/2022 - Second Review
- 19/01/2023 - Third Review
- 24/01/2023 - Fourth Review
System Overview
Nucleon is a project that rewards its users based on the amount of CFX token they deposit:
Exchangeroom.sol - A staking contract for CFX token.
CoreBridgemultipool.sol_ - A bridge contract to connect Conflux POS pools and Exchange rooms.
PoSPoolmini.sol - A small Conflux POS pool contract with basic usages.
PoolAPY.sol - A library contract operates users' stake information.
PoolContext.sol - An abstract contract to call
StakingandRegistercontracts functions.VotePowerQueue.sol - A library contract queues users' voting rights and processes them sequentially.
UnstakeQueueCFX.sol - A library contract adds users who unstake the CFX token to the queue.
IExchange.sol - An interface contract used for the PoSPoolmini contract.
Privileged roles
The owner of the CoreBridgemultipool_ contract can add, delete and modify the pool addresses stored. The owner can set xCFX, bridge, treasury, and trusted triggers addresses.
The trusted triggers addresses of the CoreBridgemultipool_ contract can synchronize all pools.
The owner of the Exchangeroom contract can set lock periods, exchange limits, pool name and bridge, exchange, storage, xCFX addresses.
The bridge and exchange addresses of the Exchangeroom contract can exchange CFX for xCFX, dequeue pending queue. These addresses can set locked votes, unstaked votes. The bridge can set directly
xcfxvalues,xCFXincreasevariables.The owner of the PoSPoolmini contract can register the pool contract to the PoS internal contract. The owner can set bridge addresses, lock periods, pool name, CFX count of one vote.
The bridge of the PoSPoolmini contract can increase, decrease, and withdraw CFX tokens. The bridge can claim all the interest from the pool.
Executive Summary
Documentation quality
The total Documentation quality score is 8 out of 10.
Functional requirements are mostly provided.
Technical description is provided.
Code quality
The total Code quality score is 3 out of 10.
The code contains duplicate patterns and contracts.
The development environment is configured.
Style guide → violations found in code, including public functions starting with underscores, deviations from mixed casing and variable naming conventions, and missing camel-case usage. \-Slither can be used to detect and fix these style guide violations.
There are two different repositories for code and one for the tests.
Test coverage
Code coverage of the project is 78.86%.
Unit tests are provided, but several contracts are not covered at all.
There are scenarios implemented for basic behavior and user interactions.
Security score
Upon auditing, the code was found to contain 3 critical, 6 high, 10 medium, and 24 low severity issues. Out of these, 31 issues have been addressed and resolved, leading to a security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 7.6. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The repository contains a code that is out of the audit scope. The secureness of contracts that are not mentioned in the Scope sedition of the report cannot be guaranteed.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-122 | Unverifiable Logic | fixed | Critical | |
| F-2023-122 | Invalid Calculations | fixed | Critical | |
| F-2023-1226 | Token Supply Manipulation | mitigated | Critical | |
| F-2023-1234 | Highly Permissive Role Access | fixed | High | |
| F-2023-1233 | Requirements Violation | fixed | High | |
| F-2023-1232 | Unverifiable Logic | mitigated | High | |
| F-2023-1231 | Requirements Violation | fixed | High | |
| F-2023-123 | Requirements Violation | fixed | High | |
| F-2023-122 | Data Consistency | mitigated | High | |
| F-2023-1244 | Contradiction | fixed | Medium |
Appendix 1. Severity Definitions
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
|---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/article-i/espace/tree/in-test; https://github.com/article-i/core-pos-pool/tree/test→ |
| Commit | b793f4db6cf6644bd046ae25c1c5c19682c45fb0; 35299a5071cda0ee1b51659c5608127b7ca92e9f |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Not provided |