-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimizations, improvements, fix bugs and additional builtins (#514)
* optimization * fix std path in build * some small opt * additional optimizations * remove import * remove import * small opt * tmp chang * tmp opt * tmp opt * tmp * perf opt * bench rm proof * fix mrg * small opt * fixed integration tests * small opt * rm ref * improved opt + other benchmarks * small tests * wrked benchmarks * rm unecesary test.json * opts * sm imp * some opt * upd to last version of zig * optimisations of memory cell * Update build.zig fix build * small opt in usort * tst * last optimisation * test compare output rm json from repo * git ignore compiled programs * update version of rust cairo-vm * clear makefile and add requirements.txt * upgrade zig cli and update compability * integration test through make * test * rm clean * test * update * test * test ci * bump starknet lib * some opt * fix tests * fix test, commit hard tests to late * comment test * ci fix * ci * fix integration test & ci test * test ci * test ci * fix test + make check * fix * fix ci * nondet builtin * change ci * compile cairo programs in another script * fix secp * update cairo programs and fix ci * build rm profile * fix hash * fix max_path_bytes deprecated, make dep on commit link * fix ci
- Loading branch information
1 parent
793e199
commit 6287655
Showing
407 changed files
with
15,858 additions
and
2,584,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,15 @@ | |
CAIRO_VM_CLI:=cairo-vm/target/release/cairo-vm-cli | ||
|
||
$(CAIRO_VM_CLI): | ||
git clone --depth 1 -b v0.9.1 https://github.com/lambdaclass/cairo-vm | ||
git clone --depth 1 https://github.com/lambdaclass/cairo-vm | ||
cd cairo-vm; cargo b --release --bin cairo-vm-cli | ||
|
||
build_cairo_vm_cli: | $(CAIRO_VM_CLI) | ||
BENCH_DIR=cairo_programs/benchmarks | ||
|
||
|
||
check: | ||
|
||
# Creates a pyenv and installs cairo-lang | ||
deps: | ||
pyenv install -s 3.9.15 | ||
|
@@ -19,6 +22,7 @@ deps: | |
# Creates a pyenv and installs cairo-lang | ||
deps-macos: | ||
brew install gmp pyenv | ||
brew install [email protected] | ||
pyenv install -s 3.9.15 | ||
PYENV_VERSION=3.9.15 /opt/homebrew/bin/python3.9 -m venv cairo-vm-env | ||
. cairo-vm-env/bin/activate ; \ | ||
|
@@ -36,32 +40,22 @@ test: | |
test-filter: | ||
@zig build test --summary all -Dtest-filter="$(FILTER)" | ||
|
||
build-integration-test: | ||
@zig build integration_test | ||
|
||
run-integration-test: | ||
@zig build integration_test | ||
./zig-out/bin/integration_test | ||
@zig build -Doptimize=ReleaseFast integration_test | ||
|
||
run-integration-test-filter: | ||
@zig build integration_test | ||
./zig-out/bin/integration_test $(FILTER) | ||
|
||
build-and-run-pedersen-table-gen: | ||
@zig build pedersen_table_gen | ||
> ./src/math/crypto/pedersen/gen/constants.zig | ||
./zig-out/bin/pedersen_table_gen | ||
@zig fmt ./src/math/crypto/pedersen/gen/constants.zig | ||
|
||
build-and-run-poseidon-consts-gen: | ||
@zig build poseidon_consts_gen | ||
> ./src/math/crypto/poseidon/gen/constants.zig | ||
./zig-out/bin/poseidon_consts_gen | ||
@zig fmt ./src/math/crypto/poseidon/gen/constants.zig | ||
|
||
build-compare-benchmarks: build_cairo_vm_cli build | ||
@zig build -Doptimize=ReleaseFast integration_test $(FILTER) | ||
|
||
build-compare-benchmarks: build_cairo_vm_cli build-optimize | ||
cd scripts; sh benchmarks.sh | ||
|
||
|
||
compile-cairo-programs: | ||
cd scripts; sh build_cairo_programs.sh | ||
|
||
build-compare-output: build_cairo_vm_cli build-optimize | ||
cd scripts; sh test_compare_output.sh | ||
|
||
clean: | ||
@rm -rf zig-cache | ||
@rm -rf ./zig-cache | ||
@rm -rf zig-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
%builtins output range_check bitwise | ||
|
||
from starkware.cairo.common.cairo_keccak.keccak import _keccak | ||
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin | ||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.serialize import serialize_word | ||
|
||
func fill_array(array: felt*, base: felt, array_length: felt, iterator: felt) { | ||
if (iterator == array_length) { | ||
return (); | ||
} | ||
|
||
assert array[iterator] = base; | ||
|
||
return fill_array(array, base, array_length, iterator + 1); | ||
} | ||
|
||
func main{output_ptr: felt*, range_check_ptr, bitwise_ptr: BitwiseBuiltin*}() { | ||
alloc_locals; | ||
|
||
let (output: felt*) = alloc(); | ||
let keccak_output = output; | ||
|
||
let (inputs: felt*) = alloc(); | ||
let inputs_start = inputs; | ||
fill_array(inputs, 9, 3, 0); | ||
|
||
let (state: felt*) = alloc(); | ||
let state_start = state; | ||
fill_array(state, 5, 25, 0); | ||
|
||
let n_bytes = 24; | ||
|
||
let (res: felt*) = _keccak{keccak_ptr=keccak_output}( | ||
inputs=inputs_start, n_bytes=n_bytes, state=state_start | ||
); | ||
|
||
serialize_word(res[0]); | ||
serialize_word(res[1]); | ||
serialize_word(res[2]); | ||
serialize_word(res[4]); | ||
|
||
return (); | ||
} |
Oops, something went wrong.