-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix absolute address of the end of hint input #628
Comments
How does one use rkyv with the usual rightwards growth, like Vec or "write" APIs? And what's the difference between left and right? I understand the difference between headers and footers in a streameable format, but I don't see how that applies here. |
Have a look at the linked code for two example that illustrate the difference. Please also follow the link to the rkyv docs that's in the code. |
That would be interesting to look up! But luckily it's irrelevant here.
Have a look at the linked code. Basically in rkyv:
Fortunately, we don't need to understand anything here. (But I encourage you to look into it, if you are curious.) Why do you bring up streamable formats? Everything we do is statically known up front. |
To make your life easier, let me copy and paste the relevant link from the docs in the code that I mentioned: https://rkyv.org/format.html
|
Ok sure that just means something else does the framing (e.g. Rust slice length). Just store the length or entry point in the first word then. Maybe the library actually has this feature already. That is when the data has to have a dynamic layout in the first place. |
The library does not store the length or 'entry point' at the start of the slice. What makes you think so? It's not that hard. No need to speculate. If you are curious, you can either have a look at the test code I linked or you can read the rkyv sources. (Or both.) I don't know what you mean by framing and why you think anyone would need that? (I have a guess about what you mean by that, but it seems to contradict what you say. So I'm confused.) |
To spell it out: Rust slices have all the information necessary to determine eg their end, start, midpoint, length etc. Rkyv's derserialisation expects to find a specific 'root' at a fixed offset from the end of the slice you pass it. It then re-assembles the whole DAG of your data structure from that root, by following pointers. If you have some rkyv serialised data in a slice of absolute memory addresses of Specifically in our case, we can fill the available hint input to always end at Does this make sense? (Everything here is a bit simplified.) |
This sounds like you have misinterpreted my last message which was admittedly compact, and assumed I didn’t know what I was talking about. I will try to expand some other time. |
Yes, that's sounds likely. Please expand, thanks. |
@naure Please expand when you have time. |
Somebody has explained that solution: #631 (comment) |
https://github.com/scroll-tech/ceno/blob/matthias/ceno_host/ceno_host/src/lib.rs
test_rkyv_padding
has some example code to show that we can left-pad rkyv serialised data without any problems, but right padding doesn't work, at least not naively.Thus we should fix the last byte of the input to always be in the same VM address, and make the start move further and further left, if we add more data.
See also #607 and #622
The text was updated successfully, but these errors were encountered: