Skip to content

Commit

Permalink
chore: remove dynamic compiler (WIP)
Browse files Browse the repository at this point in the history
Dynamic compiler was initially introduced in order to support compiling
multiple version of cairo with multiple version of scarb, and abstrating
away the versions from the CLI.

As we move to have a universal verifier, this should be removed and we
should instead start have generic crates to handle aspects of the
verification process.

As of right now we also do not use this for its original purpose
anymore, so it should be relatively safe to remove this.
  • Loading branch information
cwkang1998 committed Jul 24, 2024
1 parent 514cbb8 commit 74c1890
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 202 deletions.
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[workspace]
members = [
"crates/cli",
"crates/voyager-resolver-cairo",
"crates/dyn-compiler",
"crates/voyager-resolver-cairo"
]
"resolver" = "2"

Expand Down
2 changes: 0 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ strum = "0.25.0"
strum_macros = "0.25.0"
dirs = "4.0"

dyn-compiler = { path = "../dyn-compiler" }

# All resolver versions, based on scarb + cairo
voyager-resolver-cairo = { path = "../voyager-resolver-cairo" }
walkdir = "2.3.3"
Expand Down
16 changes: 4 additions & 12 deletions crates/cli/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ use std::fs;
use walkdir::{DirEntry, WalkDir};

use crate::api::{FileInfo, ProjectMetadataInfo};
use dyn_compiler::dyn_compiler::{DynamicCompiler, SupportedCairoVersions, SupportedScarbVersions};
use voyager_resolver_cairo::compiler::scarb_utils::read_additional_scarb_manifest_metadata;
use voyager_resolver_cairo::dyn_compiler::VoyagerGeneratorWrapper as VoyagerGenerator;

pub fn get_dynamic_compiler(cairo_version: SupportedCairoVersions) -> Box<dyn DynamicCompiler> {
match cairo_version {
SupportedCairoVersions::V2_4_3 => Box::new(VoyagerGenerator),
}
}
use voyager_resolver_cairo::compiler::{scarb_utils::read_additional_scarb_manifest_metadata, VoyagerGenerator};

#[derive(Debug, Deserialize, Serialize)]
struct ScarbTomlRawPackageData {
Expand All @@ -27,8 +19,8 @@ struct ScarbTomlRawData {

pub fn resolve_scarb(
path: Utf8PathBuf,
cairo_version: SupportedCairoVersions,
scarb_version: SupportedScarbVersions,
cairo_version: &str,
scarb_version: &str,
) -> anyhow::Result<(Vec<FileInfo>, ProjectMetadataInfo)> {
// Extract necessary files from the Scarb project for the verified contract
let source_dir = if path.is_absolute() {
Expand All @@ -39,7 +31,7 @@ pub fn resolve_scarb(
Utf8PathBuf::from_path_buf(current_path).unwrap()
};

let compiler = get_dynamic_compiler(cairo_version);
let compiler = Box::new(VoyagerGenerator);
let contract_paths = compiler.get_contracts_to_verify_path(&source_dir)?;

// TODO move the contract selection before the resolving step as a 'pre-resolving' step
Expand Down
1 change: 0 additions & 1 deletion crates/cli/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use dyn_compiler::dyn_compiler::{SupportedCairoVersions, SupportedScarbVersions};
use std::process::Command;

pub fn detect_local_tools() -> (SupportedScarbVersions, SupportedCairoVersions) {
Expand Down
3 changes: 0 additions & 3 deletions crates/cli/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ use anyhow::Result;
use camino::Utf8PathBuf;
use clap::{arg, Args};

use dyn_compiler::dyn_compiler::SupportedCairoVersions;

use crate::{
api::{
dispatch_class_verification_job, poll_verification_status, FileInfo, Network,
ProjectMetadataInfo,
},
license::LicenseType,
resolver::get_dynamic_compiler,
};

#[derive(Args, Debug)]
Expand Down
8 changes: 0 additions & 8 deletions crates/dyn-compiler/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion crates/dyn-compiler/README.md

This file was deleted.

77 changes: 0 additions & 77 deletions crates/dyn-compiler/src/dyn_compiler.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/dyn-compiler/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/voyager-resolver-cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ toml.workspace = true
toml_edit = "0.19.8"
rstest = "0.17.0"
camino.workspace = true
dyn-compiler = { path = "../dyn-compiler" }

# All version dependent dependencies
cairo-lang-casm = "=2.4.3"
Expand Down
83 changes: 0 additions & 83 deletions crates/voyager-resolver-cairo/src/dyn_compiler.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/voyager-resolver-cairo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod compiler;
pub mod dyn_compiler;
mod graph;
mod model;
pub mod utils;

0 comments on commit 74c1890

Please sign in to comment.