diff --git a/cairo/bootloader/hash_program.py b/cairo/bootloader/hash_program.py index de59519..01755d5 100644 --- a/cairo/bootloader/hash_program.py +++ b/cairo/bootloader/hash_program.py @@ -1,20 +1,28 @@ import argparse import json - from starkware.cairo.common.hash_chain import compute_hash_chain from starkware.cairo.lang.compiler.program import Program, ProgramBase from starkware.cairo.lang.version import __version__ -from starkware.cairo.lang.vm.crypto import get_crypto_lib_context_manager, poseidon_hash_many +from starkware.cairo.lang.vm.crypto import ( + get_crypto_lib_context_manager, + poseidon_hash_many, +) from starkware.python.utils import from_bytes -def compute_program_hash_chain(program: ProgramBase, use_poseidon: bool, bootloader_version=0): +def compute_program_hash_chain( + program: ProgramBase, use_poseidon: bool, bootloader_version=0 +): """ Computes a hash chain over a program, including the length of the data chain. """ builtin_list = [from_bytes(builtin.encode("ascii")) for builtin in program.builtins] # The program header below is missing the data length, which is later added to the data_chain. - program_header = [bootloader_version, program.main, len(program.builtins)] + builtin_list + program_header = [ + bootloader_version, + program.main, + len(program.builtins), + ] + builtin_list data_chain = program_header + program.data if use_poseidon: @@ -23,8 +31,12 @@ def compute_program_hash_chain(program: ProgramBase, use_poseidon: bool, bootloa def main(): - parser = argparse.ArgumentParser(description="A tool to compute the hash of a cairo program") - parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {__version__}") + parser = argparse.ArgumentParser( + description="A tool to compute the hash of a cairo program" + ) + parser.add_argument( + "-v", "--version", action="version", version=f"%(prog)s {__version__}" + ) parser.add_argument( "--program", type=argparse.FileType("r"), @@ -48,7 +60,13 @@ def main(): with get_crypto_lib_context_manager(args.flavor): program = Program.Schema().load(json.load(args.program)) - print(hex(compute_program_hash_chain(program=program, use_poseidon=args.use_poseidon))) + print( + hex( + compute_program_hash_chain( + program=program, use_poseidon=args.use_poseidon + ) + ) + ) if __name__ == "__main__": diff --git a/cairo/bootloader/objects.py b/cairo/bootloader/objects.py index 9c67070..ff0e054 100644 --- a/cairo/bootloader/objects.py +++ b/cairo/bootloader/objects.py @@ -1,21 +1,15 @@ import dataclasses from abc import abstractmethod -from typing import Optional - +from typing import List, Optional import marshmallow_dataclass - from starkware.cairo.lang.compiler.program import ProgramBase, StrippedProgram from starkware.cairo.lang.vm.cairo_pie import CairoPie from starkware.starkware_utils.validated_dataclass import ValidatedMarshmallowDataclass class TaskSpec(ValidatedMarshmallowDataclass): - """ - Contains task's specification. - """ - @abstractmethod - def load_task(self, memory=None, args_start=None, args_len=None) -> "Task": + def load_task(self) -> "Task": """ Returns the corresponding task. """ @@ -39,27 +33,32 @@ def get_program(self) -> StrippedProgram: @dataclasses.dataclass(frozen=True) -class Job(Task): +class JobData(Task): reward: int num_of_steps: int - cairo_pie: bytearray - registry_address: bytearray - public_key: bytearray - signature: bytearray + cairo_pie_compressed: List[int] + registry_address: str def load_task(self) -> "CairoPieTask": - """ - Loads the PIE to memory. - """ return CairoPieTask( - cairo_pie=CairoPie.deserialize(self.cairo_pie), - use_poseidon=self.use_poseidon, + cairo_pie=CairoPie.deserialize(bytes(self.cairo_pie_compressed)), + use_poseidon=True, ) +@dataclasses.dataclass(frozen=True) +class Job(Task): + job_data: JobData + public_key: List[int] + signature: List[int] + + def load_task(self) -> "CairoPieTask": + return self.job_data.load_task() + + @marshmallow_dataclass.dataclass(frozen=True) class SimpleBootloaderInput(ValidatedMarshmallowDataclass): - identity: bytearray + identity: str job: Job fact_topologies_path: Optional[str] diff --git a/cairo/bootloader/recursive_with_poseidon/builtins.py b/cairo/bootloader/recursive_with_poseidon/builtins.py index bb4b337..78f19ac 100644 --- a/cairo/bootloader/recursive_with_poseidon/builtins.py +++ b/cairo/bootloader/recursive_with_poseidon/builtins.py @@ -8,4 +8,4 @@ BITWISE_BUILTIN, POSEIDON_BUILTIN, ] -) \ No newline at end of file +) diff --git a/cairo/bootloader/recursive_with_poseidon/execute_task.cairo b/cairo/bootloader/recursive_with_poseidon/execute_task.cairo index ee1d1e5..06bf2bd 100644 --- a/cairo/bootloader/recursive_with_poseidon/execute_task.cairo +++ b/cairo/bootloader/recursive_with_poseidon/execute_task.cairo @@ -144,23 +144,17 @@ func execute_task{builtin_ptrs: BuiltinData*, self_range_check_ptr}( %{ from bootloader.objects import ( CairoPieTask, - RunProgramTask, Task, ) from bootloader.utils import ( load_cairo_pie, - prepare_output_runner, ) assert isinstance(task, Task) n_builtins = len(task.get_program().builtins) new_task_locals = {} - if isinstance(task, RunProgramTask): - new_task_locals['program_input'] = task.program_input - new_task_locals['WITH_BOOTLOADER'] = True - - vm_load_program(task.program, program_address) - elif isinstance(task, CairoPieTask): + + if isinstance(task, CairoPieTask): ret_pc = ids.ret_pc_label.instruction_offset_ - ids.call_task.instruction_offset_ + pc load_cairo_pie( task=task.cairo_pie, memory=memory, segments=segments, @@ -169,10 +163,6 @@ func execute_task{builtin_ptrs: BuiltinData*, self_range_check_ptr}( else: raise NotImplementedError(f'Unexpected task type: {type(task).__name__}.') - output_runner_data = prepare_output_runner( - task=task, - output_builtin=output_builtin, - output_ptr=ids.pre_execution_builtin_ptrs.output) vm_enter_scope(new_task_locals) %} @@ -243,8 +233,6 @@ func execute_task{builtin_ptrs: BuiltinData*, self_range_check_ptr}( fact_topologies.append(get_task_fact_topology( output_size=output_end - output_start, task=task, - output_builtin=output_builtin, - output_runner_data=output_runner_data, )) %} diff --git a/cairo/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo b/cairo/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo index 257a898..17ada90 100644 --- a/cairo/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo +++ b/cairo/bootloader/recursive_with_poseidon/run_simple_bootloader.cairo @@ -21,7 +21,7 @@ func run_simple_bootloader{ local task_range_check_ptr; %{ - n_tasks = len(simple_bootloader_input.tasks) + n_tasks = 1 memory[ids.output_ptr] = n_tasks # Task range checks are located right after simple bootloader validation range checks, and @@ -65,7 +65,6 @@ func run_simple_bootloader{ // Call execute_tasks. let (__fp__, _) = get_fp_and_pc(); - %{ tasks = simple_bootloader_input.tasks %} let builtin_ptrs = &builtin_ptrs_before; let self_range_check_ptr = range_check_ptr; with builtin_ptrs, self_range_check_ptr { @@ -141,9 +140,7 @@ func execute_tasks{builtin_ptrs: BuiltinData*, self_range_check_ptr}( from bootloader.objects import Task # Pass current task to execute_task. - task_id = len(simple_bootloader_input.tasks) - ids.n_tasks - task_obj = simple_bootloader_input.tasks[task_id] - task = task_obj.load_task() + task = simple_bootloader_input.job.load_task() %} tempvar use_poseidon = nondet %{ 1 if task.use_poseidon else 0 %}; // Call execute_task to execute the current task. diff --git a/cairo/bootloader/utils.py b/cairo/bootloader/utils.py index 2adf4b5..aade3ec 100644 --- a/cairo/bootloader/utils.py +++ b/cairo/bootloader/utils.py @@ -1,20 +1,22 @@ import json import os -from typing import Any, List, Union - +from typing import List import aiofiles - from starkware.cairo.bootloaders.fact_topology import ( FactTopologiesFile, FactTopology, get_fact_topology_from_additional_data, ) -from bootloader.objects import CairoPieTask, RunProgramTask, Task +from bootloader.objects import CairoPieTask, Task from starkware.cairo.common.hash_state import compute_hash_on_elements from starkware.cairo.lang.compiler.program import Program from starkware.cairo.lang.vm.cairo_pie import CairoPie, ExecutionResources from starkware.cairo.lang.vm.output_builtin_runner import OutputBuiltinRunner -from starkware.cairo.lang.vm.relocatable import MaybeRelocatable, RelocatableValue, relocate_value +from starkware.cairo.lang.vm.relocatable import ( + MaybeRelocatable, + RelocatableValue, + relocate_value, +) from starkware.python.utils import WriteOnceDict, from_bytes SIMPLE_BOOTLOADER_COMPILED_PATH = os.path.join( @@ -89,7 +91,7 @@ def write_return_builtins( used_builtins_addr, pre_execution_builtins_addr, task, - all_builtins + all_builtins, ): """ Writes the updated builtin pointers after the program execution to the given return builtins @@ -100,7 +102,9 @@ def write_return_builtins( used_builtin_offset = 0 for index, builtin in enumerate(all_builtins): if builtin in used_builtins: - memory[return_builtins_addr + index] = memory[used_builtins_addr + used_builtin_offset] + memory[return_builtins_addr + index] = memory[ + used_builtins_addr + used_builtin_offset + ] used_builtin_offset += 1 if isinstance(task, CairoPie): @@ -110,7 +114,9 @@ def write_return_builtins( ), "Builtin usage is inconsistent with the CairoPie." else: # The builtin is unused, hence its value is the same as before calling the program. - memory[return_builtins_addr + index] = memory[pre_execution_builtins_addr + index] + memory[return_builtins_addr + index] = memory[ + pre_execution_builtins_addr + index + ] def load_cairo_pie( @@ -168,59 +174,31 @@ def local_relocate_value(value): esdsa_additional_data = task.additional_data.get("ecdsa_builtin") if esdsa_additional_data is not None: ecdsa_builtin = builtin_runners.get("ecdsa_builtin") - assert ecdsa_builtin is not None, "The task requires the ecdsa builtin but it is missing." - ecdsa_builtin.extend_additional_data(esdsa_additional_data, local_relocate_value) + assert ( + ecdsa_builtin is not None + ), "The task requires the ecdsa builtin but it is missing." + ecdsa_builtin.extend_additional_data( + esdsa_additional_data, local_relocate_value + ) for addr, val in task.memory.items(): memory[local_relocate_value(addr)] = local_relocate_value(val) -def prepare_output_runner( - task: Task, output_builtin: OutputBuiltinRunner, output_ptr: RelocatableValue -): - """ - Prepares the output builtin if the type of task is Task, so that pages of the inner program - will be recorded separately. - If the type of task is CairoPie, nothing should be done, as the program does not contain - hints that may affect the output builtin. - The return value of this function should be later passed to get_task_fact_topology(). - """ - - if isinstance(task, RunProgramTask): - output_state = output_builtin.get_state() - output_builtin.new_state(base=output_ptr) - return output_state - elif isinstance(task, CairoPieTask): - return None - else: - raise NotImplementedError(f"Unexpected task type: {type(task).__name__}.") - - def get_task_fact_topology( output_size: int, - task: Union[RunProgramTask, CairoPie], - output_builtin: OutputBuiltinRunner, - output_runner_data: Any, + task: CairoPie, ) -> FactTopology: """ - Returns the fact_topology that corresponds to 'task'. Restores output builtin state if 'task' is - a RunProgramTask. + Returns the fact_topology that corresponds to 'task'. """ - # Obtain the fact_toplogy of 'task'. - if isinstance(task, RunProgramTask): - assert output_runner_data is not None - fact_topology = get_fact_topology_from_additional_data( - output_size=output_size, - output_builtin_additional_data=output_builtin.get_additional_data(), - ) - # Restore the output builtin runner to its original state. - output_builtin.set_state(output_runner_data) - elif isinstance(task, CairoPieTask): - assert output_runner_data is None + if isinstance(task, CairoPieTask): fact_topology = get_fact_topology_from_additional_data( output_size=output_size, - output_builtin_additional_data=task.cairo_pie.additional_data["output_builtin"], + output_builtin_additional_data=task.cairo_pie.additional_data[ + "output_builtin" + ], ) else: raise NotImplementedError(f"Unexpected task type: {type(task).__name__}.") @@ -237,7 +215,9 @@ def add_consecutive_output_pages( offset = 0 for i, page_size in enumerate(fact_topology.page_sizes): output_builtin.add_page( - page_id=cur_page_id + i, page_start=output_start + offset, page_size=page_size + page_id=cur_page_id + i, + page_start=output_start + offset, + page_size=page_size, ) offset += page_size @@ -268,10 +248,14 @@ def configure_fact_topologies( output_start += sum(fact_topology.page_sizes) -def write_to_fact_topologies_file(fact_topologies_path: str, fact_topologies: List[FactTopology]): +def write_to_fact_topologies_file( + fact_topologies_path: str, fact_topologies: List[FactTopology] +): with open(fact_topologies_path, "w") as fp: json.dump( - FactTopologiesFile.Schema().dump(FactTopologiesFile(fact_topologies=fact_topologies)), + FactTopologiesFile.Schema().dump( + FactTopologiesFile(fact_topologies=fact_topologies) + ), fp, indent=4, sort_keys=True, @@ -279,17 +263,24 @@ def write_to_fact_topologies_file(fact_topologies_path: str, fact_topologies: Li fp.write("\n") -def calc_simple_bootloader_execution_resources(program_length: int) -> ExecutionResources: +def calc_simple_bootloader_execution_resources( + program_length: int, +) -> ExecutionResources: """ Returns an upper bound on the number of steps and builtin instances that the simple bootloader uses. """ - n_steps = SIMPLE_BOOTLOADER_N_STEPS_RATIO * program_length + SIMPLE_BOOTLOADER_N_STEPS_CONSTANT + n_steps = ( + SIMPLE_BOOTLOADER_N_STEPS_RATIO * program_length + + SIMPLE_BOOTLOADER_N_STEPS_CONSTANT + ) builtin_instance_counter = { "pedersen_builtin": SIMPLE_BOOTLOADER_N_PEDERSEN + program_length, "range_check_builtin": SIMPLE_BOOTLOADER_N_RANGE_CHECKS, "output_builtin": SIMPLE_BOOTLOADER_N_OUTPUT, } return ExecutionResources( - n_steps=n_steps, builtin_instance_counter=builtin_instance_counter, n_memory_holes=0 - ) \ No newline at end of file + n_steps=n_steps, + builtin_instance_counter=builtin_instance_counter, + n_memory_holes=0, + ) diff --git a/compile.py b/compile.py new file mode 100644 index 0000000..ec4c4ed --- /dev/null +++ b/compile.py @@ -0,0 +1,9 @@ +import os +from install import log_and_run + +if __name__ == "__main__": + current_dir = os.getcwd() + + log_and_run([ + f"cairo-compile --cairo_path=. bootloader/recursive_with_poseidon/simple_bootloader.cairo --output {current_dir}/bootloader.json --proof_mode", + ], "Compile bootloader program", cwd="cairo") \ No newline at end of file diff --git a/crates/runner/src/cairo_runner/mod.rs b/crates/runner/src/cairo_runner/mod.rs index 47767b3..bb92a17 100644 --- a/crates/runner/src/cairo_runner/mod.rs +++ b/crates/runner/src/cairo_runner/mod.rs @@ -1,7 +1,8 @@ -use self::types::input::{BootloaderInput, BootloaderTask}; +use self::types::input::SimpleBootloaderInput; use crate::{errors::RunnerControllerError, traits::RunnerController}; use async_process::Stdio; use futures::Future; +use libsecp256k1::PublicKey; use sharp_p2p_common::{hash, job::Job, job_trace::JobTrace, layout::Layout, process::Process}; use std::{ hash::{DefaultHasher, Hash, Hasher}, @@ -17,11 +18,12 @@ pub mod types; pub struct CairoRunner { program_path: PathBuf, + public_key: PublicKey, } impl CairoRunner { - pub fn new(program_path: PathBuf) -> Self { - Self { program_path } + pub fn new(program_path: PathBuf, public_key: PublicKey) -> Self { + Self { program_path, public_key } } } @@ -33,18 +35,14 @@ impl RunnerController for CairoRunner { let (terminate_tx, mut terminate_rx) = mpsc::channel::<()>(10); let future: Pin> + '_>> = Box::pin(async move { + let job_hash = hash!(job); let layout: &str = Layout::RecursiveWithPoseidon.into(); let mut cairo_pie = NamedTempFile::new()?; cairo_pie.write_all(&job.job_data.cairo_pie_compressed)?; - let input = BootloaderInput { - tasks: vec![BootloaderTask { - path: cairo_pie.path().to_path_buf(), - ..Default::default() - }], - ..Default::default() - }; + let input = + SimpleBootloaderInput { identity: self.public_key, job, single_page: true }; let mut program_input = NamedTempFile::new()?; program_input.write_all(&serde_json::to_string(&input)?.into_bytes())?; @@ -75,8 +73,6 @@ impl RunnerController for CairoRunner { .stdout(Stdio::null()) .spawn()?; - let job_hash = hash!(job); - debug!("task {} spawned", job_hash); loop { diff --git a/crates/runner/src/cairo_runner/tests/multiple_job.rs b/crates/runner/src/cairo_runner/tests/multiple_job.rs index 63f1979..322540d 100644 --- a/crates/runner/src/cairo_runner/tests/multiple_job.rs +++ b/crates/runner/src/cairo_runner/tests/multiple_job.rs @@ -3,13 +3,19 @@ use crate::{ traits::RunnerController, }; use futures::{stream::FuturesUnordered, StreamExt}; +use libsecp256k1::{PublicKey, SecretKey}; +use rand::thread_rng; #[tokio::test] async fn run_multiple_jobs() { + let mut rng = thread_rng(); let fixture1 = fixture(); let fixture2 = fixture(); - let runner = CairoRunner::new(fixture1.program_path); + let runner = CairoRunner::new( + fixture1.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let mut futures = FuturesUnordered::new(); let job1 = runner.run(fixture1.job).unwrap(); @@ -25,10 +31,14 @@ async fn run_multiple_jobs() { #[tokio::test] async fn abort_multiple_jobs() { + let mut rng = thread_rng(); let fixture1 = fixture(); let fixture2 = fixture(); - let runner = CairoRunner::new(fixture1.program_path); + let runner = CairoRunner::new( + fixture1.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let mut futures = FuturesUnordered::new(); let job1 = runner.run(fixture1.job).unwrap(); diff --git a/crates/runner/src/cairo_runner/tests/single_job.rs b/crates/runner/src/cairo_runner/tests/single_job.rs index 3c332e1..6b88d99 100644 --- a/crates/runner/src/cairo_runner/tests/single_job.rs +++ b/crates/runner/src/cairo_runner/tests/single_job.rs @@ -2,20 +2,30 @@ use crate::{ cairo_runner::{tests::models::fixture, CairoRunner}, traits::RunnerController, }; +use libsecp256k1::{PublicKey, SecretKey}; +use rand::thread_rng; #[tokio::test] async fn run_single_job() { + let mut rng = thread_rng(); let fixture = fixture(); - let runner = CairoRunner::new(fixture.program_path); + let runner = CairoRunner::new( + fixture.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); runner.run(fixture.job).unwrap().await.unwrap(); } #[tokio::test] async fn abort_single_jobs() { + let mut rng = thread_rng(); let fixture = fixture(); - let runner = CairoRunner::new(fixture.program_path); + let runner = CairoRunner::new( + fixture.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let job = runner.run(fixture.job).unwrap(); job.abort().await.unwrap(); job.await.unwrap_err(); diff --git a/crates/runner/src/cairo_runner/types/input.rs b/crates/runner/src/cairo_runner/types/input.rs index eaabd77..d199b3b 100644 --- a/crates/runner/src/cairo_runner/types/input.rs +++ b/crates/runner/src/cairo_runner/types/input.rs @@ -1,30 +1,10 @@ +use libsecp256k1::PublicKey; use serde::{Deserialize, Serialize}; -use std::path::PathBuf; +use sharp_p2p_common::job::Job; #[derive(Serialize, Deserialize)] -pub struct BootloaderTask { - #[serde(rename = "type")] - pub type_: String, - pub path: PathBuf, - pub use_poseidon: bool, -} - -#[derive(Serialize, Deserialize)] -pub struct BootloaderInput { - pub tasks: Vec, +pub struct SimpleBootloaderInput { + pub identity: PublicKey, + pub job: Job, pub single_page: bool, } - -impl Default for BootloaderTask { - fn default() -> Self { - Self { type_: "CairoPiePath".to_string(), path: PathBuf::default(), use_poseidon: true } - } -} - -impl Default for BootloaderInput { - fn default() -> Self { - Self { tasks: Vec::default(), single_page: true } - } -} - -pub fn write_cairo_pie_zip() {} diff --git a/crates/tests/src/tests/compiler_runner_flow.rs b/crates/tests/src/tests/compiler_runner_flow.rs index 9cb496f..09dde35 100644 --- a/crates/tests/src/tests/compiler_runner_flow.rs +++ b/crates/tests/src/tests/compiler_runner_flow.rs @@ -1,5 +1,6 @@ use futures::stream::FuturesUnordered; use futures::{FutureExt, StreamExt}; +use libsecp256k1::{PublicKey, SecretKey}; use rand::thread_rng; use sharp_p2p_compiler::cairo_compiler::tests::models::fixture as compiler_fixture; use sharp_p2p_compiler::cairo_compiler::CairoCompiler; @@ -15,7 +16,10 @@ async fn run_single_job() { let runner_fixture = runner_fixture(); let compiler = CairoCompiler::new(libsecp256k1::SecretKey::random(&mut rng)); - let runner = CairoRunner::new(runner_fixture.program_path); + let runner = CairoRunner::new( + runner_fixture.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); compiler .run(compiler_fixture.program_path, compiler_fixture.program_input_path) @@ -37,7 +41,10 @@ async fn run_multiple_job() { let runner_fixture1 = runner_fixture(); let compiler = CairoCompiler::new(libsecp256k1::SecretKey::random(&mut rng)); - let runner = CairoRunner::new(runner_fixture1.program_path); + let runner = CairoRunner::new( + runner_fixture1.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let mut futures = FuturesUnordered::new(); let job_trace1 = compiler diff --git a/crates/tests/src/tests/runner_prover_flow.rs b/crates/tests/src/tests/runner_prover_flow.rs index 8e7e312..87e4fea 100644 --- a/crates/tests/src/tests/runner_prover_flow.rs +++ b/crates/tests/src/tests/runner_prover_flow.rs @@ -1,4 +1,6 @@ use futures::{stream::FuturesUnordered, FutureExt, StreamExt}; +use libsecp256k1::{PublicKey, SecretKey}; +use rand::thread_rng; use sharp_p2p_prover::{ stone_prover::{ types::{ @@ -35,9 +37,13 @@ pub fn params() -> Params { #[tokio::test] async fn run_single_job() { + let mut rng = thread_rng(); let runner_fixture = runner_fixture(); - let runner = CairoRunner::new(runner_fixture.program_path); + let runner = CairoRunner::new( + runner_fixture.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let prover = StoneProver::new(config(), params()); runner @@ -51,10 +57,14 @@ async fn run_single_job() { #[tokio::test] async fn run_multiple_job() { + let mut rng = thread_rng(); let runner_fixture1 = runner_fixture(); let runner_fixture2 = runner_fixture(); - let runner = CairoRunner::new(runner_fixture1.program_path); + let runner = CairoRunner::new( + runner_fixture1.program_path, + PublicKey::from_secret_key(&SecretKey::random(&mut rng)), + ); let prover = StoneProver::new(config(), params()); let mut futures = FuturesUnordered::new(); diff --git a/install.py b/install.py index 485f661..3e6973d 100644 --- a/install.py +++ b/install.py @@ -1,5 +1,6 @@ import subprocess +from colorama import Fore, Style def log_and_run(commands, description, cwd=None): full_command = " && ".join(commands) diff --git a/run.py b/run.py new file mode 100644 index 0000000..9878503 --- /dev/null +++ b/run.py @@ -0,0 +1,16 @@ +from install import log_and_run + +if __name__ == "__main__": + log_and_run([ + "cairo-run \ + --program=bootloader.json \ + --layout=recursive_with_poseidon \ + --program_input=bootloader_input.json \ + --air_public_input=bootloader_public_input.json \ + --air_private_input=bootloader_private_input.json \ + --trace_file=bootloader.trace \ + --memory_file=bootloader.memory \ + --print_output \ + --proof_mode \ + --print_info" + ], "Running cairo1 pie in cairo0 bootloader", cwd=".") \ No newline at end of file