-
Notifications
You must be signed in to change notification settings - Fork 370
Feature: Transaction Solidifier #1484
base: dev
Are you sure you want to change the base?
Conversation
Some unit tests should be made for this |
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.
Took some time this morning to finally look at this.
Looks pretty good. If you will fix the conflicts and the few comments then I will get it merged quickly
|
||
|
||
/** | ||
* The depth the solidifier will use. |
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.
Add Default Value like in the other configs
int latestMilestoneIndex = latestMilestoneTracker.getLatestMilestoneIndex(); | ||
int depth = solidificationConfig.getSolidifierDepth(); | ||
if (latestMilestoneIndex - depth <= 0 | ||
|| snapshotProvider.getLatestSnapshot().getIndex() < latestMilestoneIndex - depth) { |
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.
snapshotProvider.getLatestSnapshot().getIndex() < latestMilestoneIndex - depth
Maybe I am getting confused but doesn't this contradict your comment?
I read as if you are not synchronized then don't attempt to solidify
int getSolidifierDepth(); | ||
|
||
/** | ||
* Returns the interval at which the solidifer will run. |
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.
Add Default Value like in the other configs
e58b428
to
0d72605
Compare
0d72605
to
78d673f
Compare
Description
In order to have a relevant view of the graph from a given depth towards the tips, we want to be able to mark transactions as solid from bottom->top. In a scenario where the
TipSolidifier
is disabled, only theTransactionValidator
will mark transactions as solid (besides the MilestoneSolidifer), by performing once a quick solid check on approvers of transactions which were set to be solid up on arrival. TheTransactionsValidator
's quick solidification thread runs every 750 milliseconds.This means that if we are receiving transactions out of order and a given transaction was missed by the
TransactionValidator
quick solidification thread, the transaction will only be marked as solid once a new milestone is issued (because it triggers a solidification of all approved transactions).This PR adds a separate component called
TransactionSolidifier
with its implementationQuickTransactionSolidifier
which starts at a configurable depth (default: 3) and walks from the given milestone up the graph towards the tips traversing all transaction and performing a quick solid check on each of them. TheQuickTransactionSolidifier
runs every 10 seconds (configurable).Testing this component on the ICC network, I wanted to see how long such mechanism would take. Luckily, the operation seems to be very quick as shown by the given log outputs:
Note that
updated N
means that the N transactions were updated to be solid andtraversed N
means how many transactions were traversed while walking up the graph towards the tips. Note also thatupdated N
shows that theTransactionValidator
quick solidification thread misses some transactions when it runs which are however always going to be catched by theQuickTransactionSolidifier
.This component doesn't appear even in YourKit's profiling because it's very cheap.
Fixes # (issue)
#1009
#1013
#1011 (maybe?)
The solidifier in
TransactionValidator
can be removed through #1485.Type of change
How Has This Been Tested?
On the ICC network
Checklist:
Please delete items that are not relevant.