Skip to content

Current implementation is missing punishment on malicious peer #16807

Open
@0xMushow

Description

@0xMushow

Describe the feature

Only tracing is done but the TODO still need to be done because the current implementation is not punishing the malicious peer for sending unwanted hashes.

if verification_outcome == VerificationOutcome::ReportPeer {
// todo: report peer for sending hashes that weren't requested
trace!(target: "net::tx",
peer_id=format!("{peer_id:#}"),
unverified_len,
verified_payload_len=verified_payload.len(),
"received `PooledTransactions` response from peer with entries that didn't verify against request, filtered out transactions"
);
}

I think it could be good to proceed in a similar way as (with a boolean and reporting at the end of the function):

let tx = match tx.try_into_recovered() {
Ok(tx) => tx,
Err(badtx) => {
trace!(target: "net::tx",
peer_id=format!("{peer_id:#}"),
hash=%badtx.tx_hash(),
client_version=%peer.client_version,
"failed ecrecovery for transaction"
);
has_bad_transactions = true;
continue
}
};

if has_bad_transactions {
// peer sent us invalid transactions
self.report_peer_bad_transactions(peer_id)
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-networkingRelated to networking in generalC-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions