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

Remove order when constructing a SRS object #46

Open
bxue-l2 opened this issue Feb 18, 2025 · 8 comments
Open

Remove order when constructing a SRS object #46

bxue-l2 opened this issue Feb 18, 2025 · 8 comments

Comments

@bxue-l2
Copy link
Collaborator

bxue-l2 commented Feb 18, 2025

Order seems unneeded. If the file size is smaller than requested number of srs points, it would just fail.

pub order: u32,

@samlaf
Copy link
Contributor

samlaf commented Feb 20, 2025

Don't understand this issue so I might be totally out of context. But isn't the point of order that you might want to load LESS point than what the file as? Like my idea is we can always point to our 8GiB file for eg, but just download the subset of points that we need (say 16MiB).

@samlaf
Copy link
Contributor

samlaf commented Feb 21, 2025

EDIT after seeing your comment elsewhere. I totally missed that there's another parameter points_to_load

Image

Now I totally agree with you, feels weird that we have both. Is order even used? What is its purpose? Seems like we're storing it inside the SRS struct but we're not even using it? Can't we just force order == points_to_load always?

@bxue-l2
Copy link
Collaborator Author

bxue-l2 commented Feb 21, 2025

I don't think order is useful, probably just get rid of it

@anupsv
Copy link
Collaborator

anupsv commented Feb 28, 2025

EDIT after seeing your comment elsewhere. I totally missed that there's another parameter points_to_load

Image Now I totally agree with you, feels weird that we have both. Is `order` even used? What is its purpose? Seems like we're storing it inside the SRS struct but we're not even using it? Can't we just force `order == points_to_load` always?

So it's used in this check primarily https://github.com/Layr-Labs/rust-kzg-bn254/blob/master/prover/src/srs.rs#L32
We can make it into static value cause it doesn't really change. It was used in other places before but now all those are gone cause of the refactors. Right now only used to make sure that points to load doesn't exceed the order.

@anupsv
Copy link
Collaborator

anupsv commented Feb 28, 2025

I don't think order is useful, probably just get rid of it

I think we'll need to replace it with a check to make sure the points asked and size matters. This might involve disk ops which might be a problem for risczero VM's. Because i remember removing sysinfo cause of the problems compiling. Another option is we can store the max order for the file that we use.

Copy link
Contributor

samlaf commented Mar 1, 2025

Not following. order and points_to_load literally mean the same thing. If you're asking for a huge number of points_to_load and your system or vm environment can't handle it.. then you're just dumb and can change that parameter.

@anupsv
Copy link
Collaborator

anupsv commented Mar 2, 2025

Not following. order and points_to_load literally mean the same thing. If you're asking for a huge number of points_to_load and your system or vm environment can't handle it.. then you're just dumb and can change that parameter.

Yea right now considering the usage it looks the same but originally "order" had more meaning and uses if memory serves. It's not the VM not being able to handle, if someone requests more than what's available right now, with no check of file size it'll fail with a non clear error something on the lines of "data not available for buffer" or something similar. So the suggestion is we check the size of file so we can fail cleanly.

Or we change the failing of the file reading function to differentiate between other errors and file not containing data.

@samlaf
Copy link
Contributor

samlaf commented Mar 3, 2025

Or we change the failing of the file reading function to differentiate between other errors and file not containing data.

This is what makes the most sense to me. You request to read a number of points, and if you reach EOF while trying to read those points, you return an error.

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

No branches or pull requests

3 participants