Documentation Index
Fetch the complete documentation index at: https://mintlify.com/across-protocol/contracts/llms.txt
Use this file to discover all available pages before exploring further.
Testing Strategy
Across Protocol uses a multi-layered testing approach to ensure contract security and correctness:- Foundry tests (primary): Fast, gas-efficient unit and fork tests written in Solidity
- Hardhat tests (legacy): TypeScript tests using Mocha/Chai, gradually being migrated to Foundry
- Fork tests: Test against live network state to validate cross-chain interactions
- Gas analytics: Monitor and optimize gas consumption for production deployments
Test Organization
Quick Start
Run All Tests
Run Specific Tests
Available Test Commands
EVM Tests
| Command | Description |
|---|---|
yarn test-evm | Run all EVM tests (Foundry + Hardhat) |
yarn test-evm-foundry | Run Foundry local tests (uses FOUNDRY_PROFILE=local-test) |
yarn test-evm-hardhat | Run Hardhat tests (legacy) |
FOUNDRY_PROFILE=local-test forge test | Run Foundry tests directly |
SVM (Solana) Tests
| Command | Description |
|---|---|
yarn test-svm | Run SVM tests with local toolchain build |
yarn test-svm-solana-verify | Run SVM tests with verified Docker build |
Combined Tests
| Command | Description |
|---|---|
yarn test | Run all tests (EVM + SVM) with local builds |
yarn test-verified | Run all tests with verified builds |
Gas Reporting
| Command | Description |
|---|---|
yarn test:report-gas | Run Hardhat tests with gas reporter enabled |
FOUNDRY_PROFILE=local-test forge test --gas-report | Run Foundry tests with gas reporting |
Test Environments
Local Tests
Fast unit tests that don’t require network connectivity. Use mocks for external contracts.Fork Tests
Tests that run against forked mainnet/testnet state. Useful for validating cross-chain behavior.Test Configuration
Foundry Profiles
The project uses Foundry profiles defined infoundry.toml:
- default: Standard build configuration
- local-test: Optimized for local unit tests (skips fork tests)
- zksync: ZKSync-specific compilation
Environment Variables
For fork tests, set the appropriate RPC URLs:Writing Tests
See the framework-specific pages for detailed guidance:- Foundry Tests - Primary testing framework
- Hardhat Tests - Legacy tests (migration in progress)
Continuous Integration
CI runs the following test suite:Next Steps
Foundry Tests
Learn about writing and running Foundry tests
Hardhat Tests
Understand legacy Hardhat test structure