-
Notifications
You must be signed in to change notification settings - Fork 146
feat(statement-distribution): implement active leaves update signal #4767
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
base: feat/parachain
Are you sure you want to change the base?
Conversation
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.
I know it's out of the scop for this PR but still i am curious to know why do we have rx_ as prefix of this file name? by any chance if you know
| if len(disableValidatorsSet) > 0 { | ||
| disabled := make([]parachaintypes.ValidatorIndex, len(disableValidatorsSet)) | ||
| for d := range disableValidatorsSet { | ||
| disabled = append(disabled, d) | ||
| } | ||
|
|
||
| logger.Debugf("disabled validators detected: %v, "+ | ||
| "session index=%v, relay parent=%s", disabled, sessionIdx, rp.String()) | ||
| } |
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.
Do we really need this?
| for coreIdx, paras := range schedule { | ||
| groupIdx := groupRotationInfo.GroupForCore(coreIdx, uint(numCores)) | ||
|
|
||
| assignmentsPerGroup[groupIdx] = slices.Clone(paras) |
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.
We are not modifying the paras so i don't think we need to clone the it.
| assignmentsPerGroup[groupIdx] = slices.Clone(paras) | |
| assignmentsPerGroup[groupIdx] = paras |
| ParachainHostMinimumBackingVotes(). | ||
| Return(uint32(3), nil) | ||
|
|
||
| featuresBitVec, err := parachaintypes.NewBitVec([]bool{true, true, false, true}) |
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.
It's not a good practice to have a type in a variable name.
We can rename this to nodeFeatures or features.
| wg := sync.WaitGroup{} | ||
| wg.Add(1) | ||
| go func() { | ||
| defer wg.Done() | ||
| hypotheticalMsg := <-overseerCh | ||
| msg, ok := hypotheticalMsg.(prospectiveparachainsmessages.GetHypotheticalMembership) | ||
| require.True(t, ok) | ||
|
|
||
| // just return an empty slice | ||
| msg.Response <- []*prospectiveparachainsmessages.HypotheticalMembershipResponseItem{} | ||
| }() | ||
|
|
||
| // The actual sendPeerMessagesForRelayParent will run, but we can't assert its call directly. | ||
| // Instead, we just ensure no panic and no error. | ||
| err = sd.handleActiveLeavesUpdate(activatedLeaf) | ||
| require.NoError(t, err) | ||
| wg.Wait() |
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 you have used require.True inside the go routine, the test will not fail.
you can use mock overseer implementaion which we have implemented specifically to use in test. (I prefer this)
or handle the error/fail case properly.
| require.NoError(t, err) | ||
| wg.Wait() | ||
|
|
||
| // assertions |
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.
let's remove unnecessary comments
Changes
Statement DistributionsubsystemTests
go test -timeout 30s github.com/ChainSafe/gossamer/dot/parachain/statement-distribution -vIssues