Installation & Prerequisites
Relevant source files
The following files were used as context for generating this wiki page:
This page provides a comprehensive guide for setting up the development environment and installing dependencies for the Canon Guard project. Canon Guard is a multisig security solution utilizing on-chain Actions contracts and dynamic timelocks to enhance transaction security and verification.
The project is built primarily using the Foundry framework for Ethereum development, with additional dependencies on Node.js/Yarn for task management and Rust for specific linting tools.
System Requirements
Before installing the project, ensure your environment meets the following baseline requirements:
| Tool | Version/Source | Purpose |
|---|---|---|
| Foundry | Latest | Smart contract development, testing, and deployment |
| Node.js | Compatible with Yarn | Script execution and dependency management |
| Yarn | 1.x or 4.x (via package.json) | Package management |
| Rust/Cargo | Latest | Required for lintspec and other CLI tools |
| Medusa | crytic/medusa | Fuzz testing (Optional) |
| Halmos | a16z/halmos | Symbolic execution (Optional) |
Sources: README.md:9-14, CLAUDE.md:73-77, package.json:44-58
Installation Steps
1. Toolchain Setup
The development environment relies on Foundry for the core Ethereum Virtual Machine (EVM) interactions.
- Install Foundry: Follow the official installation instructions to get
forge,cast,anvil, andchisel. - Install Rust Dependencies: The project uses
lintspecfor Solidity linting.cargo install lintspec - Install Node Dependencies: Use Yarn to install the required JavaScript packages and Solidity dependencies mapped via
remappings.txt.
Note: Ifyarn installyarn installfails, runfoundryupto ensure your Foundry toolchain is up to date and retry.
Sources: README.md:12-14, CLAUDE.md:74-75
2. Configuration & Environment
The project uses environment variables for RPC endpoints and deployment credentials.
- Environment Variables: Copy the example file and populate it with your specific keys and RPC URLs.
cp .env.example .env - Required Variables: Ensure the following are set in your
.envfile:ETHEREUM_RPC: RPC URL for Ethereum Mainnet.OPTIMISM_RPC: RPC URL for Optimism.ETHERSCAN_API_KEY: For contract verification.ETHEREUM_DEPLOYER_NAME: The name of the account in Foundry's keystore.
Sources: README.md:10-11, foundry.toml:42-47
3. Keystore Setup
For secure deployments, Foundry's encrypted keystore is used instead of raw private keys in .env.
# Import Ethereum deployer
cast wallet import $ETHEREUM_DEPLOYER_NAME --interactive
# Import Optimism deployer
cast wallet import $OPTIMISM_DEPLOYER_NAME --interactive
Sources: README.md:65-71, CLAUDE.md:77
Development Workflow
The following diagram illustrates the typical setup and build flow for a new contributor.
The workflow ensures that all toolchains (Foundry, Rust, Node) are synchronized before attempting to compile the contracts.
Sources: README.md:12-23, CLAUDE.md:33-40
Project Structure & Dependencies
The project organizes its dependencies and source files through a combination of package.json for versioning and remappings.txt for Solidity imports.
Core Dependencies
- Safe Contracts:
@safe-global/safe-contracts(Safe smart account logic). - Solady: Optimized Solidity snippets.
- Forge Standard Library: Standard testing utilities.
Source Remappings
The project uses specific aliases for cleaner import statements in Solidity:
contracts/=src/contracts
interfaces/=src/interfaces
@safe-smart-account/=node_modules/@safe-global/safe-contracts/contracts
solady/=node_modules/solady/src
Sources: package.json:44-50, remappings.txt:1-7
Verification of Installation
To verify the installation is successful, execute the build command. The project supports two build profiles configured in foundry.toml:
| Profile | Command | Logic |
|---|---|---|
| Default | yarn build | Standard forge build with 10,000 optimizer runs. |
| Optimized | yarn build:optimized | Enables via_ir (Intermediate Representation) for better optimization. |
Build Configuration Detail
[profile.default]
solc_version = '0.8.30'
optimizer_runs = 10_000
evm_version = 'prague'
[profile.optimized]
via_ir = true
out = 'out-via-ir'
Sources: README.md:21-29, foundry.toml:11-20, package.json:15-16
Testing Infrastructure Setup
Canon Guard employs multiple testing tiers that require specific tool installation.
Fuzzing with Medusa
To use the yarn test:fuzz command, Medusa must be installed and configured. The project includes a medusa.json file which defines:
- Workers: 10
- Target Contracts:
FuzzTest - Block/Timestamp Delay Max: 604,800 seconds (7 days)
Sources: medusa.json:2-10, README.md:46-49
Symbolic Execution with Halmos
To use yarn test:symbolic, Halmos must be installed. The project integrates halmos-cheatcodes for this purpose.
Sources: package.json:52, README.md:52-55
Summary
Setting up Canon Guard requires a multi-language toolchain including Foundry (Solidity), Rust (linting), and Node.js (scripts). By following the structured setup of environment variables and the Foundry keystore, developers can ensure a secure and reproducible environment for building and testing the multisig security infrastructure.