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

[ALSP] Synchronization Engine SyncRequest spam detection (Permissionless-related engine level spam detection) #4590

Merged
merged 40 commits into from
Aug 31, 2023

Conversation

gomisha
Copy link
Contributor

@gomisha gomisha commented Aug 1, 2023

This PR adds ALSP spam level protection to the Synchronization Engine's SyncRequest message.

This is the first PR to implement ALSP misbehavior reporting at the engine level.

  • Creates a probabilistic way to report ALSP misbehavior, based on a probability factor from 0 to 1 (e.g. 0.5 factor means it will report the behavior as spam about 50% of the time)
  • Includes 2 load tests that test how many misbehavior reports are created based on different probability factors.
    • TestLoad_Process_SyncRequest_HigherThanReceiver_OutsideTolerance_SometimesReportSpam
    • TestLoad_Process_SyncRequest_HigherThanReceiver_OutsideTolerance_AlwaysReportSpam
  • wires up checking for spam for each type of message type handled by Process() - these are all currently no-ops except for SyncRequest
  • SyncRequest spam checking is hard coded to count a message as spam 1% of the time (i.e. approximately 1/100 messages); this will be updated in subsequent PRs to be configurable as a runtime flag when starting the engine

Future PRs will cover ALSP misbehavior reporting for other message types (e.g. RangeRequest, BatchRequest, SyncRequest, SyncResponse, BlockResponse)

ref: https://github.com/dapperlabs/flow-go/issues/6812

@gomisha gomisha self-assigned this Aug 1, 2023
@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2023

Codecov Report

Merging #4590 (bdb5899) into master (a8f28b9) will decrease coverage by 6.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4590      +/-   ##
==========================================
- Coverage   54.71%   48.72%   -6.00%     
==========================================
  Files         917      124     -793     
  Lines       85633    11534   -74099     
==========================================
- Hits        46858     5620   -41238     
+ Misses      35183     5589   -29594     
+ Partials     3592      325    -3267     
Flag Coverage Δ
unittests 48.72% <ø> (-6.00%) ⬇️

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

Files Changed Coverage Δ
utils/rand/rand.go 82.35% <ø> (ø)

... and 794 files with indirect coverage changes

@gomisha gomisha marked this pull request as ready for review August 24, 2023 16:36
@gomisha gomisha requested a review from kc1116 August 24, 2023 16:37
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Outdated Show resolved Hide resolved
engine/common/synchronization/engine.go Show resolved Hide resolved
engine/common/synchronization/engine.go Show resolved Hide resolved
network/alsp/misbehavior.go Outdated Show resolved Hide resolved
@gomisha gomisha changed the title [Application Layer Spam Prevention] Synchronization Engine SyncRequest spam detection (Permissionless-related engine level spam detection) [ALSP] Synchronization Engine SyncRequest spam detection (Permissionless-related engine level spam detection) Aug 28, 2023
@gomisha gomisha added this pull request to the merge queue Aug 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 30, 2023
@gomisha gomisha added this pull request to the merge queue Aug 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 30, 2023
@gomisha gomisha added this pull request to the merge queue Aug 31, 2023
Merged via the queue into master with commit f1f4022 Aug 31, 2023
@gomisha gomisha deleted the misha/6812-alsp-engine-spam-detection branch August 31, 2023 16:06
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.

4 participants