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 BatchRequest spam detection (Permissionless-related engine level spam detection) #4704

Merged
merged 33 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5f82eb9
load test WIP
gomisha Sep 12, 2023
16befb0
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Sep 20, 2023
db67457
godocs update
gomisha Sep 20, 2023
43a1c59
load test 1 implemented - 0 block IDs
gomisha Sep 20, 2023
ade2b0b
load test 2 - unknown blocks
gomisha Sep 20, 2023
8ad805a
lint fix
gomisha Sep 20, 2023
7a5b40d
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Sep 21, 2023
9b4f529
core implementation, load test
gomisha Sep 21, 2023
5296f6e
added remaining load tests
gomisha Sep 21, 2023
2a33007
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Oct 3, 2023
71aec44
validateBatchRequestForALSP() godoc update
gomisha Oct 3, 2023
6999004
godoc updates - validateRangeRequestForALSP, validateSyncRequestForALSP,
gomisha Oct 3, 2023
b9932df
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Oct 4, 2023
8728fc1
SpamDetectionConfig godoc update
gomisha Oct 4, 2023
52ad0aa
spamProbabilityMultiplier reduced to 1000
gomisha Oct 4, 2023
5cd7137
removed extra line from assignment, error handling
gomisha Oct 5, 2023
0ee522e
removed dropping message on misbehavior
gomisha Oct 5, 2023
eeec1a1
validateBatchRequestForALSP only returns error, logs load misbehaviors
gomisha Oct 5, 2023
ee502fd
validateBatchRequestForALSP godoc update
gomisha Oct 5, 2023
856e5b8
validateRangeRequestForALSP only returns error, logs load misbehaviors
gomisha Oct 5, 2023
c8d0d4a
godocs update
gomisha Oct 5, 2023
7829354
validateSyncRequestForALSP only returns error, logs misbehaviors
gomisha Oct 5, 2023
fc47924
godocs update
gomisha Oct 5, 2023
eff71d5
sync request test fix
gomisha Oct 5, 2023
7fa258b
throw irrecoverable error from process() for any ALSP validation error
gomisha Oct 5, 2023
a341f96
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Oct 6, 2023
d1bd216
validate*ResponseForALSP only return error
gomisha Oct 6, 2023
362ad7d
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Oct 7, 2023
cdfb39f
Merge branch 'misha/6812-alsp-sync-engine-batch-request-spam' of http…
gomisha Oct 7, 2023
5cc2f1c
log.Debug() for logging.KeyLoad
gomisha Oct 7, 2023
13b5713
delete line break between error return and error handling
gomisha Oct 7, 2023
7d2678f
Merge branch 'master' into misha/6812-alsp-sync-engine-batch-request-…
gomisha Oct 11, 2023
0d1fda2
golangci-lint version update (CI fix)
gomisha Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51
version: v1.54
args: -v --build-tags relic
working-directory: ${{ matrix.dir }}
# https://github.com/golangci/golangci-lint-action/issues/244
Expand Down
19 changes: 15 additions & 4 deletions engine/common/synchronization/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,30 @@ func WithScanInterval(interval time.Duration) OptionFunc {
}
}

// spamProbabilityMultiplier is used to convert probability factor to an integer as well as a maximum value - 1
// spamProbabilityMultiplier is used to convert probability factor to an integer as well as a maximum value for the
// random number that can be generated by the random number generator.
const spamProbabilityMultiplier = 1001
const spamProbabilityMultiplier = 1000

// SpamDetectionConfig contains configuration parameters for spam detection for different message types.
// The probability of creating a misbehavior report for a message of a given type is calculated differently for different
// message types.
// MisbehaviourReports are generated for two reasons:
// 1. A malformed message will always produce a MisbehaviourReport, to notify ALSP of *unambiguous* spam.
// 2. A correctly formed message may produce a MisbehaviourReport probabilistically, to notify ALSP of *ambiguous* spam.
// This effectively tracks the load associated with a particular sender, for this engine, and, on average,
// reports message load proportionally as misbehaviour to ALSP.
type SpamDetectionConfig struct {
jordanschalm marked this conversation as resolved.
Show resolved Hide resolved

// syncRequestProb is the probability of creating a misbehavior report for a SyncRequest message.
// batchRequestBaseProb is the base probability in [0,1] that's used in creating the final probability of creating a
// misbehavior report for a BatchRequest message. This is why the word "base" is used in the name of this field,
// since it's not the final probability and there are other factors that determine the final probability.
// The reason for this is that we want to increase the probability of creating a misbehavior report for a large batch.
batchRequestBaseProb float32

// syncRequestProb is the probability in [0,1] of creating a misbehavior report for a SyncRequest message.
syncRequestProb float32

// rangeRequestBaseProb is the base probability that's used in creating the final probability of creating a
// rangeRequestBaseProb is the base probability in [0,1] that's used in creating the final probability of creating a
// misbehavior report for a RangeRequest message. This is why the word "base" is used in the name of this field,
// since it's not the final probability and there are other factors that determine the final probability.
// The reason for this is that we want to increase the probability of creating a misbehavior report for a large range.
Expand Down
Loading
Loading