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: implement kzg data availability hints #1887

Merged
merged 6 commits into from
Jan 2, 2025

Conversation

whichqua
Copy link
Contributor

@whichqua whichqua commented Dec 5, 2024

Context: port of the Starknet OS to Rust.

We need an implementation of the hints used by the Starknet OS in KZG commitments for data availability. This hint relies on private primitives in cairo-vm and must be implemented in this repository.

Related Issues

starkware-libs/cairo-lang#198

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

Context: port of the Starknet OS to Rust.

We need an implementation of the hints used by the Starknet OS in KZG commitments for data availability. This hint relies on private primitives in cairo-vm and must be implemented in this repository.
@whichqua whichqua changed the title feat: kzg data availability hints feat: implement kzg data availability hints Dec 5, 2024
);
let (q, r) = (a * b).div_mod_floor(&BLS_PRIME);
let q_reloc = get_relocatable_from_var_name("q", vm, ids_data, ap_tracking)?;
let res_reloc = get_relocatable_from_var_name("res", vm, ids_data, ap_tracking)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see in the hint, the var name should be "r" and not "res", right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part relates to this part of the hint:

segments.write_arg(ids.res.address_, split(r))"

I need to get the relocatable and write the following value:

    let res_arg: Vec<MaybeRelocatable> = bls_split(r)
        .into_iter()
        .map(|ref n| Felt252::from(n).into())
        .collect::<Vec<MaybeRelocatable>>();
        

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, but where does this res variable come from? Where is it declared?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FrancoGiachetta Any thoughts on merging this?

vm/src/hint_processor/builtin_hint_processor/kzg_da/mod.rs Outdated Show resolved Hide resolved
vm/src/hint_processor/builtin_hint_processor/kzg_da/mod.rs Outdated Show resolved Hide resolved
@whichqua
Copy link
Contributor Author

whichqua commented Jan 2, 2025

@FrancoGiachetta Any way we can get this merged?

@gabrielbosio gabrielbosio added this pull request to the merge queue Jan 2, 2025
Merged via the queue into lambdaclass:main with commit 052e7ce Jan 2, 2025
86 of 89 checks passed
@whichqua whichqua deleted the gm/feat/kzg-da-hint branch January 3, 2025 12:50
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.

3 participants