diff --git a/.github/workflows/committer_ci.yml b/.github/workflows/committer_ci.yml index 2517ba7e60..d82054465a 100644 --- a/.github/workflows/committer_ci.yml +++ b/.github/workflows/committer_ci.yml @@ -61,7 +61,7 @@ jobs: credentials_json: ${{ secrets.COMMITER_PRODUCTS_EXT_WRITER_JSON }} - uses: 'google-github-actions/setup-gcloud@v2' - run: echo "OLD_BENCH_INPUT_FILES_PREFIX=$(cat ./crates/committer_cli/src/tests/flow_test_files_prefix)" >> $GITHUB_ENV - - run: gcloud storage cp -r gs://committer-testing-artifacts/$OLD_BENCH_INPUT_FILES_PREFIX/* ./crates/committer_cli/benches + - run: gcloud storage cp -r gs://committer-testing-artifacts/$OLD_BENCH_INPUT_FILES_PREFIX/* ./crates/committer_cli/test_inputs # List the existing benchmarks. - run: | @@ -71,8 +71,8 @@ jobs: - run: cargo bench -p committer_cli # Backup the downloaded files to avoid re-downloading them if they didn't change (overwritten by checkout). - - run: mv ./crates/committer_cli/benches/tree_flow_inputs.json ./crates/committer_cli/benches/tree_flow_inputs.json_bu - - run: mv ./crates/committer_cli/benches/committer_flow_inputs.json ./crates/committer_cli/benches/committer_flow_inputs.json_bu + - run: mv ./crates/committer_cli/test_inputs/tree_flow_inputs.json ./crates/committer_cli/test_inputs/tree_flow_inputs.json_bu + - run: mv ./crates/committer_cli/test_inputs/committer_flow_inputs.json ./crates/committer_cli/test_inputs/committer_flow_inputs.json_bu # Checkout the new code. - uses: actions/checkout@v4 @@ -83,8 +83,8 @@ jobs: # Input files didn't change. - if: env.OLD_BENCH_INPUT_FILES_PREFIX == env.NEW_BENCH_INPUT_FILES_PREFIX run: | - mv ./crates/committer_cli/benches/tree_flow_inputs.json_bu ./crates/committer_cli/test_inputs/tree_flow_inputs.json - mv ./crates/committer_cli/benches/committer_flow_inputs.json_bu ./crates/committer_cli/test_inputs/committer_flow_inputs.json + mv ./crates/committer_cli/test_inputs/tree_flow_inputs.json_bu ./crates/committer_cli/test_inputs/tree_flow_inputs.json + mv ./crates/committer_cli/test_inputs/committer_flow_inputs.json_bu ./crates/committer_cli/test_inputs/committer_flow_inputs.json # Input files did change, download new inputs. - if: env.OLD_BENCH_INPUT_FILES_PREFIX != env.NEW_BENCH_INPUT_FILES_PREFIX diff --git a/crates/blockifier/src/execution/deprecated_entry_point_execution.rs b/crates/blockifier/src/execution/deprecated_entry_point_execution.rs index 878c2e276b..c5021fe5fb 100644 --- a/crates/blockifier/src/execution/deprecated_entry_point_execution.rs +++ b/crates/blockifier/src/execution/deprecated_entry_point_execution.rs @@ -1,3 +1,5 @@ +use std::collections::HashSet; + use cairo_vm::types::builtin_name::BuiltinName; use cairo_vm::types::layout_name::LayoutName; use cairo_vm::types::relocatable::{MaybeRelocatable, Relocatable}; @@ -29,6 +31,15 @@ pub struct VmExecutionContext<'a> { pub entry_point_pc: usize, } +pub const CAIRO0_BUILTINS_NAMES: [BuiltinName; 6] = [ + BuiltinName::range_check, + BuiltinName::pedersen, + BuiltinName::ecdsa, + BuiltinName::bitwise, + BuiltinName::ec_op, + BuiltinName::poseidon, +]; + /// Executes a specific call to a contract entry point and returns its output. pub fn execute_entry_point_call( call: CallEntryPoint, @@ -71,9 +82,19 @@ pub fn initialize_execution_context<'a>( resources: &'a mut ExecutionResources, context: &'a mut EntryPointExecutionContext, ) -> Result, PreExecutionError> { + // Verify use of cairo0 builtins only. + let program_builtins: HashSet<&BuiltinName> = + HashSet::from_iter(contract_class.program.iter_builtins()); + let unsupported_builtins = + &program_builtins - &HashSet::from_iter(CAIRO0_BUILTINS_NAMES.iter()); + if !unsupported_builtins.is_empty() { + return Err(PreExecutionError::UnsupportedCairo0Builtin( + unsupported_builtins.iter().map(|&item| *item).collect(), + )); + } + // Resolve initial PC from EP indicator. let entry_point_pc = resolve_entry_point_pc(call, &contract_class)?; - // Instantiate Cairo runner. let proof_mode = false; let trace_enabled = false; diff --git a/crates/blockifier/src/execution/errors.rs b/crates/blockifier/src/execution/errors.rs index 1fa6a1d5b2..cc0e87a753 100644 --- a/crates/blockifier/src/execution/errors.rs +++ b/crates/blockifier/src/execution/errors.rs @@ -1,3 +1,6 @@ +use std::collections::HashSet; + +use cairo_vm::types::builtin_name::BuiltinName; use cairo_vm::types::errors::math_errors::MathError; use cairo_vm::vm::errors::cairo_run_errors::CairoRunError; use cairo_vm::vm::errors::memory_errors::MemoryError; @@ -42,6 +45,8 @@ pub enum PreExecutionError { StateError(#[from] StateError), #[error("Requested contract address {:#064x} is not deployed.", .0.key())] UninitializedStorageAddress(ContractAddress), + #[error("Called builtins: {0:?} are unsupported in a Cairo0 contract")] + UnsupportedCairo0Builtin(HashSet), } impl From for PreExecutionError { diff --git a/crates/papyrus_monitoring_gateway/src/lib.rs b/crates/papyrus_monitoring_gateway/src/lib.rs index 823b2044f2..1f7e068c91 100644 --- a/crates/papyrus_monitoring_gateway/src/lib.rs +++ b/crates/papyrus_monitoring_gateway/src/lib.rs @@ -313,7 +313,7 @@ async fn node_config_by_secret( async fn metrics(prometheus_handle: Option) -> Response { match prometheus_handle { Some(handle) => { - Collector::default().prefix(PROCESS_METRICS_PREFIX).collect(); + Collector::new(PROCESS_METRICS_PREFIX).collect(); handle.render().into_response() } None => StatusCode::METHOD_NOT_ALLOWED.into_response(),