Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Documentation and Minor Code Corrections #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cairo1-run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Example:

## Libfunc `get_builtin_costs` & function `poseidon_hash_many`
Compiling without gas checks removes libfuncs associated with gas checks that are generated during compilation but it cannot remove those in the cairo code itself. Therefore code using the external functions on the `gas` corelib moudle (`withdraw_gas`, `withdraw_gas_all` & `get_builtin_costs`) will fail to compile.
One notable case of this issue is the `poseidon_hash_span` function, which uses `get_builtin_costs` in its implementation. We advise using the `HashStateTrait` impl instead. The `poseidon_hash_span` function can also be modified so that it no longer relies on gas, an example of this can be found on the test file `poseidon.cairo` under the `cairo_porgrams/cairo-1-programs` folder.
One notable case of this issue is the `poseidon_hash_span` function, which uses `get_builtin_costs` in its implementation. We advise using the `HashStateTrait` impl instead. The `poseidon_hash_span` function can also be modified so that it no longer relies on gas, an example of this can be found on the test file `poseidon.cairo` under the `cairo_programs/cairo-1-programs` folder.

## Nullable<Box<T>>
There is currently a bug in cairo 2.6.3 affecting `Nullable<Box<T>>` types.
Expand Down
2 changes: 1 addition & 1 deletion cairo_programs/fq.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace fq {
}

// Computes a * b^{-1} modulo p
// NOTE: The modular inverse of b modulo p is computed in a hint and verified outside the hind with a multiplicaiton
// NOTE: The modular inverse of b modulo p is computed in a hint and verified outside the hind with a multiplication
func div{range_check_ptr}(a: Uint256, b: Uint256, p: Uint256) -> Uint256 {
alloc_locals;
local b_inverse_mod_p: Uint256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn dict_write(
//Insert new value into tracker
tracker.insert_value(&key, &new_value);
//Insert previous value into dict_ptr.prev_value
//Addres for dict_ptr.prev_value should be dict_ptr* + 1 (defined above)
//Address for dict_ptr.prev_value should be dict_ptr* + 1 (defined above)
vm.insert_value(dict_ptr_prev_value, prev_value)?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion vm/src/vm/vm_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3850,7 +3850,7 @@ mod tests {
HashMap::new(),
))];

//Initialzie registers
//Initialize registers
run_context!(vm, 3, 2, 2);

//Create program and execution segments
Expand Down