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

refactor(core-p2p): network state quorum calculation #1898

Merged
merged 22 commits into from Jan 3, 2019

Conversation

Projects
None yet
5 participants
@supaiku0
Copy link
Contributor

supaiku0 commented Dec 21, 2018

Proposed changes

Refactors the quorum calculation to keep track of the entire state. This should help pinpointing why the quorum sometimes randomly fails for no apparent reason.

Info dump when quorum fails:

"{
  "quorum": 0,
  "quorumDetails": {
    "peersQuorum": 0,
    "peersNoQuorum": 0,
    "peersOverHeight": 0,
    "peersOverHeightBlockHeaders": {},
    "peersBelowHeightElasticity": 0,
    "peersDifferentBlockId": 0,
    "peersDifferentSlot": 0,
    "peersForgingNotAllowed": 0
  },
  "nodeHeight": 100,
  "lastBlockId": "1233443"
}

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improve a current implementation without adding a new feature or fixing a bug)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build (changes that affect the build system)
  • Docs (documentation only changes)
  • Test (adding missing tests or fixing existing tests)
  • Other... Please describe:

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@supaiku0 supaiku0 requested a review from faustbrian Dec 21, 2018

@wafflebot wafflebot bot added the review label Dec 21, 2018

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Dec 21, 2018

Codecov Report

Merging #1898 into develop will decrease coverage by 0.11%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #1898      +/-   ##
==========================================
- Coverage    40.52%   40.4%   -0.12%     
==========================================
  Files          350     350              
  Lines         7569    7626      +57     
  Branches      1138    1147       +9     
==========================================
+ Hits          3067    3081      +14     
- Misses        4487    4530      +43     
  Partials        15      15
Impacted Files Coverage Δ
packages/core-p2p/src/peer.ts 19.1% <ø> (ø) ⬆️
packages/core-p2p/src/network-state.ts 0% <0%> (ø)
packages/core-p2p/src/monitor.ts 0% <0%> (ø) ⬆️
packages/core-forger/src/client.ts 79.31% <80%> (+0.73%) ⬆️
packages/core-forger/src/manager.ts 71.17% <96.15%> (+3.49%) ⬆️

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 86a4a2f...8781c06. Read the comment docs.

Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated
Show resolved Hide resolved packages/core-p2p/src/utils/network-state.ts Outdated

@supaiku0 supaiku0 changed the title [WIP] refactor(core-p2p): network state quorum calculation refactor(core-p2p): network state quorum calculation Jan 1, 2019

@faustbrian

This comment has been minimized.

Copy link
Collaborator

faustbrian commented Jan 3, 2019

@supaiku0 conflicts

class QuorumDetails {
public getQuorum() {
const quorum = this.peersQuorum / (this.peersQuorum + this.peersNoQuorum);
return isNaN(quorum) ? 0 : quorum;

This comment was marked as resolved.

@faustbrian

faustbrian Jan 3, 2019

Collaborator
Suggested change Beta
return isNaN(quorum) ? 0 : quorum;
return isFinite(quorum) ? quorum : 0;

@faustbrian faustbrian merged commit c25967f into ArkEcosystem:develop Jan 3, 2019

8 checks passed

ci/circleci: test-node10-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-2 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-slow Your tests passed on CircleCI!
Details
ci/circleci: test-node11-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-2 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-slow Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment