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

feat: report different request errors #3857

Merged
merged 4 commits into from
Jul 24, 2023
Merged

feat: report different request errors #3857

merged 4 commits into from
Jul 24, 2023

Conversation

altugbakan
Copy link
Contributor

Fixes #3855

This pull request handles different transaction response errors.

@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #3857 (98f07f2) into main (6c151d3) will increase coverage by 0.32%.
The diff coverage is 0.00%.

Impacted file tree graph

Impacted Files Coverage Δ
crates/net/network/src/transactions.rs 51.22% <0.00%> (-0.55%) ⬇️

... and 48 files with indirect coverage changes

Flag Coverage Δ
integration-tests 15.53% <0.00%> (+<0.01%) ⬆️
unit-tests 64.44% <0.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 26.44% <ø> (-0.04%) ⬇️
blockchain tree 83.01% <ø> (-0.02%) ⬇️
pipeline 89.66% <ø> (+0.06%) ⬆️
storage (db) 74.19% <ø> (-0.07%) ⬇️
trie 94.65% <ø> (ø)
txpool 46.56% <ø> (+0.57%) ⬆️
networking 77.65% <0.00%> (-0.01%) ⬇️
rpc 58.27% <ø> (+0.76%) ⬆️
consensus 64.33% <ø> (-0.96%) ⬇️
revm 33.68% <ø> (ø)
payload builder 6.61% <ø> (ø)
primitives 87.98% <ø> (-0.09%) ⬇️

@onbjerg onbjerg added C-enhancement New feature or request A-devp2p Related to the Ethereum P2P protocol labels Jul 24, 2023
@onbjerg onbjerg added the M-changelog This change should be included in the changelog label Jul 24, 2023
@@ -472,10 +475,27 @@ where
}
}

fn report_bad_message(&self, peer_id: PeerId) {
trace!(target: "net::tx", ?peer_id, "Penalizing peer for bad transaction");
fn report_bad_message(&self, peer_id: PeerId, req_err: Option<RequestError>) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can keep this and rename it to on_request_error and we need another function that accepts a ReputationChangeKind.
then this function here does not need an option anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey, just to make it clear, should I revert the changes on the report_bad_message and add a new function named on_request_error with the added functionality?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey, just to make it clear, should I revert the changes on the report_bad_message

something in between, revert most changes for this but rename to report_message(kind) and add a ReputationChangeKind the new on_request_error function then calls this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some changes regarding your comment, did I get it right?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

last nits

crates/net/network/src/transactions.rs Outdated Show resolved Hide resolved
crates/net/network/src/transactions.rs Outdated Show resolved Hide resolved
crates/net/network/src/transactions.rs Outdated Show resolved Hide resolved
@@ -492,7 +507,7 @@ where
fn on_bad_import(&mut self, hash: TxHash) {
if let Some(peers) = self.transactions_by_peers.remove(&hash) {
for peer_id in peers {
self.report_bad_message(peer_id);
self.on_request_error(peer_id, RequestError::BadResponse);
Copy link
Collaborator

Choose a reason for hiding this comment

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

last nit: we want to call the reputation kind function here, with BadTransactions

@mattsse mattsse enabled auto-merge July 24, 2023 19:11
@mattsse mattsse added this pull request to the merge queue Jul 24, 2023
Merged via the queue into paradigmxyz:main with commit 9b9ae82 Jul 24, 2023
merklefruit pushed a commit to anton-rs/op-reth that referenced this pull request Jul 27, 2023
@altugbakan altugbakan deleted the tx-error-report branch July 27, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devp2p Related to the Ethereum P2P protocol C-enhancement New feature or request M-changelog This change should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

report transaction response error accurately
3 participants