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: add validation to request / response interactions + adjust scoring appropiately #8641

Merged
merged 20 commits into from
Sep 20, 2024

Conversation

Maddiaa0
Copy link
Member

@Maddiaa0 Maddiaa0 commented Sep 19, 2024

Overview

Adds a request response validator to the request response module that will make sure the data
returned from the reqresp request is the data that has been requested.

In the Transaction case, this means verifying the proof to ensure that the first nullifier is actually correct.

We do not use the tx propagation validator as it performs more checks than required. If we are requesting a transaction, it is either during a sync, or for an performing attestation, where we do not care about being served old data. Just data that is what we asked for

fixes: #8483
fixes: #8485

Copy link
Member Author

Maddiaa0 commented Sep 19, 2024

Base automatically changed from md/peer-scoring-rate-limits to master September 19, 2024 15:30
@Maddiaa0 Maddiaa0 marked this pull request as ready for review September 19, 2024 19:53
return false;
}

if (!requestedTxHash.equals(responseTx.getTxHash())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be performing this check first? Should be a faster filter than verifying the proof right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, updating

@@ -209,5 +229,47 @@ describe('ReqResp', () => {

await stopNodes(nodes);
});

it('Should penalize peer if transaction validation fails', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice test

@Maddiaa0 Maddiaa0 enabled auto-merge (squash) September 20, 2024 17:52
@Maddiaa0 Maddiaa0 merged commit 8dfdebc into master Sep 20, 2024
47 checks passed
@Maddiaa0 Maddiaa0 deleted the md/tx-validation-in-req-resp branch September 20, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants