Dependencies for Building Acton: Complete Guide to the Rust Workspace
Acton is a pure Rust workspace where all library dependencies are centralized in the top-level Cargo.toml file and shared across member crates using Cargo's workspace dependency feature, requiring only Rust 1.94+ to compile.
The Acton project is a comprehensive development environment for the TON blockchain hosted at ton-blockchain/acton. Because it is implemented entirely in Rust, dependencies for building Acton are managed through Cargo’s workspace mechanism, which provides a single source of truth for all external crates used across the project's multiple sub-components.
Understanding Acton's Workspace Structure
Acton follows a Cargo workspace layout defined in the root Cargo.toml. This structure groups all local crates under the crates/ directory and the xtask helper directory into a unified build graph.
The [workspace.dependencies] table in the root configuration declares every external crate version once. Individual member crates then reference these using workspace = true, ensuring version consistency across the entire project. This approach eliminates version conflicts between sub-crates such as acton-config, ton-emulator, and tolk-compiler.
The Root Cargo.toml Configuration
The primary manifest at [Cargo.toml](https://github.com/ton-blockchain/acton/blob/master/Cargo.toml) contains four distinct dependency tables:
[workspace.dependencies]: Declares versions for all runtime crates used across the workspace[dependencies]: Re-exports essential runtime crates for the root binary withworkspace = true[dev-dependencies]: Contains testing and tooling crates likesnapbox,expect-test, anddap-client[build-dependencies]: Lists crates required by the build script (build.rs), specificallychrono,flate2, andtar
Core Runtime Dependencies
Acton relies on approximately 40 external crates for its core functionality. These can be categorized by their operational domain.
Blockchain and Cryptography Primitives
Interaction with the TON blockchain depends on ton (version 0.1.2) and tycho-types (version 0.3.0), which provide core blockchain primitives and type definitions.
For cryptographic operations in the built-in wallet functionality, Acton uses:
ring(0.17) for general cryptographic primitivesed25519-dalek(2.2.0) for Ed25519 signature schemeshmac(0.12.1) for hash-based message authentication
Async Runtime and Networking
The project uses tokio (1.41) as its asynchronous runtime for handling networking, DAP (Debug Adapter Protocol), and concurrent operations.
HTTP client functionality for the wallet and test UI relies on reqwest (0.12), while the local test server (acton up command) is built on axum (0.8.1) with tower-http (0.6.2) and tower-governor (0.8.0) for rate limiting.
Data Serialization and Storage
Configuration and contract data handling use serde (1.0.228), serde_json (1.0.145), and toml (0.9.8) for structured data serialization.
Data persistence is handled by rusqlite (0.31), which provides an embedded SQLite database used for indexing and caching blockchain data.
Language Parsing and LSP Support
Acton implements parsing for multiple TON-related languages (TolK, TL-B, TASM, Fift) using tree-sitter (0.25.10).
Language Server Protocol (LSP) support for the acton ls command uses tree-sitter-language (0.1) for grammar integration and tower-lsp (0.20) for the LSP implementation.
CLI and Build Tools
Command-line argument parsing for the Acton CLI utilizes clap (4.5), which provides derive macros for defining subcommands and options.
Development and Build-Time Dependencies
Dependencies only required during testing, development, or the compilation phase are strictly separated from runtime requirements.
Testing and Development Crates
The [dev-dependencies] section in the root Cargo.toml includes:
snapboxfor CLI snapshot testingexpect-testandexpectrlfor automated testing expectationsfs_extrafor filesystem operations in testsstrip-ansi-escapesfor terminal output normalizationdap-clientfor testing Debug Adapter Protocol integrations
Build Script Requirements
During the build process, Cargo executes build.rs scripts that require:
chronofor timestamp generationflate2for compressiontarfor archive handling
These are declared under [build-dependencies] and are only present during the compilation phase, not in the final binary.
How Dependency Resolution Works
When you execute cargo build in the repository root, Cargo performs the following resolution steps:
-
Workspace Discovery: Cargo reads the
[workspace]section to identify all member crates incrates/*andxtask/ -
Version Inheritance: For each member crate, Cargo resolves
workspace = truereferences by looking up the version in the root[workspace.dependencies]table -
Lock File Generation: On first build, Cargo generates a
Cargo.lockfile that pins exact versions of all transitive dependencies, ensuring reproducible builds across different machines -
Compilation Ordering: The build graph is constructed based on inter-crate dependencies, with external crates fetched from crates.io and compiled before local workspace members
Building Acton from Source
To build Acton from the official repository:
# Clone the repository
git clone https://github.com/ton-blockchain/acton.git
cd acton
# Build debug version (faster compilation, slower runtime)
cargo build
# Build optimized release version
cargo build --release
When adding new functionality to a specific crate, inherit workspace dependencies to maintain consistency:
# In crates/ton-emulator/Cargo.toml
[dependencies]
serde = { workspace = true } # Uses version from root Cargo.toml
tokio = { workspace = true }
regex = "1.11.1" # Crate-specific dependency
Example usage of workspace crates in source code:
use acton_config::Config;
use ton::Block;
/// Load configuration and display target network
fn main() -> Result<(), Box<dyn std::error::Error>> {
let cfg = Config::load("acton.toml")?;
println!("Network: {}", cfg.network);
Ok(())
}
Summary
- Acton is a pure Rust workspace where all dependencies are declared in the root
Cargo.tomland shared via[workspace.dependencies] - Runtime essentials include
tokiofor async operations,ton/tycho-typesfor blockchain logic,rusqlitefor storage, andaxumfor the test server - Development tools are isolated in
[dev-dependencies]and include testing frameworks likesnapboxandexpect-test - Build scripts require
chrono,flate2, andtarfor code generation and resource packing - Version consistency is enforced through the workspace feature, ensuring all sub-crates use identical dependency versions
- Minimum Rust version required is 1.94+
Frequently Asked Questions
What version of Rust is required to build Acton?
Acton requires Rust 1.94 or higher to compile. This version requirement ensures compatibility with the async features and dependency versions used across the workspace. You can check your installed version with rustc --version before building.
Where are Acton's dependencies declared?
All dependencies are declared in the root Cargo.toml file at the repository root. External crate versions are defined in the [workspace.dependencies] section, while local path dependencies point to crates in the crates/ directory. Individual sub-crates reference these using workspace = true rather than duplicating version numbers.
How does Acton manage dependency versions across multiple crates?
Acton uses Cargo's workspace dependency inheritance. The root Cargo.toml acts as a single source of truth where versions are declared once. Member crates in crates/ton-emulator/, crates/tolk-compiler/, and others inherit these versions via the workspace = true directive, preventing version drift and ensuring all components compile against compatible crate versions.
Are there any system-level dependencies required besides Rust?
No. Because Acton is a pure Rust project, only the Rust toolchain is required. All other dependencies are Rust crates downloaded automatically from crates.io by Cargo during the build process. The project does not require external C libraries, Node.js, or other build tools beyond what rustup and cargo provide.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →