Skip to content

enforce <1/3 validator updates#1004

Merged
ebuchman merged 5 commits intodevelopfrom
950-enforce-less-13-val-changes-per-block
Dec 27, 2017
Merged

enforce <1/3 validator updates#1004
ebuchman merged 5 commits intodevelopfrom
950-enforce-less-13-val-changes-per-block

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Dec 25, 2017

Refs #950

@melekes melekes requested a review from ebuchman as a code owner December 25, 2017 18:11
@ebuchman
Copy link
Contributor

Good start, but we need to check < 1/3 with respect to voting power, not just number of validators.

Also, the change in voting power must be strictly less than 1/3, not <= 1/3

@melekes
Copy link
Contributor Author

melekes commented Dec 25, 2017

So, the algo should look more like:

if (>= 1/3 of vals changed) OR newVP/oldVP * 100 >= 33 {
  error
}

?

@ebuchman
Copy link
Contributor

We don't even have to check the number of validators, just the voting power.

Basically we should sum the voting power changes and if thats >=1/3 of the current total, then error.

@codecov-io
Copy link

codecov-io commented Dec 25, 2017

Codecov Report

Merging #1004 into develop will decrease coverage by 0.3%.
The diff coverage is 62.5%.

@@             Coverage Diff             @@
##           develop    #1004      +/-   ##
===========================================
- Coverage    59.95%   59.65%   -0.31%     
===========================================
  Files          109      109              
  Lines        10197    10225      +28     
===========================================
- Hits          6114     6100      -14     
- Misses        3523     3556      +33     
- Partials       560      569       +9

@melekes melekes force-pushed the 950-enforce-less-13-val-changes-per-block branch from 29d5cf0 to 0093f98 Compare December 25, 2017 23:49
Copy link
Contributor

@ebuchman ebuchman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. But should have more tests

assert := assert.New(t)

// change vals at these heights
changeHeights := []int64{1, 2, 4, 5, 10, 15, 16, 17, 20}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this test ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it was written with an assumption that there is only one validator. I can try and rewrite it of course

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. I think it's ok since we're specifically testing the "save/load at height" behaviour, and having just one validator was an easy way to write the test, and we have other tests of multiple validators. So we should defntly keep it. If you have a nice way to write it with multiple validators, that'd of course be welcome, though now we have to be mindful that it can only change by < 1/3 :)

Height: height,
// 1 val (vp: 10) => less than 3 is ok
EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []*abci.Validator{
{PubKey: crypto.GenPrivKeyEd25519().PubKey().Bytes(), Power: 3},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have more test cases

@melekes melekes force-pushed the 950-enforce-less-13-val-changes-per-block branch from 6ee11f2 to b8215d8 Compare December 26, 2017 19:30
@melekes
Copy link
Contributor Author

melekes commented Dec 26, 2017

@ebuchman ebuchman merged commit b8215d8 into develop Dec 27, 2017
@ebuchman ebuchman deleted the 950-enforce-less-13-val-changes-per-block branch December 27, 2017 00:22
cboh4 pushed a commit to scrtlabs/tendermint that referenced this pull request Apr 7, 2025
This is backport of three PRs originally merged against main:

* spec/p2p: Specify the operation of a Reactor (tendermint#714)
* spec/p2p: document the p2p API used by Reactors (tendermint#851)
* spec/p2p: new structure for the p2p specification (tendermint#966)

Co-authored-by: Josef Widder <44643235+josef-widder@users.noreply.github.com>
Co-authored-by: Lasaro <lasaro@informal.systems>
Co-authored-by: Sergio Mena <sergio@informal.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants