-
Notifications
You must be signed in to change notification settings - Fork 114
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
Monitoring system #640
Conversation
@@ -63,6 +64,9 @@ | |||
|
|||
private boolean checkIntegrity = true; | |||
|
|||
private Stack<IAionBlock> branchingBlk, preBranchingBlk; |
There was a problem hiding this comment.
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<>(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this 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.
@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. |
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]):
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.
Verification
Insert x into the following checkboxes to confirm (eg. [x]):