Skip to content

Commit

Permalink
chore: bump cairo compiler 2.7.0 (#130)
Browse files Browse the repository at this point in the history
* chore: bump cairo compiler to 2.7.0

* fix: add building Cairo compiler to compile target

* fix: update overflowing_sub from deprecated methods

* feat: add a clean compilation artifacts target

* refactor: move out of hints folder Cairo programs not using hints anymore

* refactor: use array_append to test Cairo program parsing
  • Loading branch information
zmalatrax authored Aug 7, 2024
1 parent f035f5c commit 6f89d74
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 30 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ $(COMPILED_CAIRO_FILES): %.json: %.sierra

compile-cairo-zero: $(COMPILED_CAIRO_0_FILES)
compile-cairo: $(COMPILED_CAIRO_FILES)
compile: compile-cairo-zero compile-cairo


compile: build-cairo compile-cairo-zero compile-cairo

run-all: $(VALID_COMPILED_CAIRO_0_FILES) $(COMPILED_CAIRO_FILES)
@failed_tests_ctr=0; \
Expand Down Expand Up @@ -156,4 +154,7 @@ clean-diff-test:
clean-bench:
@rm -rf /tmp/$(TMP_PREFIX)-bench*

clean-artifacts:
@find cairo_programs -type f \( -name "*.json" -o -name "*.sierra" \) -delete

clean-tmp: clean-diff-test clean-bench
2 changes: 1 addition & 1 deletion cairo
Submodule cairo updated 577 files
3 changes: 0 additions & 3 deletions cairo_programs/cairo/hints/u32_overflowing_sub_err.cairo

This file was deleted.

3 changes: 0 additions & 3 deletions cairo_programs/cairo/hints/u32_overflowing_sub_valid.cairo

This file was deleted.

File renamed without changes.
5 changes: 5 additions & 0 deletions cairo_programs/cairo/u32_overflowing_sub_err.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use core::num::traits::OverflowingSub;

fn main() -> (u32, bool) {
10_u32.overflowing_sub(12)
}
5 changes: 5 additions & 0 deletions cairo_programs/cairo/u32_overflowing_sub_valid.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use core::num::traits::OverflowingSub;

fn main() -> (u32, bool) {
12_u32.overflowing_sub(10)
}
25 changes: 5 additions & 20 deletions src/vm/program.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as fs from 'fs';

import { Felt } from 'primitives/felt';

import { OpType } from 'hints/hintParamsSchema';
import { Hint } from 'hints/hintSchema';
import { HintName } from 'hints/hintName';
import { Register } from './instruction';
Expand All @@ -27,10 +26,10 @@ describe('program', () => {
});
});

describe('parseCairo1Program', () => {
describe('parseCairoProgram', () => {
test('should correctly parse the program', () => {
const programContent = fs.readFileSync(
'cairo_programs/cairo/hints/test_less_than_true.json',
'cairo_programs/cairo/hints/array_append.json',
'utf8'
);
const programJson = JSON.parse(programContent);
Expand All @@ -39,24 +38,10 @@ describe('program', () => {
});

const hints = new Map<number, Hint[]>();
hints.set(5, [
hints.set(0, [
{
type: HintName.TestLessThan,
lhs: {
type: OpType.Deref,
cell: {
register: Register.Ap,
offset: 0,
},
},
rhs: {
type: OpType.Immediate,
value: new Felt(BigInt('0x100000000')),
},
dst: {
register: Register.Ap,
offset: -1,
},
type: HintName.AllocSegment,
dst: { register: Register.Ap, offset: 0 },
},
]);

Expand Down

0 comments on commit 6f89d74

Please sign in to comment.