Skip to content

Conversation

@fmoletta
Copy link
Contributor

@fmoletta fmoletta commented Oct 20, 2025

Motivation
Enable hive p2p tests TestBlobTxWithMismatchedSidecar & TestBlobTxWithoutSidecar
In order to pass these tests we have to:

  • Be able to decode pooled transactions without blobs (aka plain eip4844 transactions instead of a wrapped eip4844 with its blobsbundle)
  • Disconnect from peers that send transactions without blobs or blob bundles that don't match the versioned hashes

Description

  • Handle the case of plain Eip4844 transaction when RLP-decoding WrappedEip4844 transactions
  • Disconnect from peers that send empty/mismatched blobs

Closes #3745, part of #4941

@github-actions github-actions bot added the L1 Ethereum client label Oct 20, 2025
@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Lines of code report

Total lines added: 47
Total lines removed: 0
Total lines changed: 47

Detailed view
+--------------------------------------------------------+-------+------+
| File                                                   | Lines | Diff |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/types/blobs_bundle.rs             | 460   | +19  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/common/types/transaction.rs              | 2854  | +10  |
+--------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection/server.rs | 1037  | +18  |
+--------------------------------------------------------+-------+------+

@fmoletta fmoletta force-pushed the check-pooled-tx-blobs branch from 7085f7d to 4556943 Compare October 21, 2025 18:25
@fmoletta fmoletta marked this pull request as ready for review October 21, 2025 19:51
@fmoletta fmoletta requested a review from a team as a code owner October 21, 2025 19:51
@ethrex-project-sync ethrex-project-sync bot moved this to In Review in ethrex_l1 Oct 21, 2025
Copy link
Contributor

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +177 to 193
pub fn validate_blob_commitment_hashes(
&self,
blob_versioned_hashes: &[H256],
) -> Result<(), BlobsBundleError> {
if self.commitments.len() != blob_versioned_hashes.len() {
return Err(BlobsBundleError::BlobVersionedHashesError);
}
for (commitment, blob_versioned_hash) in
self.commitments.iter().zip(blob_versioned_hashes.iter())
{
if *blob_versioned_hash != kzg_commitment_to_versioned_hash(commitment) {
return Err(BlobsBundleError::BlobVersionedHashesError);
}
}
Ok(())
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another version maybe:

Suggested change
pub fn validate_blob_commitment_hashes(
&self,
blob_versioned_hashes: &[H256],
) -> Result<(), BlobsBundleError> {
if self.commitments.len() != blob_versioned_hashes.len() {
return Err(BlobsBundleError::BlobVersionedHashesError);
}
for (commitment, blob_versioned_hash) in
self.commitments.iter().zip(blob_versioned_hashes.iter())
{
if *blob_versioned_hash != kzg_commitment_to_versioned_hash(commitment) {
return Err(BlobsBundleError::BlobVersionedHashesError);
}
}
Ok(())
}
}
pub fn validate_blob_commitment_hashes(&self, hashes: &[H256]) -> Result<(), BlobsBundleError> {
if self.commitments.len() != hashes.len()
|| self
.commitments
.iter()
.zip(hashes.iter())
.any(|(commitment, hash)| *hash != kzg_commitment_to_versioned_hash(commitment))
{
Err(BlobsBundleError::BlobVersionedHashesError)
} else {
Ok(())
}
}
}

@fmoletta fmoletta enabled auto-merge November 6, 2025 19:29
@fmoletta fmoletta added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit 16b4297 Nov 6, 2025
39 checks passed
@fmoletta fmoletta deleted the check-pooled-tx-blobs branch November 6, 2025 20:10
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Nov 6, 2025
xqft pushed a commit that referenced this pull request Nov 11, 2025
**Motivation**
Enable hive p2p tests `TestBlobTxWithMismatchedSidecar ` &
`TestBlobTxWithoutSidecar`
In order to pass these tests we have to:
* Be able to decode pooled transactions without blobs (aka plain eip4844
transactions instead of a wrapped eip4844 with its blobsbundle)
* Disconnect from peers that send transactions without blobs or blob
bundles that don't match the versioned hashes
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Handle the case of plain `Eip4844` transaction when RLP-decoding
`WrappedEip4844` transactions
* Disconnect from peers that send empty/mismatched blobs
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #3745, part of #4941

---------

Co-authored-by: Martin Paulucci <martin.c.paulucci@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Disconnect peers whenever they send invalid blob transactions in PooledTransactions

4 participants