-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Implement Number64UintArray and tree_newTreeFromUint64Deltas #159
Conversation
d152d46
to
eb0734d
Compare
c1d4cd3
to
be27eae
Compare
Performance Report✔️ no performance regression detected Full benchmark results
|
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.
Looks really good! Just some minor comments
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.
🔥
9bed6a2
to
524d414
Compare
Add optional tree_* hash object methods to BasicType Remove FieldInfo.isNumber64Type Remove separate number64_* functions Rename applyDeltas methods
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.
I pushed a commit on top, let me know what you think. I'd like to add methods to serialize/deserialize from HashObject for all BasicType s eventually (Mainly will be applicable to BooleanType). Ideally, the HashObject path should be taken when eg: validators[i].slashed
is checked or set.
Here's a list of things changed:
- Add optional tree_* hash object methods to BasicType - this lets us check for the existence of the method instead of using FieldInfo.isNumber64Type, useful for the scenario above
- Remove FieldInfo.isNumber64Type
- Remove separate number64_* functions - we can always split these out if we use them in multiple places
- Rename applyDeltas methods - remove the word Uint64 from these methods
Thanks @wemeetagain for all of this 👍 |
Motivation
balances[i] = balances[i] + delta
we want a method to apply delta directly to an item inBasicArrayType
Description
Number64UintType
for 64 bit uint, this is better than `NumberUintType({byteLength: 8}) - performance test proved thatNumber64UintType
works on HashObject instead of bytes, use it inContainer
and newly createdNumber64ListType
tree_newTreeFromUint64Deltas
, this is for lodestarprocessRewardsAndPenalties
scenarioCloses #156
I applied this branch locally and got a better benchmark test result in lodestar (the result comes from different improvement, not only this PR)
Follow up work after this PR: