Skip to content

Commit ada839d

Browse files
Fix_compilation_of_stwo_exclusive_programs_in_makefile
1 parent 7a97bed commit ada839d

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
cairo_bench_programs,
4747
cairo_proof_programs,
4848
cairo_test_programs,
49-
cairo_stwo_exclusive_programs,
5049
cairo_1_test_contracts,
5150
cairo_2_test_contracts,
5251
]
@@ -125,12 +124,6 @@ jobs:
125124
path: ${{ env.CAIRO_PROGRAMS_PATH }}
126125
key: cairo_test_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }}
127126
fail-on-cache-miss: true
128-
- name: Fetch cairo stwo exclusive programs
129-
uses: actions/cache/restore@v3
130-
with:
131-
path: ${{ env.CAIRO_PROGRAMS_PATH }}
132-
key: cairo_stwo_exclusive_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }}
133-
fail-on-cache-miss: true
134127
- name: Fetch proof programs
135128
uses: actions/cache/restore@v3
136129
with:
@@ -495,9 +488,6 @@ jobs:
495488
extra-args: '--cairo_pie_output {program}.rs.pie.zip'
496489
- program-target: cairo_stwo_exclusive_programs
497490
programs-dir: cairo_programs/stwo_exclusive_programs
498-
extra-args: '--cairo_pie_output {program}.rs.pie.zip'
499-
- program-target: cairo_programs/stwo_exclusive_programs
500-
programs-dir: cairo_stwo_exclusive_programs
501491
extra-args: '--proof_mode --air_public_input {program}.rs.air_public_input --air_private_input {program}.rs.air_private_input '
502492
name: Compute memory and execution traces with cairo-vm
503493
needs: [ build-programs, build-release ]

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ MOD_BUILTIN_TEST_PROOF_DIR=cairo_programs/mod_builtin_feature/proof
5353
MOD_BUILTIN_TEST_PROOF_FILES:=$(wildcard $(MOD_BUILTIN_TEST_PROOF_DIR)/*.cairo)
5454
COMPILED_MOD_BUILTIN_PROOF_TESTS:=$(patsubst $(MOD_BUILTIN_TEST_PROOF_DIR)/%.cairo, $(MOD_BUILTIN_TEST_PROOF_DIR)/%.json, $(MOD_BUILTIN_TEST_PROOF_FILES))
5555

56+
STWO_EXCLUSIVE_DIR=cairo_programs/stwo_exclusive_programs
57+
STWO_EXCLUSIVE_FILES:=$(wildcard $(STWO_EXCLUSIVE_DIR)/*.cairo)
58+
COMPILED_STWO_EXCLUSIVE_TESTS:=$(patsubst $(STWO_EXCLUSIVE_DIR)/%.cairo, $(STWO_EXCLUSIVE_DIR)/%.json, $(STWO_EXCLUSIVE_FILES))
59+
5660
$(TEST_PROOF_DIR)/%.json: $(TEST_PROOF_DIR)/%.cairo
5761
cairo-compile --cairo_path="$(TEST_PROOF_DIR):$(PROOF_BENCH_DIR)" $< --output $@ --proof_mode
5862

@@ -68,6 +72,9 @@ $(PROOF_BENCH_DIR)/%.json: $(PROOF_BENCH_DIR)/%.cairo
6872
$(MOD_BUILTIN_TEST_PROOF_DIR)/%.json: $(MOD_BUILTIN_TEST_PROOF_DIR)/%.cairo
6973
cairo-compile --cairo_path="$(MOD_BUILTIN_TEST_PROOF_DIR):$(MOD_BUILTIN_TEST_PROOF_DIR)" $< --output $@ --proof_mode
7074

75+
$(STWO_EXCLUSIVE_DIR)/%.json: $(STWO_EXCLUSIVE_DIR)/%.cairo
76+
cairo-compile --cairo_path="$(TEST_DIR):$(BENCH_DIR)" $< --output $@ --proof_mode
77+
7178
# ======================
7279
# Run without proof mode
7380
# ======================
@@ -82,10 +89,6 @@ CAIRO_RS_MEM:=$(patsubst $(TEST_DIR)/%.json, $(TEST_DIR)/%.rs.memory, $(COMPILED
8289
CAIRO_RS_TRACE:=$(patsubst $(TEST_DIR)/%.json, $(TEST_DIR)/%.rs.trace, $(COMPILED_TESTS))
8390
CAIRO_RS_PIE:=$(patsubst $(TEST_DIR)/%.json, $(TEST_DIR)/%.rs.pie.zip, $(COMPILED_TESTS))
8491

85-
STWO_EXCLUSIVE_DIR=cairo_programs/stwo_exclusive_programs
86-
STWO_EXCLUSIVE_FILES:=$(wildcard $(STWO_EXCLUSIVE_DIR)/*.cairo)
87-
COMPILED_STWO_EXCLUSIVE_TESTS:=$(patsubst $(STWO_EXCLUSIVE_DIR)/%.cairo, $(STWO_EXCLUSIVE_DIR)/%.json, $(STWO_EXCLUSIVE_FILES))
88-
8992
BENCH_DIR=cairo_programs/benchmarks
9093
BENCH_FILES:=$(wildcard $(BENCH_DIR)/*.cairo)
9194
COMPILED_BENCHES:=$(patsubst $(BENCH_DIR)/%.cairo, $(BENCH_DIR)/%.json, $(BENCH_FILES))
@@ -252,8 +255,7 @@ check:
252255
cargo check
253256

254257
cairo_test_programs: $(COMPILED_TESTS) $(COMPILED_BAD_TESTS) $(COMPILED_NORETROCOMPAT_TESTS) $(COMPILED_PRINT_TESTS) $(COMPILED_MOD_BUILTIN_TESTS) $(COMPILED_SECP_CAIRO0_HINTS) $(COMPILED_KZG_DA_CAIRO0_HINTS)
255-
cairo_proof_programs: $(COMPILED_PROOF_TESTS) $(COMPILED_MOD_BUILTIN_PROOF_TESTS)
256-
cairo_stwo_exclusive_programs: $(COMPILED_STWO_EXCLUSIVE_TESTS)
258+
cairo_proof_programs: $(COMPILED_PROOF_TESTS) $(COMPILED_MOD_BUILTIN_PROOF_TESTS) $(COMPILED_STWO_EXCLUSIVE_TESTS)
257259
cairo_bench_programs: $(COMPILED_BENCHES)
258260
cairo_1_test_contracts: $(CAIRO_1_COMPILED_CASM_CONTRACTS)
259261
cairo_2_test_contracts: $(CAIRO_2_COMPILED_CASM_CONTRACTS)

cairo_programs/stwo_exclusive_programs/blake2s_opcode_test.cairo

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ from starkware.cairo.common.cairo_builtins import BitwiseBuiltin
99
const COUNTER = 64;
1010
const U32_MASK = 0xffffffff;
1111

12-
// Tests the Blake2s and Blake2sLastBlock opcode runners using a preexisting implementation within the repo as reference.
12+
// Tests the Blake2s and Blake2sLastBlock opcode runners using a preexisting implementation within
13+
// the repo as reference.
1314
// The initial state, a random message of 64 bytes and a counter are used as input.
14-
// Both the opcode and the reference implementation are run on the same inputs and then their outputs are compared.
15-
// Before comparing the outputs, it is verified that the opcode runner has written the output to the correct location.
15+
// Both the opcode and the reference implementation are run on the same inputs and then their
16+
// outputs are compared.
17+
// Before comparing the outputs, it is verified that the opcode runner has written the output to the
18+
// correct location.
1619
func main{range_check_ptr, bitwise_ptr: BitwiseBuiltin*}() {
1720
run_blake_test(is_last_block=FALSE);
1821
run_blake_test(is_last_block=TRUE);

vm/src/tests/cairo_run_test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,14 @@ fn blake2s_opcode_test() {
576576
run_program_simple(program_data.as_slice());
577577
}
578578

579+
#[test]
580+
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
581+
fn blake2s_opcode_proof_mode_test() {
582+
let program_data =
583+
include_bytes!("../../../cairo_programs/stwo_exclusive_programs/blake2s_opcode_test.json");
584+
run_program(program_data.as_slice(), true, None, None, None);
585+
}
586+
579587
#[test]
580588
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
581589
fn relocate_segments() {

0 commit comments

Comments
 (0)