Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(core/types):
Block
RLP overriding #133feat(core/types):
Block
RLP overriding #133Changes from 10 commits
b6241e3
756068e
843bf2f
5103121
dc35c47
9e3a464
7accc33
7948b43
04ead3c
1e49ad6
e5b3c5d
29901b5
927ac8b
59d6682
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
do we want to clone? Wondering given we don't really deep copy any other field
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.
Here's my thinking:
I've been bitten really hard in the past by bugs caused by a lack of it (queue 📣 🦀) so by default I tend to give my API users at least a choice or signal. Forcing them to have a pointer payload is only a subtle hint while the use of
pseudo.Type
really obscures things for someone who just wants to uselibevm
without knowing its internals.Not including it feels like setting a trap for a
libevm
consumer to walk straight into. WDYT?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.
Deep copy is great, especially by default.
But I am worrying a bit about performance, and wondering why most of these calls don't deep copy things. Changing them to deep copy the extra might result in a noticeable performance impact.
Ideally we should benchmark and measure all this, but.... first I'm lazy, second we're trying to get this done fast, third it looks like geth doesn't deep copy for performance? What do you think? 🤔
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 doesn't force a deep copy on the user as they're free to return the original. Any performance issues here, measured per block, are almost certainly dwarfed by those measured per storage R/W operation. As an example, I benchmarked the impact of a change from the
rlpgen
code forHeader.EncodeRLP()
to one usingrlp.Fields
(likely larger than a copy here) and it only adds 1.5μs (i.e. 1.5 millionths of a second) on my laptop.I think we're far more likely to shoot ourselves in the foot due to a missed copy than we are to take a meaningful performance hit, and we can always revisit performance while we aren't guaranteed the opportunity to revisit a catastrophic bug.