Skip to content

Commit

Permalink
refactor!: Break cyclic build dependency
Browse files Browse the repository at this point in the history
To benefit from the optimizations the Rust compiler applies, Triton VM's
AIR constraints are emitted as Rust code during its build phase. The
first version of this code generator introduced a cyclic dependency
during the build phase, which could only be resolved through various
hacks.

Now, Triton VM is broken up into smaller crates, removing the cyclic
build dependency. This allows leveraging Cargo as the only build tool,
reducing the number of tools required to build Triton VM. It also
allows using unpublished versions of Triton VM in downstream crates.
Additionally, build times are improved.
  • Loading branch information
jan-ferdinand committed Sep 10, 2024
2 parents 05c6be8 + 7926a12 commit f594167
Show file tree
Hide file tree
Showing 113 changed files with 18,831 additions and 19,181 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Build AIR constraints
run: cargo run --bin constraint-evaluation-generator

- name: Collect coverage data
run: cargo llvm-cov nextest --all-targets --lcov --output-path lcov.info

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Build AIR constraints
run: cargo run --bin constraint-evaluation-generator

- name: Run fmt
run: cargo fmt --all -- --check

Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Added by Makefile configuration
/makefile-target

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
Expand Down
19 changes: 16 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[workspace]
members = ["triton-vm", "constraint-evaluation-generator"]
members = [
"triton-air",
"triton-constraint-builder",
"triton-constraint-circuit",
"triton-isa",
"triton-vm",
]
resolver = "2"

[profile.test]
Expand All @@ -22,16 +28,20 @@ readme = "README.md"
documentation = "https://triton-vm.org/spec/"

[workspace.dependencies]
air = { path = "triton-air", package = "triton-air" }
anyhow = "1.0"
arbitrary = { version = "1", features = ["derive"] }
assert2 = "0.3"
colored = "2.1"
constraint-builder = { path = "triton-constraint-builder", package = "triton-constraint-builder" }
constraint-circuit = { path = "triton-constraint-circuit", package = "triton-constraint-circuit" }
clap = { version = "4", features = ["derive", "cargo", "wrap_help", "unicode", "string"] }
criterion = { version = "0.5", features = ["html_reports"] }
directories = "5"
fs-err = "2.11.0"
get-size = "0.1.4"
indexmap = "2.2.6"
isa = { path = "triton-isa", package = "triton-isa" }
itertools = "0.13"
lazy_static = "1.5"
ndarray = { version = "0.16", features = ["rayon"] }
Expand All @@ -47,16 +57,19 @@ rand = "0.8.5"
rand_core = "0.6.4"
rayon = "1.10"
serde = { version = "1", features = ["derive"] }
serde_derive = "1"
serde_json = "1.0"
strum = { version = "0.26", features = ["derive"] }
syn = "2.0"
test-strategy = "0.4.0"
thiserror = "1.0"
trybuild = "1.0"
twenty-first = "0.42.0-alpha.9"
unicode-width = "0.1"

[workspace.lints.rust]
let_underscore_drop = "warn"
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"

[workspace.lints.clippy]
cast_lossless = "warn"
cloned_instead_of_copied = "warn"
Expand Down
72 changes: 0 additions & 72 deletions Makefile

This file was deleted.

9 changes: 0 additions & 9 deletions constraint-evaluation-generator/README.md

This file was deleted.

60 changes: 0 additions & 60 deletions constraint-evaluation-generator/src/codegen.rs

This file was deleted.

Loading

0 comments on commit f594167

Please sign in to comment.