Skip to content

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

Merged
faustbrian merged 22 commits intoArkEcosystem:developfrom
spkjp:network-state
Jan 3, 2019
Merged

refactor(core-p2p): network state quorum calculation#1898
faustbrian merged 22 commits intoArkEcosystem:developfrom
spkjp:network-state

Conversation

@spkjp
Copy link
Copy Markdown
Contributor

@spkjp spkjp 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)

@spkjp spkjp requested a review from faustbrian December 21, 2018 21:47
@ghost ghost assigned spkjp Dec 21, 2018
@ghost ghost added the review label Dec 21, 2018
@codecov-io
Copy link
Copy Markdown

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.

Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
vasild
vasild previously requested changes Dec 28, 2018
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
Comment thread packages/core-p2p/src/utils/network-state.ts Outdated
@ghost ghost assigned faustbrian Dec 31, 2018
@spkjp spkjp changed the title [WIP] refactor(core-p2p): network state quorum calculation refactor(core-p2p): network state quorum calculation Jan 1, 2019
faustbrian
faustbrian previously approved these changes Jan 2, 2019
@faustbrian
Copy link
Copy Markdown
Contributor

@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.

vasild
vasild previously approved these changes Jan 3, 2019
@faustbrian faustbrian merged commit c25967f into ArkEcosystem:develop Jan 3, 2019
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.

5 participants