-
Notifications
You must be signed in to change notification settings - Fork 8
perf(payload): Avoid redundant encoding of bundle transactions #41
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>
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.
Thank you for the contribution, LGTM!
Can you fix CI, #39 changed bundle is_optional and is_allowed_to_fail to take &BundleHash
Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>
Thank you and Done! |
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.
closes #40
fn executables<'a>( | ||
&'a self, | ||
) -> Box< | ||
dyn Iterator<Item = WithEncoded<&'a Recovered<types::Transaction<P>>>> + 'a, | ||
> { |
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.
maybe you can even use impl Iterator here
but unsure if this trait should be object safe
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 think impl Iterator is good.
To keep Bundle object safe, we can consider moving it in a BundleExt in payload::ext
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.
Hi, I tried the impl Iterator and BundleExt suggestions, but hit a compiler error due to different iterator types between the optimised and fallback paths.
I switched to using a GAT on the Bundle trait instead. Let me know what you think of this approach.
/// By default, this wraps the plain `Recovered` transactions. Implementors | ||
/// that store pre-encoded bytes can override this to provide the more | ||
/// efficient `WithEncoded` wrapper. | ||
fn executables<'a>( |
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.
As this could be slightly confusing with the concept of Executable
in the payload API, we could rename this function to something like fn transactions_encoded
instead
fn executables<'a>( | ||
&'a self, | ||
) -> Box< | ||
dyn Iterator<Item = WithEncoded<&'a Recovered<types::Transaction<P>>>> + 'a, | ||
> { |
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 think impl Iterator is good.
To keep Bundle object safe, we can consider moving it in a BundleExt in payload::ext
Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>
Leverages pre-encoded bytes from FlashbotsBundle to skip redundant transaction encoding. This improves performance, especially for the OP-Stack.