Feature: Add solidification stage to pipeline and only broadcast solid transactions #1646
Feature: Add solidification stage to pipeline and only broadcast solid transactions #1646DyrellC wants to merge 79 commits into
Conversation
kwek20
left a comment
There was a problem hiding this comment.
Can you change it so that the BroadcastQueue is obtained form a @Provider, like the other parameters?
Changes: MainInjectionConfiguration
@Singleton
@Provides
BroadcastQueue provideBroadcastQueue() {
return configuration.getBroadcastQueue();
}
remove lines 123 and 137 from IRI.java
add BroadcastQueue to the Constructor of Iota.java, and remove the configureBroadcastQueue
| break; | ||
| case BROADCAST: | ||
| broadcastStageQueue.put(ctx); | ||
| broadcastStageQueue.add(ctx); |
There was a problem hiding this comment.
So if I understand correctly, you still add transactions that are not solid...
There was a problem hiding this comment.
@galrogo Just to address this comment and subsequently issue #1512, currently transaction requests are dependent on broadcasting, so if you do not broadcast unsolid transactions, you will never send a transaction request. So it is necessary to pass on transactions before they are solid in the current framework. May be worth discussing a new method of transaction requesting from neighbours to avoid this dependency.
There was a problem hiding this comment.
Can we just broadcast random solid tips like before?
I guess moving on to the new messages that were developed for hornet will solve this problem
There was a problem hiding this comment.
IIUC, you implemented my suggestion above?
There was a problem hiding this comment.
When you say before are you referring to before the refactor? Because as is, after a transaction is placed into the solidifier, the solidify stage will fetch a random solid tip and broadcast it. If the tip is not solid the pipeline goes straight to FINISH instead. As it was before it was:
Transaction -> Pre-Processing -> Hashing/Validation -> Received (store) -> Broadcast (pass transaction on before verification of solidity) -> Finish
But now it would be:
Transaction -> Pre-Processing -> Hashing/Validation -> Received (store) -> Solidify (check if solid, if so pass on to broadcast, if not, place in solidification queue and fetch random tip for broadcasting) -> Broadcast -> Finish
There was a problem hiding this comment.
@DyrellC, marking this as point to discuss before merge
There was a problem hiding this comment.
never mind, I am good
GalRogozinski
left a comment
There was a problem hiding this comment.
Currently the logic nicely moves the transaction nicely through the through the stages. Due to the demand to broadcast only solid transactions maintaining this structure can be a bit hard...
What I believe you should do:
- remove the logic from the
ReceiveStagethat advances the transaction to theBroadcastStage - Make the
TransactionValidatorcontain theProcessingPipelineas well. - Make sure that each call to
tvm.updateSolidis wrapped with a method that also adds to the BroadcastQueue. It might be helpful to moveupdateSolidTransactionstoTransactionValidatoras well.
Note that it might be better to move all this solidification/broadcasting code to a new TransactionSolidifier class. But this can be done as a separate PR.
GalRogozinski
left a comment
There was a problem hiding this comment.
Looks pretty good!
Can you please add unit test for your new TransactionSolidifier that will go over the public methods?
| } | ||
| ctx.setNextStage(TransactionProcessingPipeline.Stage.ABORT); | ||
| ctx.setNextStage(TransactionProcessingPipeline.Stage.BROADCAST); | ||
| ctx.setPayload(new BroadcastPayload(null, tvm)); |
There was a problem hiding this comment.
Currently not sure why this has changed...
There was a problem hiding this comment.
In line 138 you gossip the tx to neighbor
There was a problem hiding this comment.
This was to bolster broadcast rate to neighbours to increase the rate that transactionsToRequest are sent out. It was meant to increase solidification speed.
There was a problem hiding this comment.
Seems a bit hacky...
I've been thinking about it and I think this should be the correct design:
You need to add a solidification stage and a solidification queue in TransactionProcessingPipeline.
The flow should be like this:
From the ReceivedStage -> if solid (due to quickly solid) -> Broadcast
-> else go to solidification stage -> Broadcast
Also remember to pass neighbor information along so we don't broadcast the solid tx to the neighbor that sent this to us..
| TransactionViewModel t = hashIterator.next(); | ||
| broadcastStageQueue.put(new ProcessingContext(new BroadcastPayload(null, t))); | ||
| toRemove.add(t); |
There was a problem hiding this comment.
Question:
So now we are sending the tx also to the origin neighbor?
Small peev:
can you change t to tx
I really dislike one letter variables
There was a problem hiding this comment.
This refill is what adds solid transactions to the broadcast queue, so here, yes you would send it to all neighbours. I'll change the 1 letter variable though.
There was a problem hiding this comment.
Just making sure, now with the new stage, this problem is resolved?
There was a problem hiding this comment.
Due to the asynchronous nature of solidification, there is still no neighbour variable to pass through unless we create a mapping, which imo is not worth it to do. So anything that gets updated as solid will be broadcast to all neighbours. But now only transactions that are solid will end up in the broadcast queue. We no longer forward transactions that have just been received.
There was a problem hiding this comment.
I think we need to create this mapping
I also don't think we should touch this PR too much, so please create an issue to do this :-)
There was a problem hiding this comment.
@DyrellC I am marking this as a point to discuss before merging
There was a problem hiding this comment.
We will need to discuss this, because now that the solidify stage does not add the incoming transactions to the solidification queue anymore, we have no entry point to put the origin neighbour into the process. As is, the only place that places transactions into the solidification queue is from the milestone solidifier. This is something that could be introduced in the milestone stage, I mention that in the new issue #1701
| /** | ||
| * Exclusively used in the {@link TansactionValidatorTest} | ||
| */ | ||
| public boolean isNewSolidTxSetsEmpty () { |
There was a problem hiding this comment.
If so, why did you change the signature?
There was a problem hiding this comment.
For whatever reason it was firing off a warning on my ide when it was this way, just changed it back without incident though.
…into add-Broadcast-queue
…lidification (iotaledger-archive#1660)" This reverts commit b658b88.
3ca8e7f to
d488a1d
Compare
Description
Abstract the broadcast queue to allow solidification and networking operations to place transactions in the
BroadcastStage. This improves the speed that transactions are broadcast to neighbours to improve synchronisation as well as allow neighbour nodes to receive newly added transactions faster. Improves state of the tangle in higher concentrated TPS environments.Fixes #1512
Type of change
How Has This Been Tested?
-High throughput spam mixing correctly with lower throughput spam from neighbouring node
Checklist: