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

feat: improve rust bindings compat #395

Merged
merged 4 commits into from
Jan 13, 2025
Merged

feat: improve rust bindings compat #395

merged 4 commits into from
Jan 13, 2025

Conversation

enitrat
Copy link
Collaborator

@enitrat enitrat commented Jan 10, 2025

improve rust bindings compat, enabling syntaxes like

  • segments.memory.get(idx)
    or
  • dict_trackers[idx] = X

based on a custom fork of the cairo vm in which I unbotherly created a special DictKey type which is an
enum

#[derive(
    Eq, Ord, Hash, PartialEq, PartialOrd, Clone, Debug,
)]
pub enum DictKey {
    Simple(MaybeRelocatable),
    Compound(Vec<MaybeRelocatable>),
}

Which allows a Vec of Felts / Relocatable to be used as dict keys. For us this is important because we need to track preimages that might not fit in a felt inside the dict tracker.

This was implemented in a "dumb" way that is unconsidering of external side effects to the Cairo-VM - once synced with LC we will want to revisit the approach. see https://github.com/kkrt-labs/cairo-vm/tree/kkrt-compat

@enitrat enitrat marked this pull request as ready for review January 10, 2025 18:45
@enitrat enitrat changed the title feat: rust-api compat feat: improve rust-api compat Jan 10, 2025
@enitrat enitrat changed the title feat: improve rust-api compat feat: improve rust bindings compat Jan 10, 2025
@enitrat enitrat requested a review from ClementWalter January 10, 2025 18:48
@enitrat enitrat merged commit 2802ec7 into main Jan 13, 2025
4 checks passed
@enitrat enitrat deleted the feat/rust-api branch January 13, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants