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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
45557b0
validateSyncRequestForALSP() empty implementation
gomisha Aug 1, 2023
21130f8
empty validate*ForALSP() methods
gomisha Aug 2, 2023
ad83ebf
split TestOnSyncRequest() into 3 tests
gomisha Aug 12, 2023
6a9976d
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 12, 2023
046b6e0
rename TestOnSyncRequest_ tests for clarity
gomisha Aug 15, 2023
f5b3684
start load test WIP TestOnSyncRequest_HigherThanReceiver_OutsideToler…
gomisha Aug 15, 2023
5d9dfbe
initial loader
gomisha Aug 16, 2023
41ed223
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 16, 2023
34fd2e7
load test using full engine
gomisha Aug 16, 2023
0a486bb
test reporting SyncRequest misbehavior
gomisha Aug 16, 2023
92eb5ae
clean up
gomisha Aug 16, 2023
abfe232
potential spam misbehavior report
gomisha Aug 16, 2023
c625aba
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 17, 2023
3bab944
misbehavior report randomizer WIP
gomisha Aug 17, 2023
80c51b6
misbehavior report randomizer - initial implementation
gomisha Aug 17, 2023
045ae40
removed mini load tests
gomisha Aug 18, 2023
2addde9
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 18, 2023
7007422
load test WIP
gomisha Aug 18, 2023
7837dfb
lint fix - Randomizer returns error
gomisha Aug 18, 2023
b4b0849
load test implemented
gomisha Aug 18, 2023
c3fc495
probability factor WIP
gomisha Aug 18, 2023
188f55e
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 21, 2023
29e9889
Merge branch 'misha/6812-alsp-engine-spam-detection' of https://githu…
gomisha Aug 21, 2023
f217595
using synchronization.Alsp probability factor
gomisha Aug 21, 2023
33aa3f9
remove Randomizer interface
gomisha Aug 21, 2023
500d415
load test refactoring - WIP
gomisha Aug 22, 2023
82aa009
load test refactor, more generic for different loads
gomisha Aug 22, 2023
759570e
const probabilityFactorMultiplier
gomisha Aug 22, 2023
918c623
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 23, 2023
73ce6b6
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 23, 2023
3026377
rename to SpamReportConfig
gomisha Aug 24, 2023
80bc0cf
moved spam config to config.go
gomisha Aug 24, 2023
8b7341c
clean up
gomisha Aug 24, 2023
3e15e0a
load test for probability factor=1.0
gomisha Aug 24, 2023
dbb0db4
clean up
gomisha Aug 24, 2023
6e9dfb4
Merge branch 'master' into misha/6812-alsp-engine-spam-detection
gomisha Aug 28, 2023
9985772
clean up logging
gomisha Aug 28, 2023
1aa198a
add network security logging flag
gomisha Aug 28, 2023
2967f4a
removed potential-spam misbehavior type
gomisha Aug 28, 2023
bdb5899
renamed to SpamDetectionConfig; SpamDetectionConfig received by New()
gomisha Aug 28, 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
Prev Previous commit
Next Next commit
test reporting SyncRequest misbehavior
  • Loading branch information
gomisha committed Aug 16, 2023
commit 0a486bbe33a89afea9e098c3ce051c7351f2b62d
8 changes: 1 addition & 7 deletions engine/common/synchronization/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,9 @@ func (e *Engine) validateRangeRequestForALSP(id flow.Identifier, channel channel
}

func (e *Engine) validateSyncRequestForALSP(id flow.Identifier, channel channels.Channel, resource interface{}) (*alsp.MisbehaviorReport, bool) {
return nil, false
return nil, true
}

func (e *Engine) validateSyncResponseForALSP(id flow.Identifier, channel channels.Channel, resource interface{}) (*alsp.MisbehaviorReport, bool) {
return nil, false
}

func primeNumbers(foo int) {
for i := 0; i < foo; i++ {
fmt.Println(i)
}
}
19 changes: 9 additions & 10 deletions engine/common/synchronization/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ func (ss *SyncSuite) TestOnSyncRequest_LowerThanReceiver_WithinTolerance() {
ss.core.AssertExpectations(ss.T())
}

func BenchmarkPrimeNumbers(b *testing.B) {
foo := 5
for i := 0; i < b.N; i++ {
primeNumbers(foo)
}
}

// TestOnSyncRequest_HigherThanReceiver_OutsideTolerance tests that a sync request that's higher than the receiver's height doesn't
// trigger a response, even if outside tolerance.
func (ss *SyncSuite) TestOnSyncRequest_HigherThanReceiver_OutsideTolerance() {
Expand Down Expand Up @@ -249,11 +242,17 @@ func (ss *SyncSuite) TestOnSyncRequest_HigherThanReceiver_OutsideTolerance_Load(

// if request height is higher than local finalized, we should not respond
req.Height = ss.head.Height + 1
ss.core.On("HandleHeight", ss.head, req.Height)
ss.core.On("WithinTolerance", ss.head, req.Height).Return(false)

require.NoError(ss.T(), ss.e.Process(channels.SyncCommittee, originID, req))
// assert that misbehavior is reported
ss.con.On("ReportMisbehavior", mock.Anything).Return(true)

// assert that HandleHeight, WithinTolerance are not called because misbehavior is reported
// also, check that response is never sent
ss.core.AssertNotCalled(ss.T(), "HandleHeight")
ss.core.AssertNotCalled(ss.T(), "WithinTolerance")
ss.con.AssertNotCalled(ss.T(), "Unicast", mock.Anything, mock.Anything)

require.NoError(ss.T(), ss.e.Process(channels.SyncCommittee, originID, req))
}

ss.core.AssertExpectations(ss.T())
Expand Down