Skip to content

Commit 2cb8729

Browse files
Pedro FontanaPedro Fontana
authored andcommitted
Revert "Add --run_from_cairo_pie to cairo-vm-cli + workflow (#1730)"
This reverts commit 0df3f34.
1 parent cb5fb87 commit 2cb8729

File tree

8 files changed

+15
-146
lines changed

8 files changed

+15
-146
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -724,43 +724,3 @@ jobs:
724724

725725
- name: Run script
726726
run: ./vm/src/tests/compare_factorial_outputs_all_layouts.sh
727-
728-
compare-run-from-cairo-pie-all-outputs:
729-
name: Compare all outputs from running Cairo PIEs
730-
needs: [ build-programs, build-release, run-cairo-release ]
731-
runs-on: ubuntu-22.04
732-
steps:
733-
- name: Checkout
734-
uses: actions/checkout@v3
735-
736-
- name: Python3 Build
737-
uses: actions/setup-python@v4
738-
with:
739-
python-version: '3.9'
740-
cache: 'pip'
741-
742-
- name: Install cairo-lang and deps
743-
run: pip install -r requirements.txt
744-
745-
- name: Fetch release binary
746-
uses: actions/cache/restore@v3
747-
with:
748-
key: cli-bin-rel-${{ github.sha }}
749-
path: target/release/cairo-vm-cli
750-
fail-on-cache-miss: true
751-
752-
- name: Fetch traces for cairo-vm
753-
uses: actions/cache/restore@v3
754-
with:
755-
path: |
756-
cairo_programs/**/*.memory
757-
cairo_programs/**/*.trace
758-
cairo_programs/**/*.air_public_input
759-
cairo_programs/**/*.air_private_input
760-
cairo_programs/**/*.pie.zip
761-
key: cairo_test_programs-release-trace-cache-${{ github.sha }}
762-
fail-on-cache-miss: true
763-
764-
- name: Run comparison
765-
run: ./vm/src/tests/compare_all_pie_outputs.sh
766-

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
**/*.air_public_input
1212
**/*.air_private_input
1313
**/*.pie.zip
14-
**/*.pie
1514
**/*.swp
1615
bench/results
1716
.python-version

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,6 @@ compare_air_private_input: $(CAIRO_RS_AIR_PRIVATE_INPUT) $(CAIRO_AIR_PRIVATE_INP
329329
compare_pie: $(CAIRO_RS_PIE) $(CAIRO_PIE)
330330
cd vm/src/tests; ./compare_vm_state.sh pie
331331

332-
compare_all_pie_outputs: $(CAIRO_RS_PIE)
333-
cd vm/src/tests; ./compare_all_pie_outputs.sh
334-
335332
# Run with nightly enable the `doc_cfg` feature wich let us provide clear explaination about which parts of the code are behind a feature flag
336333
docs:
337334
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --verbose --release --locked --no-deps --all-features --open
@@ -341,7 +338,6 @@ clean:
341338
rm -f $(TEST_DIR)/*.memory
342339
rm -f $(TEST_DIR)/*.trace
343340
rm -f $(TEST_DIR)/*.pie.zip
344-
rm -f $(TEST_DIR)/*.pie
345341
rm -f $(BENCH_DIR)/*.json
346342
rm -f $(BAD_TEST_DIR)/*.json
347343
rm -f $(PRINT_TEST_DIR)/*.json

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,10 @@ The cairo-vm-cli supports the following optional arguments:
174174

175175
- `--air_private_input <AIR_PRIVATE_INPUT>`: Receives the name of a file and outputs the AIR private inputs into it. Can only be used if proof_mode, trace_file & memory_file are also enabled.
176176

177-
- `--cairo_pie_output <CAIRO_PIE_OUTPUT>`: Receives the name of a file and outputs the Cairo PIE into it. Can only be used if proof_mode is not enabled.
177+
- `--cairo_pie_output <CAIRO_PIE_OUTPUT>`: Receives the name of a file and outputs the Cairo PIE into it. Can only be used if proof_mode, is not enabled.
178178

179179
- `--allow_missing_builtins`: Disables the check that all builtins used by the program need to be included in the selected layout. Enabled by default when in proof_mode.
180180

181-
- `run_from_cairo_pie`: Runs a Cairo PIE instead of a compiled json file. The name of the file will be the first argument received by the CLI (as if it were to run a normal compiled program). Can only be used if proof_mode is not enabled.
182-
183181
For example, to obtain the air public inputs from a fibonacci program run, we can run :
184182

185183
```bash

cairo-vm-cli/src/main.rs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ use cairo_vm::types::layout_name::LayoutName;
1010
use cairo_vm::vm::errors::cairo_run_errors::CairoRunError;
1111
use cairo_vm::vm::errors::trace_errors::TraceError;
1212
use cairo_vm::vm::errors::vm_errors::VirtualMachineError;
13-
use cairo_vm::vm::runners::cairo_pie::CairoPie;
1413
#[cfg(feature = "with_tracer")]
1514
use cairo_vm::vm::runners::cairo_runner::CairoRunner;
16-
use cairo_vm::vm::runners::cairo_runner::RunResources;
1715
#[cfg(feature = "with_tracer")]
1816
use cairo_vm::vm::vm_core::VirtualMachine;
1917
#[cfg(feature = "with_tracer")]
@@ -70,13 +68,6 @@ struct Args {
7068
#[structopt(long = "tracer")]
7169
#[cfg(feature = "with_tracer")]
7270
tracer: bool,
73-
#[structopt(
74-
long = "run_from_cairo_pie",
75-
// We need to add these air_private_input & air_public_input or else
76-
// passing run_from_cairo_pie + either of these without proof_mode will not fail
77-
conflicts_with_all = ["proof_mode", "air_private_input", "air_public_input"]
78-
)]
79-
run_from_cairo_pie: bool,
8071
}
8172

8273
#[derive(Debug, Error)]
@@ -162,7 +153,7 @@ fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
162153
let args = Args::try_parse_from(args)?;
163154

164155
let trace_enabled = args.trace_file.is_some() || args.air_public_input.is_some();
165-
156+
let mut hint_executor = BuiltinHintProcessor::new_empty();
166157
let cairo_run_config = cairo_run::CairoRunConfig {
167158
entrypoint: &args.entrypoint,
168159
trace_enabled,
@@ -174,26 +165,16 @@ fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
174165
..Default::default()
175166
};
176167

177-
let (cairo_runner, mut vm) = match {
178-
if args.run_from_cairo_pie {
179-
let pie = CairoPie::read_zip_file(&args.filename)?;
180-
let mut hint_processor = BuiltinHintProcessor::new(
181-
Default::default(),
182-
RunResources::new(pie.execution_resources.n_steps),
183-
);
184-
cairo_run::cairo_run_pie(&pie, &cairo_run_config, &mut hint_processor)
185-
} else {
186-
let program_content = std::fs::read(args.filename).map_err(Error::IO)?;
187-
let mut hint_processor = BuiltinHintProcessor::new_empty();
188-
cairo_run::cairo_run(&program_content, &cairo_run_config, &mut hint_processor)
189-
}
190-
} {
191-
Ok(runner) => runner,
192-
Err(error) => {
193-
eprintln!("{error}");
194-
return Err(Error::Runner(error));
195-
}
196-
};
168+
let program_content = std::fs::read(args.filename).map_err(Error::IO)?;
169+
170+
let (cairo_runner, mut vm) =
171+
match cairo_run::cairo_run(&program_content, &cairo_run_config, &mut hint_executor) {
172+
Ok(runner) => runner,
173+
Err(error) => {
174+
eprintln!("{error}");
175+
return Err(Error::Runner(error));
176+
}
177+
};
197178

198179
if args.print_output {
199180
let mut output_buffer = "Program Output:\n".to_string();

vm/src/tests/cairo_pie_comparator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
# Compare binary files
2424
with cairo_lang_pie_zip.open("memory.bin", 'r') as f1, cairo_vm_pie_zip.open("memory.bin", 'r') as f2:
2525
memory_comparator.compare_memory_file_contents(f1.read(), f2.read())
26+
27+
print(f"Comparison succesful for {filename1} vs {filename2}")

vm/src/tests/compare_all_pie_outputs.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.

vm/src/vm/runners/cairo_pie.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ impl CairoPie {
137137
#[cfg(feature = "std")]
138138
pub fn read_zip_file(file_path: &Path) -> Result<CairoPie, std::io::Error> {
139139
use std::io::Read;
140+
140141
use zip::ZipArchive;
141142

142143
let file = File::open(file_path)?;

0 commit comments

Comments
 (0)