-
Notifications
You must be signed in to change notification settings - Fork 250
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
Keep cooked pubkeys in cache #3122
Conversation
Turning uncompressed pubkeys into cooked ones is fast, but unnecessary - this should avoid a little work for every signature validation we do by pre-loading them at startup.
Running block_sim shows a small improvement (a few %) - this is expected because block_sim doesn't really benchmark key loading in any significant way - nonetheless, no loadValid work is faster than fast loadValid work. |
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.
LGTM apart from the confusing name
pubkey*: UncompressedPubKey | ||
withdrawal_credentials*: Eth2Digest | ||
|
||
ImmutableValidatorData2* = object | ||
pubkey*: CookedPubKey | ||
withdrawal_credentials*: Eth2Digest |
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.
The types are hard to distinguish in actual code. Maybe rename ImmutableValidatorCookedData
?
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.
well, they follow one pattern (variable and type), this would simply be another, equally confusing name - ie either you focus on the cooked:ness, or the db:ness, don't see a clear advantage to either and this is the minimal patch
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'm sure that @zah has some advanced framework-based feature up his sleeve to deal with this that would resolve this 2-line problem with a multilayered abstract solution :)
Turning uncompressed pubkeys into cooked ones is fast, but unnecessary -
this should avoid a little work for every signature validation we do by
pre-loading them at startup.