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

1891 Gossipsub RPC validation inspector false positive E2E testing #4371

Merged
merged 40 commits into from
Jun 12, 2023

Conversation

kc1116
Copy link
Contributor

@kc1116 kc1116 commented May 19, 2023

This PR adds an E2E test that covers false positive validation errors in the gossipsub RPC control message validation inspector. This is crucial since the current implementation relies on certain assumptions about GossipSub. These assumptions are based on our analysis of the GossipSub code, but the GossipSub team does not guarantee that it will hold in the long term. This PR leverages the fact that an invalid control message notification is distributed by the rpc inspector notification distributor, under normal operations no invalid control message notifications are expected to be disseminated.

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Merging #4371 (67d0eef) into master (18b4de2) will increase coverage by 7.52%.
The diff coverage is n/a.

❗ Current head 67d0eef differs from pull request most recent head e07f51d. Consider uploading reports for the commit e07f51d to get more accurate results

@@            Coverage Diff             @@
##           master    #4371      +/-   ##
==========================================
+ Coverage   54.14%   61.66%   +7.52%     
==========================================
  Files         888      170     -718     
  Lines       83754    18985   -64769     
==========================================
- Hits        45348    11708   -33640     
+ Misses      34888     6364   -28524     
+ Partials     3518      913    -2605     
Flag Coverage Δ
unittests 61.66% <ø> (+7.52%) ⬆️

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

see 726 files with indirect coverage changes

@kc1116 kc1116 requested review from gomisha and removed request for peterargue May 19, 2023 13:54
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 left a comment

Choose a reason for hiding this comment

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

I like the general approach that the test is taking, though a few concerns need to be addressed. Appreciate your consideration; thanks!

@@ -102,7 +102,9 @@ func (b *BaseSuite) SetupSuite() {
func (b *BaseSuite) TearDownSuite() {
b.Net.Remove()
b.Cancel()
unittest.RequireCloseBefore(b.T(), b.OrchestratorNetwork.Done(), 1*time.Second, "could not stop orchestrator network on time")
if b.OrchestratorNetwork != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is needed because the BaseSuite is now being used by integration BFT tests outside BFTune, so not every BFT integration test will use an Orchestrator? Might be good to add a comment addressing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

suite.Run(t, new(GossipsubRPCInstpectorFalePostiveNotificationsTestSuite))
}

// TestGossipsubRPCInstpectorFalePostiveNotifications this test ensures that any underlying changes or updates to any of the underlying libp2p libraries
Copy link
Contributor

Choose a reason for hiding this comment

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

multiple typos in function name at start of comment (TestGossipsubRPCInstpectorFalePostiveNotifications should be TestGossipsubRPCInspectorFalsePositiveNotifications) along with actual function name that was already flagged in https://github.com/onflow/flow-go/pull/4371/files#r1210747930

Copy link
Contributor Author

Choose a reason for hiding this comment

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

kc1116 and others added 16 commits June 6, 2023 09:13
…est.go

Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
…thub.com:onflow/flow-go into khalil/1891-rpc-inspector-false-positive-testing
Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
…thub.com:onflow/flow-go into khalil/1891-rpc-inspector-false-positive-testing
Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
…thub.com:onflow/flow-go into khalil/1891-rpc-inspector-false-positive-testing
…est.go

Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
…est.go

Co-authored-by: Yahya Hassanzadeh <yhassanzadeh@ieee.org>
- wait for n number of finalized heights before checking metrics
…thub.com:onflow/flow-go into khalil/1891-rpc-inspector-false-positive-testing
@kc1116 kc1116 requested review from yhassanzadeh13 and gomisha June 6, 2023 21:53
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 left a comment

Choose a reason for hiding this comment

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

🚀 thanks for developing the test. Except for one correction that I pointed out, the rest looks great!

require.Eventually(s.T(), func() bool {
currStateComm := s.getCurrERFinalStateCommitment(ctx)
if startStateComm != currStateComm {
numOfStateCommChanges++
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 Jun 9, 2023

Choose a reason for hiding this comment

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

Suggested change
numOfStateCommChanges++
numOfStateCommChanges++
startStateComm = currStateComm

⚠️ Correction Needed: It's imperative to update the startStateComm whenever the current state commitment changes. This ensures we accurately evaluate the expected n times state changes. The existing method is problematic because it constantly compares the current state with the start state. Consequently, even a single state transition would pass this test, which is different from the intended behavior.

Additionally, as a suggestion for improving clarity, renaming startStateComm to prevStateComm would be more descriptive and appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

integration/tests/bft/gossipsub/rpc_inspector/suite.go Outdated Show resolved Hide resolved
integration/tests/bft/gossipsub/rpc_inspector/suite.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gomisha gomisha left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all my feedback.

kc1116 and others added 9 commits June 12, 2023 10:13
@kc1116 kc1116 merged commit 463ed82 into master Jun 12, 2023
@kc1116 kc1116 deleted the khalil/1891-rpc-inspector-false-positive-testing branch June 12, 2023 15:56
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