Download audit report
This document presents the security review conducted by Nethermind Security for Vana's Data Access contracts. The audit specifically focused on pull request #14, which introduces the three major components of the Data Access System: data refinement, query engine, and compute engine.
The audit comprised of 1403 lines of solidity code and was performed using (a) manual analysis of the codebase, (b) automated analysis tools, and (c) creation of test cases.
| Audit assessment | |
| Audit Type | Security Review |
| Initial Report | April 11, 2025 |
| Final Report | April 24, 2025 |
| Repositories | vana-smart-contracts |
| Initial Commit | b3045f9 |
| Final Commit | 967896b |
| Documentation | Provided pull request #14 documentation |
| Documentation Assessment | Medium |
| Test Suite Assessment | Medium |
Findings by severity
| # | Files | LoC | Comments | Ratio | Blank | Total |
| 1 | ComputeEngineImplementation.sol | 341 | 57 | 16% | 74 | 472 |
| 2 | ComputeEngineProxy.sol | 5 | 1 | 20% | 2 | 8 |
| 3 | ComputeEngineTeePoolImplementation.sol | 167 | 35 | 21% | 39 | 241 |
| 4 | ComputeEngineTeePoolProxyFactory.sol | 19 | 1 | 5% | 5 | 25 |
| 5 | ComputeEngineTeePoolFactoryImplementation.sol | 164 | 22 | 13% | 32 | 218 |
| 6 | ComputeInstructionRegistryImplementation.sol | 79 | 22 | 27% | 20 | 121 |
| 7 | ComputeInstructionRegistryProxy.sol | 5 | 1 | 20% | 2 | 8 |
| 8 | DataAccessTreasuryImplementation.sol | 56 | 12 | 21% | 15 | 83 |
| 9 | DataAccessTreasuryProxyFactory.sol | 18 | 1 | 5% | 4 | 23 |
| 10 | DataRefinerRegistryImplementation.sol | 73 | 21 | 28% | 19 | 113 |
| 11 | DataRefinerRegistryProxy.sol | 5 | 1 | 20% | 2 | 8 |
| 12 | DataRegistryImplementation.sol | 180 | 127 | 70% | 50 | 356 |
| 13 | QueryEngineImplementation.sol | 286 | 54 | 18% | 63 | 401 |
| 14 | QueryEngineProxy.sol | 5 | 1 | 20% | 2 | 8 |
| Total | 1403 | 488 | 35 | 329 | 2220 |
| # | Finding | Severity | Update |
| 1 | Improper access control management of Refiner when DLP Ownership is transferred | Info | Fixed |
| 2 | Native token can be lost when depositing an ERC20 token | Info | Fixed |
| 3 | Inconsistent casting of maxTimeout | Best Practices | Fixed |
| 4 | Owner address existence check can be optimized to save gas | Best Practices | Fixed |
| 5 | Inaccurate error emission | Best Practices | Fixed |
| 6 | Manual Initialization of TeePoolFactory could cause transaction revert when attempting bulk update | Best Practices | Fixed |
| 7 | The owner privileges can be permanently lost when updating contract custodian role | Best Practices | Fixed |
| 8 | Inconsistent key to value pair in _jobPayments mapping | Best Practices | Fixed |
| 9 | Inconsistent code logic with code comments | Best Practices | Acknowledged |
Vana's Data refinement process ascertains the security standards and verifiable quality of the ingested datasets before storage. The refinement process steps include data normalization to ensure the data is structured according to the on-chain schema, masking, which hides any information DLP owners do not want to provide access to, and encryption to prevent unauthorized access. The key contract components in Vana's Data refinement process include the DataRegistry, which adds refinements into data files, and the DataRefinerRegistry, which manages refiners that can be used to generate data refinements.
struct Refiner {
uint256 dlpId;
address owner;
string name;
string schemaDefinitionUrl;
string refinementInstructionUrl;
string publicKey;
struct ProofData {
uint256 score;
uint256 dlpId;
string metadata;
string proofUrl;
string instruction;
}Vana's Query Engine handles query payments for data access and manages access and permissions to refined data. The Query Engine is only accessible through the Compute Engine via Compute Engine Jobs. Data requestors submit registered jobs to the Compute Engine with a query scoped to the authorized dataset. The Query Engine access control structure ensures only authorized data requestors can query refined data.
struct Permission {
address grantee;
bool approved;
uint256 refinerId;
string tableName;
string columnName;
uint256 price;
}
struct PermissionInfo {
uint256 permissionId;
address grantee;
bool approved;
uint256 refinerId;
string tableName;
string columnName;
uint256 price;
} Vana's Compute Engine ensures safe operations on encrypted data through running containerized jobs and acts as a gateway to the Query Engine. The Compute Engine jobs are designed to be reusable and produce artifacts that are available for a defined period before expiration.
Additionally, the Compute Engine handles user deposits for data access and processes payment requests from the Query Engine.
struct PaymentInfo {
address payer;
mapping(address token => uint256 amount) paidAmounts;
}
The below diagram highlights various contract components and their interactions in Vana's Data Access Module.

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:
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:
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 / Likelihood | Low | Medium | High |
| High | Medium | High | Critical |
| Medium | Low | Medium | High |
| Low | Info / Best Practices | Low | Medium |
| Undetermined | Undetermined | Undetermined | Undetermined |
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.
Refiner when DLP Ownership is transferred| File | Fix commit | Type | Status |
DataRefinerRegistryImplementation.sol | PR #14 | Info | Fixed |
In addRefiner(...) function, the owner is set to the current owner of the dlpId, but if the owner is transferred then Refiner will still correspond to the old owner. This is an issue given functions addPermission(...) and updatePermissionApproval from the Query Engine uses the owner field of the Refiner struct.
Recommendation
Consider updating Refiner ownership whenever there is a DLP ownership transfer. This behavior should also be properly documented and communicated to DLP owners.
| File | Fix commit | Type | Status |
ComputeEngineImplementation.sol | PR #14 | Info | Fixed |
In the deposit(...) function of the ComputeEngineImplementation contract, it is possible to deposit with a nonzero msg.value given the function is marked payable while using an ERC20 token. In that case, the contract accepts native asset funds, but the deposit will be registered under the token. As a result, the function will attempt to transfer that token from the user to itself and then to the treasury, which would be double paying. The native asset is not tracked in this case and can be lost.
Recommendation
Consider adding a check if the token is VANA, then the msg.value must be zero.
maxTimeout| File | Fix commit | Type | Status |
ComputeEngineImplementation.sol | PR #14 | Best Practices | Fixed |
In the internal _registerJob (...) the passed parameter maxTimeout is of type uint256. However, in functions submitJob(...) and submitJobWithTee(...) where _registerJob(...) is called, the maxTimeout is passed as a uint80 data type. For consistency, the project should consider changing the maxTimeout type in _registerJob(...) to a uint80 and avoid silent casting.
Recommendation
Consider skipping the iteration for duplicate accounts to avoid double counting.
| File | Fix commit | Type | Status |
ComputeEngineImplementation.sol | PR #14 | Best Practices | Fixed |
In _registerJob() function, the instructions registry is queried just to check the owner's address as seen below:
function _registerJob(
uint256 maxTimeout,
bool gpuRequired,
uint256 computeInstructionId
) internal whenNotPaused returns (uint256 jobId) {
IComputeInstructionRegistry.ComputeInstructionInfo memory computeInstruction = instructionRegistry.instructions(
computeInstructionId
);
........
.......This can be optimized further by adding a simple existence check directly in the instruction registry.
Recommendation
Consider directly adding a simple existence check in the instruction registry to optimize the code and save gas.
| File | Fix commit | Type | Status |
ComputeEngineImplementation.sol | PR #14 | Best Practices | Fixed |
When updating job status via updateJobStatus(...) function, the contract checks the current job status if it is completed or Failed. If this is true, JobAlreadyDoneOrCanceled() error is emitted. The same inconsistency exists in cancelJob(...) function where the error of canceling a job is JobAlreadyDoneOrCanceled() but the code logic covers done, canceled and failed cases. Similarly, in _resubmitJobWithTee (...) the error message JobAlreadyDoneOrCanceled() would be incorrect if job.status is Submitted.
Recommendation
Consider ensuring consistent error emission with code logic.
TeePoolFactory could cause transaction revert when attempting bulk update| File | Fix commit | Type | Status |
ComputeEngineTeePoolFactoryImplementation.sol | PR #14 | Best Practices | Fixed |
After the TeePool is deployed via the beacon proxy, the user with maintainer role must manually set the teepoolFactory address without which, maxTimeout updates would fail. This could cause reverts when attempting to bulk update.
function updateTeePoolProxyFactory(
ComputeEngineTeePoolProxyFactory newTeePoolProxyFactory
) external override onlyRole(MAINTAINER_ROLE) {
teePoolProxyFactory = newTeePoolProxyFactory;
}Recommendation
Consider setting the teepoolFactory address when initializing the contract.
custodian role| File | Fix commit | Type | Status |
DataAccessTreasuryImplementation.sol | PR #14 | Best Practices | Fixed |
When updating the contract custodian, there is no check to ensure the newCustodian is not the owner's address.
function updateCustodian(address newCustodian) external override onlyRole(DEFAULT_ADMIN_ROLE) {
_revokeRole(DEFAULT_ADMIN_ROLE, custodian);
custodian = newCustodian;
_grantRole(DEFAULT_ADMIN_ROLE, newCustodian);
}Without this check, it is possible to set the custodian as the owner's address, effectively leaving the contract with only one custodian. If the custodian is changed again, the owner could lose privileges permanently.
Recommendation
Consider adding a check preventing the contract owner from becoming the contract's custodian.
_jobPayments mapping| File | Fix commit | Type | Status |
ComputeEngineStorageV1.sol | PR #14 | Best Practices | Fixed |
In ComputeEngineStorageV1 contract, the mapping _jobPayments has a mapping key provider seen as mapping(uint256 jobId => mapping(address provider => PaymentInfo paymentInfo)) internal _jobPayments;. However, the implementation logic in _executePaymentRequestFromQueryEngine (...) uses the token address as the key for this slot and then a token address again within a mapping from the resulting struct.
function _executePaymentRequestFromQueryEngine(address token, uint256 amount, bytes calldata metadata) internal {
...........
...........
PaymentInfo storage paymentInfo = _jobPayments[jobId][token];
paymentInfo.paidAmounts[token] += amount;
paymentInfo.payer = jobOwner;
emit PaymentExecuted(jobId, token, amount);
computeEngineTreasury.transfer(msg.sender, token, amount);
}A token is not a provider. This inconsistency should be addressed by changing the provider to another mapping key.
Recommendation
Consider updating the provider to another key in the mapping.
| File | Fix commit | Type | Status |
DataRegistryImplementation.sol | — | Best Practices | Acknowledged |
In DataRegistryImplementation contract, the code comments within addRefinementWithPermission(...) permission states: "The permission for an account is not allowed to be changed once set".
function addRefinementWithPermission(
uint256 fileId,
uint256 refinerId,
string calldata url,
address account,
string calldata key) external override whenNotPaused onlyRole(REFINEMENT_SERVICE_ROLE) {
...........
...........
// @dev Add permission for the account to access the refinement.
// The permission for an account is not allowed to be changed once set,
// to prevent previous refinements from being inaccessible.
if (bytes(_file.permissions[account]).length == 0) {
_file.permissions[account] = key;
emit PermissionGranted(fileId, account);
}
}However, the addFilePermission (...) function allows the account's permission to be updated.
Recommendation
Consider either updating the code logic, reflecting the code comments, or updating the code comments to reflect the code logic.
Resolution
This is acknowledged.
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:
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.
The Vana team has provided a comprehensive walkthrough of the project as well as documentation highlighting the pull request changes. Moreover, the team addressed all questions and concerns raised by the Nethermind Security team, providing valuable insights and a comprehensive understanding of the project's technical aspects.
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.
| 112Tests passed | 0Failed |
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.
The Leading Engineers of Blockchain Infrastructure