-
Notifications
You must be signed in to change notification settings - Fork 201
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
Mx 15315 refactor sov runtype comp #6065
Mx 15315 refactor sov runtype comp #6065
Conversation
…r-sov-runtype-comp # Conflicts: # testscommon/components/components.go
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/refactor-runtype-components #6065 +/- ##
====================================================================
+ Coverage 78.11% 78.17% +0.05%
====================================================================
Files 874 874
Lines 103470 103512 +42
====================================================================
+ Hits 80828 80917 +89
+ Misses 17153 17106 -47
Partials 5489 5489 ☔ View full report in Codecov by Sentry. |
require.NotNil(t, managedRunTypeComponents.AdditionalStorageServiceCreator()) | ||
require.NotNil(t, managedRunTypeComponents.SCProcessorCreator()) | ||
require.NotNil(t, managedRunTypeComponents.SCResultsPreProcessorCreator()) | ||
require.NotEqual(t, consensus.ConsensusModelInvalid, managedRunTypeComponents.ConsensusModel()) |
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.
Can we check against the expected value (v1/v2)?
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.
ConsensusModelInvalid
is default
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.
There you check that the consensus model IS NOT invalid.
Therefore it should be v1/v2. Please check against the values accordingly
@@ -131,6 +133,24 @@ func (mrc *managedRunTypeComponents) CheckSubcomponents() error { | |||
if check.IfNil(mrc.scResultPreProcessorCreator) { | |||
return errors.ErrNilSCResultsPreProcessorCreator | |||
} | |||
if mrc.consensusModel == consensus.ConsensusModelInvalid { | |||
return errors.ErrInvalidConsensusModel |
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.
please add unit tests for the newly added checks.
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.
as discussed, I added a TODO
@@ -362,6 +382,30 @@ func (mrc *managedRunTypeComponents) AccountsCreator() state.AccountFactory { | |||
return mrc.runTypeComponents.accountsCreator | |||
} | |||
|
|||
// DataCodecHandler returns the data codec factory | |||
func (mrc *managedRunTypeComponents) DataCodecHandler() sovereign.DataDecoderHandler { |
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.
the name of the method and the return are different.
Could DataCodecHandler() be renamed to DataDecoderHandler()?
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.
renamed everywhere to DataCodec
and DataCodecHandler
because it does both decoding and encoding and the name was misleading
@@ -362,6 +382,30 @@ func (mrc *managedRunTypeComponents) AccountsCreator() state.AccountFactory { | |||
return mrc.runTypeComponents.accountsCreator | |||
} | |||
|
|||
// DataCodecHandler returns the data codec factory | |||
func (mrc *managedRunTypeComponents) DataCodecHandler() sovereign.DataDecoderHandler { | |||
mrc.mutStateComponents.RLock() |
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.
the mutex has is called with StateComponents. I think it was my bad naming. Please rename it to mutRunTypeComponents.
require.NotNil(t, managedRunTypeComponents.AdditionalStorageServiceCreator()) | ||
require.NotNil(t, managedRunTypeComponents.SCProcessorCreator()) | ||
require.NotNil(t, managedRunTypeComponents.SCResultsPreProcessorCreator()) | ||
require.NotEqual(t, consensus.ConsensusModelInvalid, managedRunTypeComponents.ConsensusModel()) |
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.
There you check that the consensus model IS NOT invalid.
Therefore it should be v1/v2. Please check against the values accordingly
@@ -85,11 +85,11 @@ func TestManagedRunTypeComponents_Create(t *testing.T) { | |||
require.NotNil(t, managedRunTypeComponents.AdditionalStorageServiceCreator()) | |||
require.NotNil(t, managedRunTypeComponents.SCProcessorCreator()) | |||
require.NotNil(t, managedRunTypeComponents.SCResultsPreProcessorCreator()) | |||
require.NotEqual(t, consensus.ConsensusModelInvalid, managedRunTypeComponents.ConsensusModel()) | |||
require.Equal(t, consensus.ConsensusModelV1, managedRunTypeComponents.ConsensusModel()) |
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.
Not necessarily in this PR, but we should have a similar unit test for sovereign run type comps
462bf36
into
feat/refactor-runtype-components
Reasoning behind the pull request
DataCodec
andTopicsChecker
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
?