-
Notifications
You must be signed in to change notification settings - Fork 245
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
TxRequest into EIP-4844 without sidecar #1093
TxRequest into EIP-4844 without sidecar #1093
Conversation
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.
what's the usecase for this?
new 4844 txs are useless without the sidecar
I'm building this particular service, and would like to be able to construct an |
ah gotcha, valid. will check in a bit |
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 don't want to break the existing build_4844 function, so this feature should be a new function entirely
@@ -247,7 +247,51 @@ impl TransactionRequest { | |||
/// | |||
/// If required fields are missing. Use `complete_4844` to check if the | |||
/// request can be built. | |||
fn build_4844(mut self) -> TxEip4844WithSidecar { | |||
fn build_4844(self) -> TxEip4844Variant { |
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'd like to keep build_4844 -> TxEip4844WithSidecar
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.
Done, kept the same function name & footprint.
/// | ||
/// If required fields are missing. Use `complete_4844` to check if the | ||
/// request can be built. | ||
fn build_4844_without_sidecar(self) -> TxEip4844 { |
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 seems appropriate as an additional function
Hope I understood your intention correctly 🙂
|
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 usecase isn't for building a transaction that can be sent to the network but is for building a raw 4844 txs. I'd prefer having this as a separate call and only allow withsidecar when building the envelope
I'd also like to see a test for this.
// Either `sidecar` or `blob_versioned_hashes` must be set. | ||
if self.sidecar.is_none() && self.blob_versioned_hashes.is_none() { | ||
missing.push("sidecar"); | ||
missing.push("blob_versioned_hashes"); |
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 is a bit of a footgun, because this now also allows without sidecar which was not the original intention of this because this is supposed to be a transactionbuilder and 4844 without sidecar can't be sent.
I'd like to keep it that way but rather expose another transactionbuilder function explicitly for this usecase
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've reverted changes to the legacy, now it should be the same as before (instead of the panics).
I've left a TODO/question for you in the code, please let me know what you think.
Introduced a dedicated TryFrom
to handle the conversion I need.
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.
please undo changes that are not relevant to this feature, this changes a lot of existing functions that are unrelated.
this pr should only introduce new functionality not change existing ones
Hey @mattsse, can you please point out to what exactly are you referring to? I believe I only modified what I had to to get the required functionality. 🤔
I re-checked again, and I cannot see where I modified anything that wasn't needed. |
this changes none of this should be necessary to add a function that builds a raw 4844 tx object I'd like to start over here with a single function that does this because we're including this in the existing build_tx calls |
/// request can be built. | ||
fn build_4844(mut self) -> TxEip4844WithSidecar { | ||
self.populate_blob_hashes(); | ||
fn build_4844_without_sidecar(self) -> Result<TxEip4844, &'static str> { |
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 is the new function we need, everything elese is unrelated, should not be part of this pr
I don't want to add a function that builds a raw 4844 tx object, but a function that will provide best possible representation of And I don't want the call that builds it to panic - instead, I'd like it to return an error, hence the approach I took. |
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.
can we please split this feature into two things then
a) a function that builds a raw 4844 tx
b) and then we solve the conversion to typed transaction separately
Do you mean to create two separate PRs? However, I'm not sure what exactly the function that builds the raw 4844 tx would look like or how it would be used. To take a step back, I have to say that I appreciate your comments - you've been very responsive and that's not always the case with first-time PRs 😅. I'm very confused about what the actual high-level requirement is here though. I thought I understood you before - keep legacy behavior the same - which I respected. But I'm no longer sure I do 😅. Are you worried that my changes would break the legacy? I'm just trying to make the way forward clear, to save you review time & to ensure we keep the code quality high. |
sorry, I realize now I haven't fully understood the feature request at first and overlooked that the usecase here is to create a typedtransaction of which raw 4844 is one variant, hence I got confused about the other changes. I need to reevaluate in a bit, ty |
Yes, that's exactly what I need 🙂. Will await your reply, appreciate your time and effort! 🙇 |
Hey @mattsse, did you maybe have time to take another look? Would be great if we could get this finished by the end of week 🙏 |
okay, I looked at this again. I'd like to do your changes slightly differently we introduce build_488 without sidecar then we introduce another bonus points if we make the struct BuildTransactionErr {tx: Self, error: String} |
Thanks! I've modified the PR per your suggestions (and my understanding). One deviation is that I've kept the The new public |
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.
cool, thanks for the tests and docs
Thank you! 😄 |
Motivation
The
TransactionArguments
struct'sbuild_typed_tx
method will, in case of EIP-4844 transaction, always try to build aTypedTransaction
usingsidecar
.This isn't necessarily correct if
sidecar
isNone
butblob_versioned_hashes
are set toSome(...)
.In this case, it should be fine to build a transaction without sidecar.
This PR allows that to happen.
Solution
build_consensus_tx
forTransactionRequest
for conversion intoTypedTransaction
Result<...>
instead of panickingPR Checklist