-
Notifications
You must be signed in to change notification settings - Fork 204
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
Message validation optimization #6462
Message validation optimization #6462
Conversation
…essage_validation_optimization # Conflicts: # process/factory/interceptorscontainer/baseInterceptorsContainerFactory.go # process/factory/interceptorscontainer/metaInterceptorsContainerFactory.go # process/factory/interceptorscontainer/shardInterceptorsContainerFactory.go
epochStart/bootstrap/factory/epochStartInterceptorsContainerFactory.go
Outdated
Show resolved
Hide resolved
process/block/interceptedBlocks/interceptedMetaBlockHeader_test.go
Outdated
Show resolved
Hide resolved
process/factory/interceptorscontainer/baseInterceptorsContainerFactory.go
Outdated
Show resolved
Hide resolved
…essage_validation_optimization
integrationTests/factory/bootstrapComponents/bootstrapComponents_test.go
Outdated
Show resolved
Hide resolved
process/factory/interceptorscontainer/baseInterceptorsContainerFactory.go
Outdated
Show resolved
Hide resolved
node/nodeRunner.go
Outdated
@@ -321,7 +323,11 @@ func (nr *nodeRunner) executeOneComponentCreationCycle( | |||
} | |||
|
|||
log.Debug("creating bootstrap components") | |||
managedBootstrapComponents, err := nr.CreateManagedBootstrapComponents(managedStatusCoreComponents, managedCoreComponents, managedCryptoComponents, managedNetworkComponents) | |||
interceptedDataVerifierFactory := factory.NewInterceptedDataVerifierFactory(factory.InterceptedDataVerifierFactoryArgs{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not create it inside process components where it is being used?
the general config is already provided, no changes needed on nodeRunner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not moved
Co-authored-by: Sorin Stanculeanu <[email protected]>
epochStart/bootstrap/process_test.go
Outdated
epochStartProvider.interceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &processMock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
epochStartProvider.interceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &processMock.InterceptedDataVerifierMock{}, nil | |
}} | |
epochStartProvider.interceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
args.InterceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &processMock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &processMock.InterceptedDataVerifierMock{}, nil | |
}} | |
args.InterceptedDataVerifierFactory = &processMock.InterceptedDataVerifierFactoryMock{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -62,13 +65,17 @@ func NewEpochStartMetaSyncer(args ArgsNewEpochStartMetaSyncer) (*epochStartMetaS | |||
if check.IfNil(args.MetaBlockProcessor) { | |||
return nil, epochStart.ErrNilMetablockProcessor | |||
} | |||
if check.IfNil(args.InterceptedDataVerifierFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing test for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
args.InterceptedDataVerifierFactory = &processMocks.InterceptedDataVerifierFactoryMock{ | ||
CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &processMocks.InterceptedDataVerifierMock{}, nil | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &processMocks.InterceptedDataVerifierFactoryMock{ | |
CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &processMocks.InterceptedDataVerifierMock{}, nil | |
}, | |
} | |
args.InterceptedDataVerifierFactory = &processMocks.InterceptedDataVerifierFactoryMock{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
node/nodeRunner.go
Outdated
@@ -321,7 +323,11 @@ func (nr *nodeRunner) executeOneComponentCreationCycle( | |||
} | |||
|
|||
log.Debug("creating bootstrap components") | |||
managedBootstrapComponents, err := nr.CreateManagedBootstrapComponents(managedStatusCoreComponents, managedCoreComponents, managedCryptoComponents, managedNetworkComponents) | |||
interceptedDataVerifierFactory := factory.NewInterceptedDataVerifierFactory(factory.InterceptedDataVerifierFactoryArgs{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not moved
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | ||
return &mock.InterceptedDataVerifierMock{}, nil | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.InterceptedDataVerifierFactory = &mock.InterceptedDataVerifierFactoryMock{CreateCalled: func(topic string) (process.InterceptedDataVerifier, error) { | |
return &mock.InterceptedDataVerifierMock{}, nil | |
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
@@ -79,6 +81,9 @@ func NewShardInterceptorsContainerFactory( | |||
if check.IfNil(args.PeerSignatureHandler) { | |||
return nil, process.ErrNilPeerSignatureHandler | |||
} | |||
if check.IfNil(args.InterceptedDataVerifierFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -80,6 +81,9 @@ func NewMetaInterceptorsContainerFactory( | |||
if check.IfNil(args.PeerSignatureHandler) { | |||
return nil, process.ErrNilPeerSignatureHandler | |||
} | |||
if check.IfNil(args.InterceptedDataVerifierFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
… into message_validation_optimization
… into message_validation_optimization
ValidInterceptedData interceptedDataStatus = iota | ||
InvalidInterceptedData | ||
validInterceptedData interceptedDataStatus = iota | ||
invalidInterceptedData | ||
|
||
interceptedDataStatusBytesSize = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move the last const outside to have clearer the "enum" values for the status
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?