TruStake
POL Vault

Covered the TruStakePOL vault contract, deployed behind a transparent upgradeable proxy.
report id
0648
category
DeFi & Yield
language
Solidity
final report
September 19, 2025
lines of code
549
Content

Download audit report

1

Executive Summary

This document presents the results of a security review conducted by Nethermind Security for Trufin'sTruStakePOL contract.

The TruStakePOL contract resembles an ERC4626 vault contract, but is heavily customized. The contract enables users to deposit POL tokens in exchange for TruPOL vault shares. The POL tokens are then staked by the vault with a Polygon chain validator. The contract keeps compounding the rewards for its users, generating yield from network staking. The contract is deployed behind a transparent proxy, making it upgradeable.

The audit comprises 549 lines of Solidity code. The audit was performed using (a) manual analysis of the codebase, and (b) automated analysis tools.

Audit assessment
Audit TypeSecurity Review
Initial ReportSeptember 12, 2025
Final ReportSeptember 19, 2025
Initial Commit71092263f4
Final Commitba7f1a7ede
Documentation AssessmentHigh
Test Suite AssessmentHigh
Total findings
4
Fixed
1
Acknowledged
3
Mitigated
0
Unresolved
0

Findings by severity

  • Critical0
  • High0
  • Medium0
  • Low2
  • Informational2
  • Best Practices0

2

Audited Files

4

System Overview

The TruStake POL vault provides access to POL staking on the Ethereum network. When you deposit in the vault, your POL is immediately sent to one institutional validator, and rewards start to accrue immediately. Rewards are restaked automatically, uplifting APY from the compounding effect.

4.1 Staking

The staking process is initiated by depositing POL into the vault, resulting in minting an equivalent amount of TruPOL as shares back to the user. The deposited POL is directly staked within the validator. Deposits are possible through the deposit(uint256 _assets) and depositToSpecificValidator(uint256 _assets, address _validator) functions, where the former uses the default validator set in the contract and the latter allows the user to designate one of the supported validators.

4.2 Unstaking

The unstaking process involves two phases:

  • The user initiates a withdrawal request for a specific amount of POL, resulting in the vault burning the equivalent TruPOL shares and triggering an unbonding process on the validator. Similar to deposits, users can withdraw from a designated validator or use TruStake’s default validator, using withdraw(uint256 _assets) and withdrawFromSpecificValidator(uint256 _assets, address _validator) functions respectively.
  • Upon completion of the withdrawal delay, users can claim their funds via the withdrawClaim(uint256 _unbondNonce, address _validator) function by providing the unbonding nonce that is generated in the request phase.

4.3 Auto-compounding

The vault provides the compoundRewards(...) function that is periodically called to restake rewards across different validators and stake any claimed rewards and available POL in the vault.

4.4 Fees

The TruStake vault takes a fee on the earned rewards. This fee is paid to the treasury in the form of TruStake shares.

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 Incorrect rounding favors withdrawing users

FileFix commitTypeStatus
contracts/pol-staker/contracts/main/TruStakePOL.sol—LowFixed

When a user withdraws a specific amount of assets ( _amount) from the vault, the _withdrawRequest(...) function calculates the corresponding number of shares to burn. This calculation uses standard integer division, which implicitly rounds the result down.

function _withdrawRequest(address _user, uint256 _amount, address _validator)
private
returns (uint256 shareDecreaseUser, uint256 unbondNonce)
{
// ...
} else {
// calculate share decrease
// @audit-issue The result of this division is rounded down.
shareDecreaseUser = (_amount * globalPriceDenom * WAD) / globalPriceNum;
}
// ...
_burn(_user, shareDecreaseUser);
// ...
}

By rounding down, the contract burns slightly fewer shares than are required to cover the withdrawn assets. This rounding error consistently benefits the withdrawing user at the expense of all remaining liquidity providers in the vault. Over a large number of withdrawal transactions, these small discrepancies can accumulate, leading to a gradual drain of value from the protocol.

An evil user could inflate the share price to make the rounding error bigger and execute multiple withdrawals without spending shares, effectively draining par of the assets of the vault.

Recommendation

Consider changing the rounding direction when calculating shares to burn during a withdrawal. The calculation should round *up* to ensure that the user provides a sufficient amount of shares to cover the assets they are taking.

Resolution

This has been fixed in branch pol-fix-epsilon, where we remove the epsilon value that was making it possible for the contract to favor users during withdrawals.

6.2 No mechanism to reflect slashing events

FileFix commitTypeStatus
contracts/pol-staker/contracts/main/TruStakePOL.sol—LowAcknowledged

The TruStakePOL contract tracks the amount of POL staked with each validator using the stakedAmount field within the Validator struct. This value is a critical component of the totalStaked() calculation, which in turn determines the vault's share price.

The stakedAmount is updated only through internal actions such as staking ( _stake), unbonding ( _unbond), and restaking rewards ( _restake). The protocol lacks a mechanism to verify if this internally tracked amount matches the actual balance of staked POL held by the external ValidatorShare contracts.

struct Validator {
ValidatorState state;
// @audit-issue This value is trusted internally but not verified against the external reality.
uint256 stakedAmount;
address validatorAddress;
}

If a validator is slashed, its actual staked POL balance will decrease. However, the stakedAmount variable in the TruStakePOL contract will not be updated to reflect this loss.

This discrepancy leads to an overestimation of the vault's total assets. The totalStaked() function will return an inflated value, causing the sharePrice() to be calculated incorrectly as higher than it should be. The vault will become undercollateralized, where the value of the issued shares exceeds the value of the underlying assets. This situation benefits savvy users who withdraw early, as they can redeem their shares for more POL than they are worth, at the expense of all other users. The last users to withdraw may find that there are insufficient assets left to cover their shares, resulting in a loss of funds.

Additionally, calls to buyVoucherPOL(...) and sellVoucher_newPOL(...) require the share price from the ValidatorShare to be at least one, which may not be the case in case of slashing, affecting deposit and withdrawals mechanisms.

Recommendation

Consider implementing a mechanism to account for slashing events.

Resolution

Slashing is currently disabled on Polygon, with no confirmed timeline for activation. While there is some preliminary code in the validator contracts to support slashing, its final implementation, parameters, and enforcement mechanisms remain undefined. As such, this issue is not currently actionable.

6.3 Unbounded loop over validators may lead to denial of service

FileFix commitTypeStatus
contracts/pol-staker/contracts/main/TruStakePOL.sol—InfoAcknowledged

The contract owner has the ability to add new validators to the system via the addValidator(...) function, which appends the new validator's address to the _validatorAddresses storage array. While validators can be disabled using disableValidator(...), there is no mechanism to remove them from this array.

Several core functions, including totalStaked(), totalRewards(), and _restake() (called by compoundRewards(...)), iterate over the entire _validatorAddresses array to perform their calculations.

function totalStaked() public view override returns (uint256) {
TruStakePOLStorageStruct storage $ = _getTruStakePOLStorage();
uint256 validatorCount = $._validatorAddresses.length;
uint256 stake;
// @audit-issue This loop's cost grows with the number of validators.
for (uint256 i; i < validatorCount; ++i) {
stake += $._validators[$._validatorAddresses[i]].stakedAmount;
}
return stake;
}

The issue is that the _validatorAddresses array can grow indefinitely. As more validators are added over time, the gas cost of executing these functions will increase linearly. Eventually, the transaction cost could exceed the block gas limit, rendering these critical functions unusable.

This would create a permanent Denial of Service (DoS), with the following impacts:

  • compoundRewards(...) would become uncallable, preventing all rewards from being restaked.
  • totalStaked() and totalRewards() would revert, breaking the sharePrice() calculation and thus all deposit and withdrawal operations.

Recommendation

Consider introducing a mechanism to remove validators from the _validatorAddresses array. When a validator is no longer needed, it should be fully decommissioned and removed.

Resolution

While we acknowledge the concern, this loop is not expected to pose a practical risk in our specific context. The Polygon validator set is capped at 105 validators, and at TruFin, we operate with a tightly controlled validator onboarding process. All validators are KYC’d and whitelisted, and we expect to onboard only a small, static subset of the available set. As such, the number of active validator entries will remain low and predictable, ensuring the gas cost of looping operations remains well within safe bounds.

6.4 maxWithdraw calculation ignores per-validator liquidity constraints

FileFix commitTypeStatus
contracts/pol-staker/contracts/main/TruStakePOL.sol—InfoAcknowledged

The maxWithdraw(...) function is a view function usually intended to inform users of the maximum amount of POL they can withdraw in one call. The withdrawal logic, handled by _withdrawRequest(...), correctly enforces that a withdrawal from a specific validator cannot exceed the amount staked with that validator.

However, the maxWithdraw(...) function calculates the withdrawable amount based on the user's total share holdings, without considering how the underlying liquidity is distributed across the various validators.

function maxWithdraw(address _user) public view override returns (uint256) {
// @audit This calculation is based on the user's total shares.
uint256 preview = previewRedeem(balanceOf(_user));
if (preview == 0) return 0;

TruStakePOLStorageStruct storage $ = _getTruStakePOLStorage();

// @audit-issue It does not account for the stake on any single validator.
return preview + $._epsilon;
}

This creates a discrepancy that can affect user's experience. A user might check maxWithdraw(...), see a large available amount, and attempt to withdraw it using the withdraw(...) function, which targets the default validator. If the default validator's staked amount is less than the user's requested amount, the transaction will revert with a WithdrawalAmountAboveValidatorStake error, even though the user was led to believe the withdrawal was possible. This can cause user confusion and wasted gas on failed transactions.

Recommendation

Consider modifying the maxWithdraw(...) function to provide more accurate information. The function could accept a validator address as an input parameter. This would allow it to return the maximum amount a user can withdraw from a *specific* validator, aligning its logic with that of the withdraw(...) and withdrawFromSpecificValidator(...) functions and preventing misleading results.

Resolution

The maxWithdraw(...) function is designed to reflect the theoretical maximum a user can redeem based on their LST token balance, not validator-specific liquidity constraints. The per-validator limits are intentionally enforced at the withdrawal level and surfaced through the front end, which directs withdrawals to appropriate validators. As such, while the function may overstate the amount withdrawable from a specific validator, this is by design and does not impact protocol safety.

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

TruFin provides well-structured and detailed information on the functionality of the TruStake vaults. TruFin's team was also proactive in making themselves available for sync calls to address any questions or concerns raised during the review. These discussions ensured that the security team had all the necessary context to perform a thorough analysis.

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
148Tests 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.