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

Shuffle elected validators using block randomness #1033

Merged
merged 6 commits into from
Sep 20, 2019

Conversation

timmoreton
Copy link
Contributor

Description

Calls to getValidators to run the validators election now result in the set being shuffled using a variant of Fisher-Yates using block randomness as a seed.

This means that malicious groups or validators cannot predict their ordering or attempt to be located next to another validator under their control. Also makes it less likely that validators with few votes that are down are arranged sequentially and therefore cause a series of round changes and therefore exponential backoffs and a single very high block time.

Tested

New and modified protocol unit tests with a new MockRandom

Other changes

Describe any minor or "drive-by" changes here.

Related issues

Backwards compatibility

Yes

@m-chrzan
Copy link
Contributor

Looks like there's a problem with deploying the Validators smart contract in tests. Is it just not enough gas to pay for the increased bytecode?

@m-chrzan m-chrzan assigned timmoreton and unassigned m-chrzan Sep 19, 2019
@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #1033 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1033   +/-   ##
=======================================
  Coverage   66.94%   66.94%           
=======================================
  Files         252      252           
  Lines        7322     7322           
  Branches      479      479           
=======================================
  Hits         4902     4902           
  Misses       2332     2332           
  Partials       88       88
Flag Coverage Δ
#mobile 66.94% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3d94cc...634c9a3. Read the comment docs.

@timmoreton timmoreton assigned m-chrzan and unassigned timmoreton Sep 19, 2019
@@ -17,7 +17,7 @@ async function startGanache() {
network_id: network.network_id,
mnemonic: network.mnemonic,
gasPrice: network.gasPrice,
gasLimit: 7000000,
gasLimit: 8000000,
Copy link
Contributor

Choose a reason for hiding this comment

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

You will also have to increase the limit in scripts/bash/ganache.sh and scripts/devchain.ts. I think the latter should fix contractkit tests failing.

@m-chrzan m-chrzan assigned timmoreton and unassigned m-chrzan Sep 19, 2019
@timmoreton timmoreton added the automerge Have PR merge automatically when checks pass label Sep 20, 2019
@ashishb ashishb merged commit d0de17e into master Sep 20, 2019
@ashishb ashishb deleted the timmoreton/validator-shuffle branch September 20, 2019 19:00
aaronmgdr added a commit that referenced this pull request Sep 25, 2019
* master: (61 commits)
  Remove locales as website is now just in English (#1050)
  Add MetadataURL to account struct (#1103)
  Allow validators to use any valid combination of gold commitments as stake (#885)
  Fix blockscout websocket jsonrpc url (#1096)
  [Wallet] Preliminary iOS support (#1098)
  [Wallet] Set security fee description translation in Spanish (#1097)
  Exclude generated in vscode file watcher setting (#1082)
  Update .env and .env.integration files (#1087)
  Allow a testnet to run without ethstats (#1085)
  Collect exchange rate time series using notification service (#1020)
  Return to preview view when Fee Education is closed (#1068)
  [Wallet] Pin Setup Flow v2 (#1054)
  Added a variable for electoral threshold (#1023)
  [celotool]Store .env config on GCS after deployment (#1086)
  Group size limit (#1035)
  Fix governance unit tests (#1084)
  Add getExchangeRate to ContractKit (#1083)
  [CLI]Unlock till the geth exits (#1070)
  Add Quorum and Refactor Governance (#430)
  Shuffle elected validators using block randomness (#1033)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Down validators SNBAT induce long block production delays
3 participants