-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: integrate blobs into the payload builder #4305
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
... and 11 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
6f8acb2
to
98754b7
Compare
crates/payload/basic/src/lib.rs
Outdated
if chain_spec.is_cancun_activated_at_timestamp(attributes.timestamp) { | ||
// mark tx and all dependent txs as invalid because we can't process blob txs | ||
// until cancun is active | ||
best_txs.mark_invalid(&pool_tx); | ||
continue | ||
} |
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.
@mattsse do fork checks in the txpool make this redundant?
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.
yeah, they're only accepted when the timestamp has been reached, this also does not affect reorgs, so we can omit the check here.
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, removed
d792126
to
1fd3ad2
Compare
crates/payload/basic/src/lib.rs
Outdated
if chain_spec.is_cancun_activated_at_timestamp(attributes.timestamp) { | ||
// mark tx and all dependent txs as invalid because we can't process blob txs | ||
// until cancun is active | ||
best_txs.mark_invalid(&pool_tx); | ||
continue | ||
} |
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.
yeah, they're only accepted when the timestamp has been reached, this also does not affect reorgs, so we can omit the check here.
// TODO(rjected): we could improve this by wrapping envelope / payload types by version, so we can | ||
// have explicitly versioned return types for getPayload. Then BuiltPayload could essentially be a | ||
// builder for those types, and it would not be possible to e.g. return cancun fields for a | ||
// pre-cancun endpoint. |
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.
yes I like this
// TODO: either upstream a conversion or upstream QUANTITY serde impls | ||
let (commitments, proofs, blobs) = sidecars.into_iter().fold( | ||
(Vec::new(), Vec::new(), Vec::new()), | ||
|(mut commitments, mut proofs, mut blobs), sidecar| { | ||
commitments | ||
.extend(sidecar.commitments.iter().map(|sidecar| Bytes::from(sidecar.deref()))); | ||
proofs.extend(sidecar.proofs.iter().map(|proof| Bytes::from(proof.deref()))); | ||
blobs.extend(sidecar.blobs.iter().map(|blob| Bytes::from(blob.deref()))); | ||
(commitments, proofs, blobs) | ||
}, |
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.
yeah this is a bit bad because this effectively clones everything, right?
ideally there's a into_bytes or to_vec impl
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.
Ended up using the kzg types now that the serde traits are upstreamed
1fd3ad2
to
c0f74c1
Compare
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.
last two nits
crates/payload/basic/src/lib.rs
Outdated
@@ -679,6 +682,20 @@ where | |||
// convert tx to a signed transaction | |||
let tx = pool_tx.to_recovered_transaction(); | |||
|
|||
if let Transaction::Eip4844(blob_tx) = &tx.transaction { |
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.
nit, we now have as_eip4844
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.
right, that makes this cleaner
crates/payload/basic/src/lib.rs
Outdated
// only determine cancun fields when active | ||
if chain_spec.is_cancun_activated_at_timestamp(attributes.timestamp) { | ||
// grab the blob sidecars from the executed txs | ||
let blobs = pool.get_all_blobs(executed_txs.iter().map(|tx| tx.hash).collect())?; |
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 also includes non eip4844 transactions?
should filter before (is_eip4844), otherwise we wast blobstore lookups
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.
makes sense, added
9b3c9aa
to
f4704d0
Compare
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, pending conflict
This reverts commit c690fce.
f4704d0
to
9f4daa4
Compare
This prompts the payload builder to include EIP-4844 transactions if the fork is active, and fill in the required header fields if necessary.
ref #4205