Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(blockifier): verify local cairo repo state before compiling #194

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions crates/blockifier/src/test_utils/cairo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,32 @@ fn verify_cairo0_compiler_deps() {
}

fn prepare_cairo1_compiler_deps(git_tag_override: Option<String>) {
// TODO(Dori, 1/6/2024): Check repo exists.
let cairo_repo_path = local_cairo1_compiler_repo_path();
let tag = git_tag_override.unwrap_or(format!("v{}", cairo1_compiler_version()));

// Check if the path is a directory.
assert!(
cairo_repo_path.is_dir(),
"Cannot verify Cairo1 contracts, Cairo repo not found at {0}.\nPlease run:\n\
git clone https://github.com/starkware-libs/cairo {0}\nThen rerun the test.",
cairo_repo_path.to_string_lossy(),
);

// Checkout the required version in the compiler repo.
run_and_verify_output(Command::new("git").args([
"-C",
// TODO(Dori, 1/6/2024): Handle CI case (repo path will be different).
local_cairo1_compiler_repo_path().to_str().unwrap(),
cairo_repo_path.to_str().unwrap(),
"checkout",
&tag,
]));

// Verify that the checked out tag is as expected.
run_and_verify_output(Command::new("git").args([
"-C",
cairo_repo_path.to_str().unwrap(),
"rev-parse",
"--verify",
&tag,
]));
}
Loading