Skip to content
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

eth: check blob transaction validity on the peer goroutine when received #31219

Merged

Conversation

jwasinger
Copy link
Contributor

@jwasinger jwasinger commented Feb 19, 2025

This ensures that if we receive a blob transaction where we cannot link the tx header to the sidecar commitments, we will drop the sending peer. This check is added in the protocol handler for the PooledTransactions message.

closes #31162

…tions, validate that the 'blob_versioned_hashes' in the tx header is produced from the commitments in the sidecar.
@jwasinger
Copy link
Contributor Author

jwasinger commented Feb 20, 2025

I'm working on test coverage for this in the form of tests in the devp2p eth test suite.

@jwasinger
Copy link
Contributor Author

Tests passing when run individually. However, running them both (or the entire eth suite) causes them both to fail...

…hem pass when run with other blob tx tests. temporarily disable another seemingly-unrelated test that when ran in conjunction with invalid sidecar tests causes the latter to fail.
@jwasinger
Copy link
Contributor Author

Tests pass when I omit LargeTxRequest from the suite. Otherwise, it causes the newly-introduced tests to fail. It's unclear what the interaction is that could cause this.

@jwasinger
Copy link
Contributor Author

So I think I've cracked the core of the failure, and it reveals a rather interesting error:

If we connect to a peer, the peer announces/transmits a bad blob tx, causing the client eth handler to return an error and disconnect the peer, the disconnect will not happen while the client is waiting waiting for the peer to read the client's already-pooled txs that it is trying to announce.

At least, it seems this is the case. I'm trying to figure out why.

… bad blob tx tests, when reading eth protocol messages, ensure that we read-and-ignore any pending messages that are unrelated to the message that the test is expecting to proceed.
@jwasinger jwasinger marked this pull request as ready for review February 27, 2025 21:58
@jwasinger
Copy link
Contributor Author

tbh, I'm actually not sure this is a comprehensive solution: the blobs/proofs could still be modified by a malicious tx-interceptor s.t. the checks introduced here pass, but the tx is ultimately failed to be added to the pool and the tx hash will not be considered for future re-request and inclusion...

I kind of wonder if there is any way at all to differentiate between sidecar-tampering-via-mitm and definitively invalid blob tx hash, given that the sender never signs over the full data... Perhaps the correct solution is: if validation of the sidecar commitment integrity wrt tx_header.blob_versioned_hashes or sidecar proof validation fails, don't remove the hash from trackers

I would be inclined to proceed with merging this, or at least merge the component of this that checks blob_tx.sidecar != nil in the handler, as that solves the related issue. But I want to ask someone with more knowledge on the cryptography side if my assumptions in the previous paragraph are correct.

@jwasinger
Copy link
Contributor Author

jwasinger commented Feb 28, 2025

Although... this PR involves changes to the public blob tx interface. So, perhaps makes sense to get verification of my assumption from someone else before proceeding:

If a blob tx header is validly-formed (number of commitment hashes in blob_versioned_hashes is in the range of the blob count that the chain is willing to accept at the time), we cannot definitively say that the given tx header cannot correspond to a correct blob transaction regardless of what we receive in the sidecar, as the sidecar contents are not signed over (only the hashes of the commitments).

@fjl fjl changed the title core/txpool,core/types,eth: when receiving blob txs via PooledTransactions, validate that the 'blob_versioned_hashes' in the tx header is produced from the commitments in the sidecar. eth: check blob transaction validity on the peer goroutine when received Mar 1, 2025
@fjl fjl merged commit d2bbde2 into ethereum:master Mar 1, 2025
3 of 4 checks passed
@fjl fjl added this to the 1.15.4 milestone Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Valid peers dropped due to blob tx validation failure from another peer
3 participants