-
Notifications
You must be signed in to change notification settings - Fork 4
feat(data): add partial vector data structure #731
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #731 +/- ##
==========================================
+ Coverage 91.26% 91.36% +0.09%
==========================================
Files 108 109 +1
Lines 20232 20419 +187
Branches 20232 20419 +187
==========================================
+ Hits 18465 18655 +190
+ Misses 1391 1388 -3
Partials 376 376 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
14d8bd4 to
8236cb6
Compare
|
Benchmark results for revision 4e72418:
Full results
Compare the results above with those for the default branch. |
8236cb6 to
520fbe7
Compare
520fbe7 to
98b80a5
Compare
2a3a5fb to
7baaedf
Compare
289c952 to
b4862dc
Compare
thomasathorne
left a comment
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 generally looks great, the PR was fun to review!
My one concern is that there is nothing keeping the tree balanced. So for example
#[test]
fn unbalanced_tree() {
let mut vec: PartialVec<u8> = PartialVec::undefined(0);
for i in 0..40000 {
vec.define(i * 2 + 1, vec![0]);
}
}
is enough to fail with a stack overflow.
That is obviously a long way from the intended use case, but 40,000 entries isn't that many. I'd argue we should either consider fixing this or be very careful not to use this in any situations where an adversary can choose the shape of the data.
emturner
left a comment
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.
overall makes sense, main comment is that I'd argue a significant number of edge cases seem to exist w.r.t. integer overflow that should be guarded against
b4862dc to
1a1b80f
Compare
2fc1dfa to
c3218ec
Compare
73c1728 to
f0a1325
Compare
f0a1325 to
194c58a
Compare
40k operations is definitely more than it is currently designed to handle. I'll have a look into how we can avoid the fragmentation a bit more. |
So the stack overflow comes from the destructor 😕 I think I found a way to flatten the structure such that those attacks aren't possible. There are some trade-offs, though. I will create a new PR to stack on this one for the improvement. |
|
I have created #747 to improve on the stack overflow issue that @thomasathorne has raised. |
59ef99a to
7eb2c38
Compare
thomasathorne
left a comment
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.
Happy to approve this now and look forward to the follow-up.
2660fee to
ab3616b
Compare
ab3616b to
6e252c0
Compare

Part of RV-861
What
Introduces a partial vector data structure that lets you define arbitrary parts of a large space (
0..=usize::MAX).Why
I found this data structure to be very useful in implementing the byte array state component (#732). It was also handy in making
DataSpacemore space efficient during proof generation (#736).How
I added lots of commentary within the data structure module. Please let me know what you think is missing.
Manually Testing
Tasks for the Author