Sophon
Reward Vesting

The vesting and reward wrapping mechanism, which releases WSophon rewards to participants over time, was in scope.
report id
0482
category
Token & RWA
language
Solidity
final report
May 30, 2025
lines of code
327
Content

Download audit report

1

Executive Summary

This document presents the security review performed by Nethermind Security for Sophon smart contracts. Sophon community participates in the protocol by running nodes for the network, for which they earn rewards. Instead of giving vSophon tokens immediately on accrual, the rewards are wrapped in WSophon tokens for vesting. The rewards are released to the participant when they are fully vested.

There is a weekly process owned by the protocol team, that adds the vesting schedule with accrued earnings for all participants. Participants can claim their earnings after the expiration of the vesting period

The audit comprises 327 lines of solidity code. The audit was performed using (a) manual analysis of the codebase, (b) automated analysis tools, and (c) creation of test cases.

Audit assessment
Audit TypeSecurity Review
Initial ReportApril 7, 2025
Final ReportMay 30, 2025
Repositorysophon-smart-contracts
Commit1480b64b3b
Final Commit1480b64b3b
DocumentationLow
Documentation AssessmentLow
Test Suite AssessmentLow
Total findings
3
Fixed
0
Acknowledged
3
Mitigated
0
Unresolved
0

Findings by severity

  • Critical0
  • High0
  • Medium0
  • Low0
  • Informational3
  • Best Practices0

2

Audited Files

#ContractLoCCommentsRatioBlankTotal
1VSophTokenState.sol13969.2%527
2VSophToken.sol31417254.8%88574
Total32718155.4%93601

4

System Overview

The Sophon smart contracts in the scope of this audit are designed to manage the release of accrued reward tokens for node validators. The smart contracts primarily focus on adding the accrued rewards for the network participants to vesting schedules. Participants will subsequently claim the tokens once they are completely vested.

The schedules for accrued rewards are added to the vesting schedules by a weekly process, which is owned by the protocol. The users will be able to claim the rewards when they are fully vested.

The smart contracts also have a provision to transfer the vested schedules from one account to another. This functionality is added to handle any unexpected circumstances.

Diagram from the audit report

VSophToken contract is the main user-facing contract. It contains all user-facing functions for interacting with the Vesting Schedules. It handles the adding of new schedules, releasing fully vested tokens, and transfer of vesting schedules from one account to another.

4.1 Adding Vesting Schedule

The accrued rewards for the participants are added to the vesting schedule by a weekly process. The process will call one of the below functions to add Vesting schedules for the participants. Adding of vesting schedules is managed by the protocol via the schedule manager role.

  • addVestingSchedule: Adds a vesting schedule for a single beneficiary, transferring wSoph from the vault and unwrapping it.
  • addMultipleVestingSchedules: Works like addVestingSchedule, but adds multiple vesting schedules at once.

4.2 Releasing Vesting Schedule

While creating new vesting schedules is managed by the schedule manager role, claiming the fully vested tokens is the responsibility of the participant.

  • releaseSpecificSchedules: Using this function, the user can claim fully vested tokens from specific schedules that are provided in an array.
  • releaseAllSchedules: Releases vested tokens for all schedules.
  • releaseSchedulesInRange: Releases vested tokens from a range of schedules.

4.3 Transfer of vesting schedules

VSophToken contract contains functions to transfer vesting schedules from one account to another. These functions are to handle un expected circumstances.

  • transferAllVestingSchedules: Transfers all vesting schedules from a source account to a target account.
  • transferVestingSchedule: Transfers a single schedule by index from a source account to a target account.

5

Risk Rating Methodology

The risk rating methodology used by Nethermind Security follows the principles established by the OWASP Foundation. The severity of each finding is determined by two factors: Likelihood and Impact.

Likelihood measures how likely the finding is to be uncovered and exploited by an attacker. This factor will be one of the following values:

  1. High: the issue is trivial to exploit and has no specific conditions that need to be met;
  2. Medium: the issue is moderately complex and may have some conditions that need to be met;
  3. Low: the issue is very complex and requires very specific conditions to be met.

When defining the likelihood of a finding, other factors are also considered. These can include but are not limited to motive, opportunity, exploit accessibility, ease of discovery, and ease of exploit.

Impact is a measure of the damage that may be caused if an attacker exploits the finding. This factor will be one of the following values:

  1. High: the issue can cause significant damage, such as loss of funds or the protocol entering an unrecoverable state;
  2. Medium: the issue can cause moderate damage, such as impacts that only affect a small group of users or only a particular part of the protocol;
  3. Low: the issue can cause little to no damage, such as bugs that are easily recoverable or cause unexpected interactions that cause minor inconveniences.

When defining the impact of a finding, other factors are also considered. These can include but are not limited to data and state integrity, loss of availability, financial loss, and reputation damage. After defining the likelihood and impact of an issue, the severity is determined according to the table below.

Impact / LikelihoodLowMediumHigh
HighMediumHighCritical
MediumLowMediumHigh
LowInfo / Best PracticesLowMedium
UndeterminedUndeterminedUndeterminedUndetermined

To address issues that do not fit a High, Medium or Low severity, Nethermind Security also uses three more finding severities: Informational, Best Practices, and Undetermined.

  1. Informational findings do not pose any risk to the application, but they carry some information that the audit team intends to pass to the client formally;
  2. Best Practice findings are used when some piece of code does not conform with smart contract development best practices;
  3. Undetermined findings are used when we cannot predict the impact or likelihood of the issue.

6

Issues

6.1 Releasing of vesting schedules in blocks could revert

FileFix commitTypeStatus
VSophToken.sol—InfoAcknowledged

VSophToken contract supports releasing of vesting schedules in blocks through releaseSchedulesInRange and releaseAllSchedules functions.

function releaseSchedulesInRange(uint256 startIndex, uint256 endIndex) external {
VestingSchedule[] storage schedules = vestingSchedules[msg.sender];
_releaseSchedulesInRange(schedules, startIndex, endIndex);
}

function releaseAllSchedules() external {
VestingSchedule[] storage schedules = vestingSchedules[msg.sender];
_releaseSchedulesInRange(schedules, 0, schedules.length);
}

These two functions accept a block of vesting schedules to be released in a single call. These two functions internally call the _releaseSchedulesInRange function based on start and end indexes qualified for the schedules to be processed for release. As the start dates for all the vesting schedules are not organised in chronological order, it is possible for one of the schedules to have a start date beyond the current block timestamp.

function _releaseSchedulesInRange(VestingSchedule[] storage schedules, uint256 startIndex, uint256 endIndex)
internal
{
if (schedules.length == 0) revert NoVestingSchedule();
if (startIndex >= endIndex || endIndex > schedules.length) revert InvalidRange();

uint256 totalAmountToRelease = 0;

uint256 vestingStartDate_ = vestingStartDate;

for (uint256 i = startIndex; i < endIndex; i++) {
==> uint256 released = _processSchedule(schedules[i], vestingStartDate_);
totalAmountToRelease += released;
}

if (totalAmountToRelease == 0) revert NoTokensToRelease();
}

So, while processing each schedule by calling _processSchedule, if the start time of the schedule happens to be a future time, meaning the vesting schedule did not start yet. In such a case, the transaction will revert, blocking all the other vesting schedules that were eligible to be released.

function _processSchedule(VestingSchedule storage schedule, uint256 vestingStartDate_)
internal
returns (uint256 releasedAmount)
{
// this is critical part. set startDate if schedule.startDate was zero
if (vestingStartDate_ != 0 && block.timestamp >= vestingStartDate_ && schedule.startDate == 0) {
schedule.startDate = vestingStartDate_;
}

==> if (!_hasVestingStarted(schedule)) revert VestingHasNotStartedYet();

//...
}

Recommendation

return 0 for vesting schedule where vesting has not yet started. This will allow release of tokens for other vesting schedules.

6.2 _transferAllVestingSchedules transfers even fully vested schedules

FileFix commitTypeStatus
VSophToken.sol—InfoAcknowledged

The _transferAllVestingSchedules function transfers all vesting schedules from one account to another, including those that are fully vested. The fully vested schedule does not have any pending amounts for future releases.

function _transferAllVestingSchedules(address from, address to) internal {
if (to == address(0) || from == address(0) || from == to) revert InvalidRecipientAddress();
if (vestingSchedules[from].length == 0) revert NoVestingSchedule();

VestingSchedule[] storage fromSchedules = vestingSchedules[from];

// Move vesting schedules
for (uint256 i = 0; i < fromSchedules.length; i++) {
vestingSchedules[to].push(fromSchedules[i]);
}

// --SNIP

Transferring fully vested schedules is redundant and unnecessary, as the tokens associated with them are no longer releasable. This leads to unnecessary growth of the vestingSchedules array for the recipient.

Recommendation

Modify the function to transfer only schedules that are not fully vested. This can be achieved by checking whether the schedule has any remaining releasable amount before transferring.

6.3 adminAddress should be validated for non zero address

FileFix commitTypeStatus
VSophToken.sol—InfoAcknowledged

In the initialize function, the adminAddress should be validated to be non-zero, as this account is entitled to many roles.

Recommendation

Validate adminAddress to be a non zero address.

7

Documentation Evaluation

Software documentation refers to the written or visual information that describes the functionality, architecture, design, and implementation of software. It provides a comprehensive overview of the software system and helps users, developers, and stakeholders understand how the software works, how to use it, and how to maintain it. Software documentation can take different forms, such as user manuals, system manuals, technical specifications, requirements documents, design documents, and code comments. Software documentation is critical in software development, enabling effective communication between developers, testers, users, and other stakeholders. It helps to ensure that everyone involved in the development process has a shared understanding of the software system and its functionality. Moreover, software documentation can improve software maintenance by providing a clear and complete understanding of the software system, making it easier for developers to maintain, modify, and update the software over time. Smart contracts can use various types of software documentation. Some of the most common types include:

  • Technical whitepaper: A technical whitepaper is a comprehensive document describing the smart contract’s design and technical details. It includes information about the purpose of the contract, its architecture, its components, and how they interact with each other;
  • User manual: A user manual is a document that provides information about how to use the smart contract. It includes step-by-step instructions on how to perform various tasks and explains the different features and functionalities of the contract;
  • Code documentation: Code documentation is a document that provides details about the code of the smart contract. It includes information about the functions, variables, and classes used in the code, as well as explanations of how they work;
  • API documentation: API documentation is a document that provides information about the API (Application Programming Interface) of the smart contract. It includes details about the methods, parameters, and responses that can be used to interact with the contract;
  • Testing documentation: Testing documentation is a document that provides information about how the smart contract was tested. It includes details about the test cases that were used, the results of the tests, and any issues that were identified during testing;
  • Audit documentation: Audit documentation includes reports, notes, and other materials related to the security audit of the smart contract. This type of documentation is critical in ensuring that the smart contract is secure and free from vulnerabilities.

These types of documentation are essential for smart contract development and maintenance. They help ensure that the contract is properly designed, implemented, and tested, and they provide a reference for developers who need to modify or maintain the contract in the future.

8

Remarks & Test Suite

The Sophon team was actively present in regular calls, effectively addressing concerns and questions raised by the Nethermind Security team. Additionally, the code includes NatSpec documentation for different functions and their parameters. However, the project documentation could be improved by providing a more comprehensive written overview of the system and an explanation of the different design choices.

As auditors, we recommend that any changes or updates made to the audited codebase undergo a re-audit or security review to address potential vulnerabilities or risks introduced by the modifications. By conducting a re-audit or security review of the modified codebase, you can significantly enhance the overall security of your system and reduce the likelihood of exploitation. However, we do not possess the authority or right to impose obligations or restrictions on our clients regarding codebase updates, modifications, or subsequent audits. Accordingly, the decision to seek a re-audit or security review lies solely with you.

This report is based on the scope of materials and documentation provided by you to Nethermind in order that Nethermind could conduct the security review outlined in 1. Executive Summary and 2. Audited Files. The results set out in this report may not be complete nor inclusive of all vulnerabilities. Nethermind has provided the review and this report on an as-is, where-is, and as-available basis. You agree that your access and/or use, including but not limited to any associated services, products, protocols, platforms, content, and materials, will be at your sole risk. Blockchain technology remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond the programming language, or other programming aspects that could present security risks. This report does not indicate the endorsement of any particular project or team, nor guarantee its security. No third party should rely on this report in any way, including for the purpose of making any decisions to buy or sell a product, service or any other asset. To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this report, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Nethermind does not warrant, endorse, guarantee, or assume responsibility for any product or service advertised or offered by a third party through the product, any open source or third-party software, code, libraries, materials, or information linked to, called by, referenced by or accessible through the report, its content, and the related services and products, any hyperlinked websites, any websites or mobile applications appearing on any advertising, and Nethermind will not be a party to or in any way be responsible for monitoring any transaction between you and any third-party providers of products or services. As with the purchase or use of a product or service through any medium or in any environment, you should use your best judgment and exercise caution where appropriate. FOR AVOIDANCE OF DOUBT, THE REPORT, ITS CONTENT, ACCESS, AND/OR USAGE THEREOF, INCLUDING ANY ASSOCIATED SERVICES OR MATERIALS, SHALL NOT BE CONSIDERED OR RELIED UPON AS ANY FORM OF FINANCIAL, INVESTMENT, TAX, LEGAL, REGULATORY, OR OTHER ADVICE.