-
Notifications
You must be signed in to change notification settings - Fork 160
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
feat: implement kzg data availability hints #1887
Conversation
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.
); | ||
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)?; |
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.
From what I can see in the hint, the var name should be "r" and not "res", right?
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.
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>>();
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.
Oh I see, but where does this res
variable come from? Where is it declared?
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.
Its declared just before the hint is invoked:
https://github.com/starkware-libs/cairo-lang/blob/8e11b8cc65ae1d0959328b1b4a40b92df8b58595/src/starkware/starknet/core/os/data_availability/bls_field.cairo#L42
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.
@FrancoGiachetta Any thoughts on merging this?
@FrancoGiachetta Any way we can get this merged? |
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