-
Notifications
You must be signed in to change notification settings - Fork 362
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
fix: consensus invalid block and version test improvement #2789
base: master
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 need a second review to finish reviewing the VersionSet code.
But in general, it's not necessary that these are joined together (they don't depend on one another); please put the version test improvements in another PR>
sort.Slice(vs, func(i, j int) bool { | ||
return vs[i].Name < vs[j].Name |
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.
if the two names are ==, this code should panic.
Name string | ||
Version string | ||
Optional bool |
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 remove the comments?
for _, pv := range pvs { | ||
pv := pv | ||
name2Pair[pv.Name] = &pvpair{&pv, nil} | ||
// CompatibleWith checks compatibility between two VersionSets. |
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.
Worse than before.
/* | ||
Invalid blocks don't pass | ||
*/ | ||
for _, tc := range testCases { | ||
block, _ := state.MakeBlock(height, makeTxs(height), lastCommit, proposerAddr) | ||
tc.malleateBlock(block) | ||
err := blockExec.ValidateBlock(state, block) | ||
require.Error(t, err, tc.name) | ||
|
||
require.Error(t, err, "%s", tc.name) |
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 change?
}{ | ||
{"BlockVersion wrong", func(block *types.Block) { block.Version += "-wrong" }}, |
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.
you did well to add expectedError
. what would you say about adding them also to all these previous tests?
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description