-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into make-hints-code-public
- Loading branch information
Showing
14 changed files
with
805 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Release Process | ||
- [ ] Pull latest from `main` branch. | ||
`git checkout main && git pull origin main` | ||
- [ ] Determine release version string dependending on whether changes included | ||
in changelog are API breaking, it's a release candidate, etc. | ||
The release string should have the format "vX.Y.Z", with a possible | ||
trailing "-rcN" and follow [semantic versioning](https://semver.org/). | ||
- [ ] Checkout branch named `release-N` where N is the version string. | ||
`git checkout -b release-N` | ||
- [ ] Update the version field in the package entry of `Cargo.toml` files. | ||
- The versions must be the same. | ||
- There are 4 relevant `Cargo.toml` files in the repo: | ||
- `Cargo.toml`: update the version string. | ||
- `cairo-vm-cli/Cargo.toml`: update the version string and also the `cairo-vm` dependency version to match the above. | ||
- `felt/Cargo.toml`: update the version string. | ||
- `deps/parse-hyperlinks/Cargo.toml`: this vendored dependency needs its version bumped, but does not need to match the other crate versions. | ||
- [Here](https://github.com/lambdaclass/cairo-rs/pull/948/files) is an example pull request with these changes. | ||
- [ ] Run `cargo update` and `git add Cargo.lock` | ||
- [ ] Update `CHANGELOG.md`: | ||
- Verify that the changelog is up to date. | ||
- Add a title with the release version string just below the `Upcoming Changes` section. | ||
- [ ] Commit your changes, push your branch, and create a pull request. | ||
- [ ] Merge after CI and review passes. | ||
- [ ] Pull latest from `main` again. | ||
- [ ] Tag commit with version string and push tag. | ||
`git tag -a <version string> -m "Release..."` | ||
- [ ] Watch the `publish` workflow run in Github Actions. | ||
- [ ] Verify all the crates are available on crates.io with the correct versions. | ||
- [cairo-vm](https://crates.io/crates/cairo-vm) | ||
- [cairo-felt](https://crates.io/crates/cairo-felt) | ||
- [cairo-take-until-unbalanced](https://crates.io/crates/cairo-take_until_unbalanced) | ||
- [ ] Create a release in Github. | ||
- Select the recently created tag. | ||
- Set the title to the version string. | ||
- If it is a release candidate, mark it as a draft release. | ||
- [ ] Announce release through corresponding channels. | ||
|
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,88 @@ | ||
%builtins output range_check bitwise | ||
|
||
from starkware.cairo.common.cairo_keccak.keccak import ( | ||
_prepare_block, | ||
KECCAK_FULL_RATE_IN_BYTES, | ||
KECCAK_FULL_RATE_IN_WORDS, | ||
KECCAK_STATE_SIZE_FELTS, | ||
) | ||
from starkware.cairo.common.math import assert_nn_le | ||
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin | ||
from starkware.cairo.common.alloc import alloc | ||
from starkware.cairo.common.serialize import serialize_word | ||
|
||
func _keccak{range_check_ptr, bitwise_ptr: BitwiseBuiltin*, keccak_ptr: felt*}( | ||
inputs: felt*, n_bytes: felt, state: felt* | ||
) -> (output: felt*) { | ||
alloc_locals; | ||
if (nondet %{ ids.n_bytes >= ids.KECCAK_FULL_RATE_IN_BYTES %} != 0) { | ||
_prepare_block(inputs=inputs, n_bytes=KECCAK_FULL_RATE_IN_BYTES, state=state); | ||
_block_permutation(); | ||
|
||
return _keccak( | ||
inputs=inputs + KECCAK_FULL_RATE_IN_WORDS, | ||
n_bytes=n_bytes - KECCAK_FULL_RATE_IN_BYTES, | ||
state=keccak_ptr - KECCAK_STATE_SIZE_FELTS, | ||
); | ||
} | ||
|
||
assert_nn_le(n_bytes, KECCAK_FULL_RATE_IN_BYTES - 1); | ||
|
||
_prepare_block(inputs=inputs, n_bytes=n_bytes, state=state); | ||
_block_permutation(); | ||
|
||
return (output=keccak_ptr - KECCAK_STATE_SIZE_FELTS); | ||
} | ||
|
||
func _block_permutation{keccak_ptr: felt*}() { | ||
%{ | ||
from starkware.cairo.common.cairo_keccak.keccak_utils import keccak_func | ||
_keccak_state_size_felts = int(ids.KECCAK_STATE_SIZE_FELTS) | ||
assert 0 <= _keccak_state_size_felts < 100 | ||
|
||
output_values = keccak_func(memory.get_range( | ||
ids.keccak_ptr - _keccak_state_size_felts, _keccak_state_size_felts)) | ||
segments.write_arg(ids.keccak_ptr, output_values) | ||
%} | ||
let keccak_ptr = keccak_ptr + KECCAK_STATE_SIZE_FELTS; | ||
|
||
return (); | ||
} | ||
|
||
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.