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

Monitoring system #640

Merged
merged 6 commits into from
Sep 25, 2018
Merged

Monitoring system #640

merged 6 commits into from
Sep 25, 2018

Conversation

AionJayT
Copy link
Collaborator

Notice

It is not allowed to submit your PR to the master branch directly, please submit your PR to the master-pre-merge branch.

Description

this is an enhancement for storing the branching block details. it helps us to analyze the potential risk for the attacks. This PR is added on the PR #639.

Fixes Issue N/A .

Type of change

Insert x into the following checkboxes to confirm (eg. [x]):

  • Bug fix.
  • New feature.
  • Enhancement.
  • Unit test.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

Testing

Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.

  • n/a

Verification

Insert x into the following checkboxes to confirm (eg. [x]):

  • I have self-reviewed my own code and conformed to the style guidelines of this project.
  • New and existing tests pass locally with my changes.
  • I have added tests for my fix or feature.
  • I have made appropriate changes to the corresponding documentation.
  • My code generates no new warnings.
  • Any dependent changes have been made.

@AionJayT AionJayT added the enhancement New feature or request label Sep 14, 2018
@@ -63,6 +64,9 @@

private boolean checkIntegrity = true;

private Stack<IAionBlock> branchingBlk, preBranchingBlk;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using the Deque class is preferable to the use of Stack as described in the JavaDoc.

@@ -446,11 +457,18 @@ public void reBranch(AionBlock forkBlock) {

while (currentLevel > forkBlock.getNumber()) {

if (preBranchingBlk == null) {
preBranchingBlk = new Stack<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer initializing the data structure where it is declared, instead of having so many if statements.

@@ -22,6 +22,9 @@
*/
package org.aion.zero.impl.db;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Stack;
Copy link
Contributor

Choose a reason for hiding this comment

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

The stack import was accidentally left behind.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@aion-kelvin aion-kelvin left a comment

Choose a reason for hiding this comment

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

The code looks good to me.

How are the 'branching details' log intended to be used? Is it just for devs to look at when debugging? Or are we setting up scripts to monitor the logs for the purpose of monitoring mainnet/testnet health? I think the the log format isn't very easy to grep/script against (would be easier if all the data you cared about was on one line), so if we're going to script against it, might want to reconsider the formatting.

@AionJayT
Copy link
Collaborator Author

AionJayT commented Sep 25, 2018

@aion-kelvin this PR is for deploying a monitoring system on our current monitor service and we do need the details data to prevent some data was been double spent during the deep branching happens.

@AionJayT AionJayT merged commit 4aa3ba8 into p2p-in-fix Sep 25, 2018
@AionJayT AionJayT deleted the monitoring-system branch October 2, 2018 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants