-
Notifications
You must be signed in to change notification settings - Fork 1
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: Add NodeService and ServiceState interfaces #688
refactor: Add NodeService and ServiceState interfaces #688
Conversation
|
||
@Override | ||
public void persistState() { | ||
//There's no need to store historical transaction data in DB. |
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.
@@ -1,89 +1,13 @@ | |||
package com.limechain.client; | |||
|
|||
import com.limechain.cli.CliArguments; |
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.
With this refactoring, we don't need this class anymore.
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 mean AbstractNode, not the one in the import.
try { | ||
BlockState.getInstance().setFinalizedHash( | ||
blockByHash.getHeader(), commitMessage.getRoundNumber(), commitMessage.getSetId()); | ||
blockState.setFinalizedHash(blockHeader, commitMessage.getRoundNumber(), commitMessage.getSetId()); | ||
} catch (Exception e) { | ||
log.fine(e.getMessage()); | ||
return false; |
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.
What exception are we catching here?
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.
Various errors from BlockState
. Such as BlockNodeNotFoundException
, LowerThanRootException
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.
Change Exception
to RuntimeException
so that it's clear that there are no checked exceptons.
public void onFinish(Runnable... function) { | ||
onFinishCallbacks.addAll(List.of(function)); | ||
} |
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.
When are we giving this more than 1 runnable?
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.
Also should be functions
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.
In SyncService
warpSyncMachine.onFinish(() -> AbstractState.setSyncMode(SyncMode.HEAD), messageCoordinator::handshakeBootNodes);
warpSyncMachine.onFinish(() -> AbstractState.setSyncMode(SyncMode.FULL), fullSyncMachine::start);
Quality Gate passedIssues Measures |
Description
This PR aims to improve the overall structure of Fruzhin in 2 ways:
NodeService
. This enables services to share a class signature and be started/stopped in a similar fashion. It also helps separate what services are required and started for each type of node.ServiceState
. Reasoning is similar to the service one, but it also aims to centralize the initialization of the states as they were not concise. It also prepares Fruzhin to follow the Runtime to Consensus engine communication. (initializing states at genesis and using consensus message to update)