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

fix: consensus invalid block and version test improvement #2789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

singhhp1069
Copy link

@singhhp1069 singhhp1069 commented Sep 12, 2024

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

Copy link
Member

@thehowl thehowl left a 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>

Comment on lines +23 to +24
sort.Slice(vs, func(i, j int) bool {
return vs[i].Name < vs[j].Name
Copy link
Member

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.

Comment on lines +13 to +15
Name string
Version string
Optional bool
Copy link
Member

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.
Copy link
Member

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)
Copy link
Member

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" }},
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related
Projects
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

CONSENSUS FAILURE - fix error message
2 participants