-
Notifications
You must be signed in to change notification settings - Fork 185
dev: make Memory::get pub
#2039
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @enitrat, we prefer not to expose the get
function, as the signature is a bit too complex and the Cow
is there for legacy reasons.
Could you create a new function get_maybe_relocatable
with the following signature, that internally calls get
, and expose that one?
pub fn get_maybe_relocatable(&self, key: Relocatable)
-> Result<MaybeRelocatable, MemoryError>;
pub fn get_maybe_relocatable(&self, key: Relocatable) This is what I had done locally while waiting for this to get merged. Would you want me implement this in this PR? |
61513d5
to
3b4066c
Compare
3b4066c
to
70d85da
Compare
Hey @enitrat. Could you add some unit tests? The coverage workflow would probably fail if not. |
Not sure how to run them locally:
|
Try running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
7ba282c
* dev: make Memory::get `pub` * edit changelog * dev: expose get_maybe_relocatable instead * add comment on borrowed variant * add tests
* Remove duplicated `get_val` (#2065) * avoid installing gmp if it is already installed * revert part of the last commit * changelog * remove unwanted file * CI: Make cache keys depend on Cairo version (#2056) * Add Makefile and requirements.txt to cache key * Don't fetch cairo stwo exclusive programs * Remove empty file * Restrict caching Cairo programs Revert how the Rust workflow uses the Cairo program paths to calculate the cache keys. This change would imply the branch only adds Makefile and requirements.txt to the cache key computation. --------- Co-authored-by: gabrielbosio <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * dev: make Memory::get `pub` (#2039) * dev: make Memory::get `pub` * edit changelog * dev: expose get_maybe_relocatable instead * add comment on borrowed variant * add tests * feat(breaking): add support for hint accessible scopes (#2042) * feat: add support for hint accessible scopes update changelog * Update vm/src/hint_processor/hint_processor_definition.rs Co-authored-by: Julian Gonzalez Calderon <[email protected]> --------- Co-authored-by: Julian Gonzalez Calderon <[email protected]> * feat: add support for alias identifiers destination in program serde (#2071) * feat: add support for aliases destination in program serde * add changelog --------- Co-authored-by: Julián González Calderón <[email protected]> * fix: Add boundary tests for SecpSplitOutOfRange in secp_utils (#2062) * fix: Add boundary tests for SecpSplitOutOfRange in secp_utils * Update secp_utils.rs * Update CHANGELOG.md * Update secp_utils.rs * remove optimizations * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * empty commit to fix CI --------- Co-authored-by: Julian Gonzalez Calderon <[email protected]> * docs: add --run_from_cairo_pie documentation for Cairo 0 and Cairo 1 (#2077) * docs: add --run_from_cairo_pie flag usage documentation for Cairo 0 * docs: add --run_from_cairo_pie flag usage documentation for Cairo 1 * Update README.md Co-authored-by: Julian Gonzalez Calderon <[email protected]> * Update README.md * Update README.md * Update README.md Co-authored-by: Julian Gonzalez Calderon <[email protected]> * Update README.md Co-authored-by: Gabriel Bosio <[email protected]> * Update README.md Co-authored-by: Julian Gonzalez Calderon <[email protected]> --------- Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Gabriel Bosio <[email protected]> * Fix WRITE_DIVMOD_SEGMENT hint (#2078) * Minor fixes - use CAIRO_PRIME * Add error handling * Update CHANGELOG.md * Bump cairo-lang to 0.13.5 (#1959) * Update cairo-lang versin * Update changelog * Add new hints * Specify prime in new hints * Only apply mod floor if prime is not CAIRO_PRIME * Properly implement pack for a different prime * Fix pack in compute_doubling_slope * Add negative_points.cairo test * Add try_get_point_from_x for negative points * Add double_x test for negative points * Allow to many arguments * Add codecov to cairo-0-secp-hints feature * Prepare for Release v3.0.0-rc.1 (#2092) * Update version * Update lock * Update toolchain * Update changelog * Fix clippy * Update toolchain in CI * fix: correct cache keys for no-std test coverage in CI (#2093) * Update rust.yml * Update rust.yml * Update rust toolchain to 1.87.0 (#2100) * update rust toolchain to 1.87.0 * remove uneeded file * update rust in workflows * update changelog * clippy * clippy * remove unneeded clippy allow * fix Changelog link (#2104) * Improve memory_segments coverage (#2110) * Add tests for .gen_arg() and .write_arg() * Add test for .is_valid_memory_value() * Assert contents of memory segments --------- Co-authored-by: Franco Giachetta <[email protected]> Co-authored-by: Julian Gonzalez Calderon <[email protected]> Co-authored-by: Mathieu <[email protected]> Co-authored-by: VolodymyrBg <[email protected]> Co-authored-by: GarmashAlex <[email protected]> Co-authored-by: crStiv <[email protected]> Co-authored-by: DiegoC <[email protected]>
Make Memory::get
pub
Description
get
becomes public, as now thatmemory
itself is public, I want to be able to callget
and get a MaybeRelocatable, without going throughget_integer
orget_relocatable
.Checklist