-
Notifications
You must be signed in to change notification settings - Fork 2
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): Body
RLP codec hooks
#107
Conversation
…ereum#29514) Cherry-pick of `69f815f6f5791e0e48160bdad284773d0ffb1ba9`.
return &Body{ | ||
Transactions: b.transactions, | ||
Uncles: b.uncles, | ||
Withdrawals: b.withdrawals, | ||
} |
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.
note this change is compulsory since there are more fields present in the struct than these 3.
edebe13
to
e7193b7
Compare
e7193b7
to
7f6afca
Compare
|
||
// EncodeRLP implements the [rlp.Encoder] interface. | ||
func (b *Body) EncodeRLP(w io.Writer) error { | ||
return b.hooks().EncodeRLP(b, w) |
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.
Completely overriding RLP {en,de}coding is a blunt tool that we used for Header
only because of the complexity of the modifications to that type (with the view to hopefully changing it in the future). I think it's possible to achieve this for Body
without a hook, using just the rules of RLP optional
, but I need to tinker a bit to confirm.
My greatest concern with a complete override is that the user still has to implement a lot of the upstream functionality, reducing the benefit of libevm
.
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.
Progress on #109 suggests that this should be possible, with a hook that only needs to write fields to an rlp.EncoderBuffer
. I'll confirm tomorrow.
Body
RLP codec hooksBody
RLP codec hooks
18383c7
to
def07f8
Compare
Body
RLP codec hooksBody
RLP codec hooks
Closed in favor of #109 |
Why this should be merged
How this works
How this was tested
Body
libevm RLP codec hooks coreth#760