Vana
VeVana

The integration of VeVana, a vote-escrowed ERC20 wrapper on top of the native Vana token, was in scope.
report id
0451-0469
category
Token & RWA
language
Solidity
final report
March 28, 2025
lines of code
1575
Content

Download audit report

1

Executive Summary

This document presents the security review performed by Nethermind Security for the smart contracts of Vana to support VeVana tokens. In prior audit engagements, the functionality of the code had been reviewed, and this audit is only focused on integration of VeVana ERC20 tokens and their movement in the protocol.

Previously, the economic value of the protocol was only represented in Vana native tokens. With the new changes in the codebase, VeVana ERC20 tokens are integrated into the protocol. This provides the users with the flexibility to use VeVana ERC20 tokens along with Vana native tokens. VeVana token is a wrapper on top of the Vana native token that leverages additional features like voting to the protocol.

VeVana token is implemented as an upgradeable and pausable contract which gives additional control for the protocol owners to add new features to the tokens. On the other hand, it brings the risk of centralization and compromised token owner.

This security review focuses exclusively on the smart contracts listed in Section 2 (Audited Files) and scope for interactions with VeVana token contract.

The audited code comprises 1575 lines of code written in the Solidity language, and the audit was performed using (a) manual analysis of the code base and (b) creation of test cases.

Audit assessment
Audit TypeSecurity Review
Response from ClientRegular responses during audit engagement
Final ReportMarch 07, 2025
RepositoryVana
Commit (Final)a9fb959d84
Documentation AssessmentMedium
Test Suite AssessmentMedium
Total findings
3
Fixed
0
Acknowledged
3
Mitigated
0
Unresolved
0

Findings by severity

  • Critical0
  • High0
  • Medium0
  • Low0
  • Informational2
  • Best Practices1

4

System Overview

VeVana ERC20 tokens are added along with the native Vana tokens for users to perform staking. Users can now stake either native Vana tokens or VeVana ERC20 tokens. Likewise, DLP owners can register DLPs using either of the tokens.

Going forward, the staking rewards will be distributed using VeVana tokens.

VeVana tokens bear voting rights.

Vana VeVana interactions
Fig. 2: Vana VeVana interactions

4.1 VeVana Tokens

VeVana is an ERC20 wrapper on top of native Vana tokens. The contract is upgradeable using the UUPS proxy pattern. The token also supports voting functionality and pausing deposit, and withdrawal functions.

4.2 DLP Root

The DLP root contract is extended to support staking functionality using VeVana tokens alongside of Vana native tokens.

4.3 DLP Root Core

DLP root core contract is extended to allow DLP owners to register new DLP using VeVana tokens.

4.4 DLP Epoch

Epoch contract now distributes the rewards in VeVana tokens.

4.5 Root Treasury

The root treasury contract is extended to support integration with VeVana tokens. The contract now allows for deposits in native Vana and VeVana tokens. The contract also withdrawal of value in either native Vana and VeVana tokens.

  • Staking Treasury: This treasury instance holds staked funds.
  • Rewards Treasury: This treasury instance holds the staking reward funds.

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 Staking on behalf should source VeVana tokens from the Stake owner's account

FileFix commitTypeStatus
DLPRootImplementation.sol—InfoAcknowledged

VeVana tokens can be staked by anyone on behalf of another user. These VeVana tokens should be sourced from the stake owner's account and not from the caller of the staking function. In the below two functions, the caller is creating a stake on behalf of stakeOwner. Hence, the stake amount should be sourced from the stakeOwner's account.

function createStakeOnBehalf(
uint256 dlpId,
address stakeOwner
) external payable override nonReentrant whenNotPaused {
dlpRootEpoch.createEpochs();

_createStake(stakeOwner, dlpId, msg.value, block.number, false);//@audit
}

function createStakeOnBehalfWithVeVANA(
uint256 dlpId,
address stakeOwner,
uint256 amount
) external override nonReentrant whenNotPaused {
dlpRootEpoch.createEpochs();

_createStake(stakeOwner, dlpId, amount, block.number, false);//@audit
}

While stakeOwner was passed as a parameter to _createStake function below, at the time of sourcing the VeVana tokens, the logic is actually sourcing the funds from _msgSender() account instead of the stakeOwner's account.

function _createStake(address stakerAddress, uint256 dlpId, 
uint256 amount, uint256 startBlock,
bool isRestake) internal {
//...
if (!isRestake) {
if (msg.value > 0) {
dlpRootStakesTreasury.depositVana{value: msg.value}();//@audit
} else {
IVeVANA veVANA = dlpRootStakesTreasury.veVANA();//@audit
veVANA.safeTransferFrom(
==> _msgSender(),
address(dlpRootStakesTreasury),
amount
);
}
}
//...
}

As a result, the tokens of the caller will get locked in the stake instead of the stake owner.

Recommendation

Take approval from stakeOwner to spend the tokens and pass stakeOwner in safeTransferFrom function. This will also prevent a case where the caller executes a staking on behalf and ends up locking his tokens while the stakeOwner did not deposit the amount into the caller's account.

Resolution

The intention of the function is to allow anyone to create a stake in favor of another user using the function caller's tokens. It is like gifting tokens to another user.

6.2 migrateStake function will not work as expected

FileFix commitTypeStatus
DLPRootImplementation.sol—InfoAcknowledged

The migrateStake function of DLPRootImplementation allows the owner to migrate the staked amount from one DLP to another DLP. The process closes the current stake and creates a new stake with the new DLP specified as a parameter.

function migrateStake(
uint256 stakeId,
uint256 newDlpId,
uint256 newAmount
) external override nonReentrant whenNotPaused {
dlpRootEpoch.createEpochs();

Stake storage stake = _stakes[stakeId];

==> if (newDlpId != stake.dlpId) {
revert InvalidDlpId();
}

if (newAmount > stake.amount) {
revert InvalidStakeAmount();
}

stake.movedAmount = newAmount;
_closeStake(_msgSender(), stakeId);

_createStake(_msgSender(), newDlpId, newAmount, stake.startBlock, true);

emit StakeMigrated(stakeId, stakesCount, newDlpId, newAmount);
}

However, the validation of newDlpId expects it to be the same as the stake’s dlpId, which defeats the purpose of passing newDlpId as a parameter.

As a result, in the current implementation, the migrateStake function will revert if newDlpId is not the same as the current stake's dlpId.

Recommendation

Review the condition for DlpId validation.

Resolution

Yes, it is for restaking to another Dlp. However, we block the restaking to a different Dlp currently and only allow restaking to the same Dlp (which is equivalent to partial unstaking).

6.3 Use Beacon Proxy pattern to keep Rewards and Stakes proxies in Sync

FileFix commitTypeStatus
DLPRootTreasuryImplementation.sol—Best PracticesAcknowledged

DLPRootTreasuryImplementation is an implementation contract that is used by two proxies, one for Rewards and the other for Stakes. In the case of proxy patterns, proxy contracts are the owners of the storage data, and hence each proxy will have their storage.

abstract contract DLPRootTreasuryStorageV1 is IDLPRootTreasury {
IDLPRoot public override dlpRoot;
IVeVANA public override veVANA;//@audit
}

Hence, every time veVana is updated with a new address, it should be updated for both instances of the proxies.

Recommendation

Beacon Proxy is a smart contract upgrade pattern where multiple proxies use the same implementation contract, and all the proxies can be upgraded in a single transaction.

Resolution

Will consider the recommendation.

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 documentation for the Vana Smart Contracts are contained in the README of the project’s Github. It is written for developers, presenting each core component of the protocol, including deployment, contracts, functions, and testing. The information is presented in a very concise and technical manner, with well-written explanations and references where necessary. It also features a section explaining development dependencies and instructions on how to build and test the code. Code comments are also of high quality, with explanations for every function describing the purpose, context, and situations where the function will be called. Other than functions, some comments exist in other areas of the code where extra information is necessary, allowing readers to understand the codebase at a faster pace.

All the relevant issues raised by Slither have been incorporated into the issues described in this report.

All the relevant issues raised by the AuditAgent have been incorporated into this report. The AuditAgent is an AI-powered smart contract auditing tool that analyses code, detects vulnerabilities, and provides actionable fixes. It accelerates the security analysis process, complementing human expertise with advanced AI models to deliver efficient and comprehensive smart contract audits. Available at https://app.auditagent.nethermind.io.

Test suite
458Tests passed0Failed

The complete test output is in the full report.

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.