NFT Contract Benchmarks
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The NFT Contract Benchmarks provide a performance evaluation framework for the NFT Contract within the Aztec Standards ecosystem. This module is designed to measure the efficiency and gas/resource consumption of various non-fungible token operations, including private and public minting, transfers, and burning processes. These benchmarks ensure that privacy-preserving extensions for digital assets meet the performance requirements of the Aztec Network.
Sources: README.md:32-34, benchmarks/nft_contract.benchmark.ts:22-24
Benchmark Architecture
The benchmarking system is built upon a standardized Benchmark base class, allowing for automated setup, execution, and teardown of test environments. The environment utilizes a specialized NFTBenchmarkContext to maintain state across different benchmarked methods, including wallet instances and deployed contract addresses.
Lifecycle Flow
The benchmark follows a strict lifecycle:
- Setup: Initializes the Aztec test suite, creates wallets, and deploys the NFT contract with a designated minter.
- Execution: Iterates through a defined list of
ContractFunctionInteractionCallIntentobjects. - Teardown: Cleans up the environment and destroys temporary data directories.
Benchmarked Operations
The benchmarks cover the full lifecycle of a non-fungible token, focusing specifically on the transitions between private and public states, which are critical to Aztec's confidentiality features.
Minting and Burning
Benchmarks include the initial creation of assets in both private and public storage, as well as their destruction. Burning operations often require specific nonces or commitments to prevent double-spending in private contexts.
| Operation | Context | Target Balance |
|---|---|---|
mint_to_private | Private | Owner's Private Note |
mint_to_public | Public | Owner's Public Balance |
burn_private | Private | N/A (Note nullification) |
burn_public | Public | N/A (Balance reduction) |
Sources: benchmarks/nft_contract.benchmark.ts:50-57, benchmarks/nft_contract.benchmark.ts:80-88
Transfer Transitions
The benchmarks measure the performance of four primary transfer types. These operations move the ownership of a tokenId between different privacy domains.
Setup and Infrastructure
The benchmarks rely on the setupTestSuite utility which handles the underlying Aztec node communication and PXE (Private eXecution Environment) configuration.
Configuration Parameters
Benchmarks can be configured via the package.json scripts and Nargo.toml workspace definitions.
- Prover Status: The benchmarks typically enable the prover (
proverEnabled: true) to measure the performance of zero-knowledge proof generation. - Data Management: A temporary directory is created for each run to ensure isolation.
- Timeouts: Due to the complexity of proof generation, operations are often governed by extended timeouts (e.g., 300,000ms).
Sources: package.json:18-24, src/ts/test/utils.ts:60-65, src/ts/test/nft.test.ts:24
Dependency Structure
The benchmark suite integrates multiple layers of the Aztec stack:
Conclusion
The NFT Contract Benchmarks serve as a critical tool for maintaining the performance standards of privacy-preserving digital assets on Aztec. By measuring the resource requirements of private transfers and state transitions, developers can ensure that the NFT implementation remains efficient while providing full confidentiality.
Sources: README.md:32-35, benchmarks/nft_contract.benchmark.ts:1-92