Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Draft: Milestone Stage #1696

Open
wants to merge 57 commits into
base: Dyrell-Milestone-Stage-Draft
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
53ea166
Add ubiquitous Broadcast Queue
DyrellC Oct 14, 2019
be7c132
Update unit tests with broadcasting queue
DyrellC Oct 15, 2019
6593388
Remove unneeded log
DyrellC Oct 17, 2019
33f193f
Merge branch 'dev' into add-Broadcast-queue
Oct 30, 2019
ff58495
Fix broadcast queue injection
DyrellC Nov 4, 2019
1a0ea43
remove unused function
DyrellC Nov 4, 2019
ad3a203
Merge branch 'add-Broadcast-queue' of https://github.com/DyrellC/iri …
DyrellC Nov 4, 2019
2283fb0
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Nov 4, 2019
24e31a5
Clean up imports
DyrellC Nov 4, 2019
03590dd
Remove BroadcastQueue, add TransactionSolidifier class
DyrellC Nov 8, 2019
06242eb
Add docs
DyrellC Nov 8, 2019
1ec3794
Add to solidification queue if update status fails
DyrellC Nov 8, 2019
bc5897f
Fix network injection test
DyrellC Nov 8, 2019
62a2330
Remove unused import, lower checkSolidity complexity
DyrellC Nov 8, 2019
9fc4cba
Reduce complexity further
DyrellC Nov 8, 2019
ccca691
Comments
DyrellC Nov 8, 2019
f0c1955
Change queue type, log error messages differentely
DyrellC Nov 12, 2019
fa72acc
Condense code slightly
DyrellC Nov 12, 2019
c3b1417
Synchronize solidifier queue access, add received transactions to sol…
DyrellC Nov 13, 2019
1538b36
Move solidification queue entry point, reduce interval for scans
DyrellC Nov 14, 2019
a34c5e8
Broadcast from reply stage to increase transactions to request speed
DyrellC Nov 18, 2019
14e784d
Merge branch 'dev' into add-Broadcast-queue
Nov 19, 2019
89ec550
Clean up PR, add interface
DyrellC Nov 21, 2019
8801ef2
Add unit tests
DyrellC Nov 21, 2019
26b9521
Wrap in try/catch, fix styling
DyrellC Nov 21, 2019
16170cf
Merge branch 'add-Broadcast-queue' of https://github.com/DyrellC/iri …
DyrellC Nov 21, 2019
7e34c91
Update src/main/java/com/iota/iri/network/pipeline/TransactionProcess…
DyrellC Nov 27, 2019
778c833
Remove solidification from broadcast queue next stage
DyrellC Nov 27, 2019
0b61c89
Add quick solid transactions to broadcast queue, comments and tests u…
DyrellC Nov 27, 2019
1a2d950
Merge branch 'add-Broadcast-queue' of https://github.com/DyrellC/iri …
DyrellC Nov 27, 2019
864c2db
codacy conflict
DyrellC Nov 27, 2019
4bfb138
Add messages to solidifier test
DyrellC Nov 27, 2019
d623d1d
Pop eldest on queue fill
DyrellC Nov 27, 2019
48258b1
Remove unused function
DyrellC Nov 27, 2019
1cde4bf
Iterator -> poll()
DyrellC Nov 27, 2019
6543981
Add transaction solidification stage
DyrellC Dec 2, 2019
7b4d3c5
Comments/clean-up
DyrellC Dec 2, 2019
5e0a974
update tests
DyrellC Dec 2, 2019
f86fe55
Remove unused payload Mock
DyrellC Dec 2, 2019
de08907
Remove log
DyrellC Dec 2, 2019
4086fce
Remove circular solidified queue
DyrellC Dec 2, 2019
b16c752
Make addToBroadcastQueue private again
DyrellC Dec 4, 2019
f5de8fe
Ensure solidTip is solid before broadcasting
DyrellC Dec 4, 2019
30f226e
Update tests, only broadcast solid transactions from solidify stage
DyrellC Dec 4, 2019
303648b
Move validator test to appropriate package
DyrellC Dec 5, 2019
7e36e1c
Downgrade log error to log info
DyrellC Dec 5, 2019
eb53b2f
Remove unnecessary solidity propogation thread in validator
DyrellC Dec 10, 2019
0409d3e
only import used parts of junit
DyrellC Dec 10, 2019
1f40bcc
Initial commit - Milestone Stage
DyrellC Dec 24, 2019
b9947aa
Merge branch 'dev' of https://github.com/iotaledger/iri into experime…
DyrellC Dec 24, 2019
c2f8c61
Remove old transaction validator
DyrellC Dec 31, 2019
d6b6e0c
Move update status from validation to solidification
DyrellC Dec 30, 2019
677b2b7
Merge branch 'dev' of https://github.com/iotaledger/iri into experime…
DyrellC Feb 3, 2020
503836d
load -> get
DyrellC Feb 3, 2020
61c42c7
update bootstrap logic
DyrellC Feb 3, 2020
6ae8307
Fix solidify -> broadcast
DyrellC Feb 15, 2020
e7bc4e0
Merge branch 'dev' of https://github.com/iotaledger/iri into experime…
DyrellC Feb 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions src/main/java/com/iota/iri/Iota.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import com.iota.iri.network.TransactionRequester;
import com.iota.iri.network.pipeline.TransactionProcessingPipeline;
import com.iota.iri.service.ledger.LedgerService;
import com.iota.iri.service.milestone.*;
import com.iota.iri.service.milestone.MilestoneService;
import com.iota.iri.service.milestone.MilestoneSolidifier;
import com.iota.iri.service.milestone.SeenMilestonesRetriever;
import com.iota.iri.service.snapshot.LocalSnapshotManager;
import com.iota.iri.service.snapshot.SnapshotException;
import com.iota.iri.service.snapshot.SnapshotProvider;
Expand All @@ -22,6 +24,12 @@
import com.iota.iri.service.transactionpruning.DepthPruningCondition;
import com.iota.iri.service.transactionpruning.SizePruningCondition;
import com.iota.iri.service.transactionpruning.TransactionPruner;
import com.iota.iri.service.validation.TransactionSolidifier;
import com.iota.iri.service.validation.TransactionValidator;
import com.iota.iri.storage.Indexable;
import com.iota.iri.storage.Persistable;
import com.iota.iri.storage.PersistenceProvider;
import com.iota.iri.storage.Tangle;
import com.iota.iri.storage.*;
import com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider;
import com.iota.iri.utils.Pair;
Expand Down Expand Up @@ -83,10 +91,6 @@ public class Iota {

public final MilestoneService milestoneService;

public final LatestMilestoneTracker latestMilestoneTracker;

public final LatestSolidMilestoneTracker latestSolidMilestoneTracker;

public final SeenMilestonesRetriever seenMilestonesRetriever;

public final LedgerService ledgerService;
Expand All @@ -95,6 +99,8 @@ public class Iota {

public final MilestoneSolidifier milestoneSolidifier;

public final TransactionSolidifier transactionSolidifier;

public final BundleValidator bundleValidator;

public final Tangle tangle;
Expand All @@ -116,17 +122,17 @@ public class Iota {
* @param configuration Information about how this node will be configured.
*
*/
//public Iota(IotaConfig configuration, SpentAddressesProvider spentAddressesProvider, SpentAddressesService spentAddressesService, SnapshotProvider snapshotProvider, SnapshotService snapshotService, LocalSnapshotManager localSnapshotManager, MilestoneService milestoneService, SeenMilestonesRetriever seenMilestonesRetriever, LedgerService ledgerService, TransactionPruner transactionPruner, MilestoneSolidifier milestoneSolidifier, BundleValidator bundleValidator, Tangle tangle, TransactionValidator transactionValidator, TransactionRequester transactionRequester, NeighborRouter neighborRouter, TransactionProcessingPipeline transactionProcessingPipeline, TipsRequester tipsRequester, TipsViewModel tipsViewModel, TipSelector tipsSelector, TransactionSolidifier transactionSolidifier) {
public Iota(IotaConfig configuration, SpentAddressesProvider spentAddressesProvider,
SpentAddressesService spentAddressesService, SnapshotProvider snapshotProvider,
SnapshotService snapshotService, LocalSnapshotManager localSnapshotManager,
MilestoneService milestoneService, LatestMilestoneTracker latestMilestoneTracker,
LatestSolidMilestoneTracker latestSolidMilestoneTracker, SeenMilestonesRetriever seenMilestonesRetriever,
MilestoneService milestoneService, SeenMilestonesRetriever seenMilestonesRetriever,
LedgerService ledgerService, TransactionPruner transactionPruner, MilestoneSolidifier milestoneSolidifier,
BundleValidator bundleValidator, Tangle tangle, TransactionValidator transactionValidator,
TransactionRequester transactionRequester, NeighborRouter neighborRouter,
TransactionProcessingPipeline transactionProcessingPipeline, TipsRequester tipsRequester,
TipsViewModel tipsViewModel, TipSelector tipsSelector, LocalSnapshotsPersistenceProvider localSnapshotsDb,
CacheManager cacheManager) {
CacheManager cacheManager, TransactionSolidifier transactionSolidifier) {
this.configuration = configuration;

this.ledgerService = ledgerService;
Expand All @@ -136,14 +142,13 @@ public Iota(IotaConfig configuration, SpentAddressesProvider spentAddressesProvi
this.snapshotService = snapshotService;
this.localSnapshotManager = localSnapshotManager;
this.milestoneService = milestoneService;
this.latestMilestoneTracker = latestMilestoneTracker;
this.latestSolidMilestoneTracker = latestSolidMilestoneTracker;
this.seenMilestonesRetriever = seenMilestonesRetriever;
this.milestoneSolidifier = milestoneSolidifier;
this.transactionPruner = transactionPruner;
this.neighborRouter = neighborRouter;
this.txPipeline = transactionProcessingPipeline;
this.tipsRequester = tipsRequester;
this.transactionSolidifier = transactionSolidifier;
this.localSnapshotsDb = localSnapshotsDb;


Expand All @@ -165,7 +170,6 @@ private void initDependencies() throws SnapshotException, SpentAddressesExceptio
boolean assertSpentAddressesExistence = !configuration.isTestnet()
&& snapshotProvider.getInitialSnapshot().getIndex() != configuration.getMilestoneStartIndex();
spentAddressesProvider.init(assertSpentAddressesExistence);
latestMilestoneTracker.init();
seenMilestonesRetriever.init();
if (transactionPruner != null) {
transactionPruner.init();
Expand Down Expand Up @@ -199,23 +203,20 @@ public void init() throws Exception {
tangle.clearMetadata(com.iota.iri.model.persistables.Transaction.class);
}

transactionValidator.init();

txPipeline.start();
neighborRouter.start();
tipsRequester.start();

latestMilestoneTracker.start();
latestSolidMilestoneTracker.start();
seenMilestonesRetriever.start();
transactionSolidifier.start();
milestoneSolidifier.start();

if (localSnapshotManager != null) {
localSnapshotManager.addSnapshotCondition(new SnapshotDepthCondition(configuration, snapshotProvider));
localSnapshotManager.addPruningConditions(
new DepthPruningCondition(configuration, snapshotProvider, tangle),
new SizePruningCondition(tangle, configuration));
localSnapshotManager.start(latestMilestoneTracker);
localSnapshotManager.start(milestoneSolidifier);
}
if (transactionPruner != null) {
transactionPruner.start();
Expand Down Expand Up @@ -255,9 +256,8 @@ private void rescanDb() throws Exception {
public void shutdown() throws Exception {
// shutdown in reverse starting order (to not break any dependencies)
milestoneSolidifier.shutdown();
transactionSolidifier.shutdown();
seenMilestonesRetriever.shutdown();
latestSolidMilestoneTracker.shutdown();
latestMilestoneTracker.shutdown();

if (transactionPruner != null) {
transactionPruner.shutdown();
Expand All @@ -269,7 +269,6 @@ public void shutdown() throws Exception {
tipsRequester.shutdown();
txPipeline.shutdown();
neighborRouter.shutdown();
transactionValidator.shutdown();
localSnapshotsDb.shutdown();
tangle.shutdown();

Expand Down
70 changes: 33 additions & 37 deletions src/main/java/com/iota/iri/MainInjectionConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import com.iota.iri.service.API;
import com.iota.iri.service.ledger.LedgerService;
import com.iota.iri.service.ledger.impl.LedgerServiceImpl;
import com.iota.iri.service.milestone.*;
import com.iota.iri.service.milestone.MilestoneService;
import com.iota.iri.service.milestone.MilestoneSolidifier;
import com.iota.iri.service.milestone.SeenMilestonesRetriever;
import com.iota.iri.service.milestone.impl.*;
import com.iota.iri.service.snapshot.LocalSnapshotManager;
import com.iota.iri.service.snapshot.SnapshotProvider;
Expand All @@ -27,6 +29,9 @@
import com.iota.iri.service.tipselection.impl.*;
import com.iota.iri.service.transactionpruning.TransactionPruner;
import com.iota.iri.service.transactionpruning.async.AsyncTransactionPruner;
import com.iota.iri.service.validation.TransactionSolidifier;
import com.iota.iri.service.validation.TransactionValidator;
import com.iota.iri.service.validation.impl.TransactionSolidifierImpl;
import com.iota.iri.storage.LocalSnapshotsPersistenceProvider;
import com.iota.iri.storage.Tangle;
import com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider;
Expand Down Expand Up @@ -91,33 +96,12 @@ LedgerService provideLedgerService(Tangle tangle, SnapshotProvider snapshotProvi
return new LedgerServiceImpl(tangle, snapshotProvider, snapshotService, milestoneService, spentAddressesService, bundleValidator);
}

@Singleton
@Provides
LatestMilestoneTracker provideLatestMilestoneTracker(Tangle tangle, SnapshotProvider snapshotProvider, MilestoneService milestoneService, MilestoneSolidifier milestoneSolidifier) {
return new LatestMilestoneTrackerImpl(tangle, snapshotProvider, milestoneService, milestoneSolidifier, configuration);
}

@Singleton
@Provides
LatestSolidMilestoneTracker provideLatestSolidMilestoneTracker(Tangle tangle, SnapshotProvider snapshotProvider,
MilestoneService milestoneService, LedgerService ledgerService,
LatestMilestoneTracker latestMilestoneTracker, TransactionRequester transactionRequester) {
return new LatestSolidMilestoneTrackerImpl(tangle, snapshotProvider, milestoneService, ledgerService,
latestMilestoneTracker, transactionRequester, configuration);
}

@Singleton
@Provides
SeenMilestonesRetriever provideSeenMilestonesRetriever(Tangle tangle, SnapshotProvider snapshotProvider, TransactionRequester transactionRequester) {
return new SeenMilestonesRetrieverImpl(tangle, snapshotProvider, transactionRequester);
}

@Singleton
@Provides
MilestoneSolidifier provideMilestoneSolidifier(SnapshotProvider snapshotProvider, TransactionValidator transactionValidator) {
return new MilestoneSolidifierImpl(snapshotProvider, transactionValidator);
}

@Singleton
@Provides
TransactionPruner provideTransactionPruner(Tangle tangle, SnapshotProvider snapshotProvider, SpentAddressesService spentAddressesService, SpentAddressesProvider spentAddressesProvider, TipsViewModel tipsViewModel) {
Expand All @@ -136,8 +120,14 @@ LocalSnapshotManager provideLocalSnapshotManager(SnapshotProvider snapshotProvid

@Singleton
@Provides
TransactionValidator provideTransactionValidator(Tangle tangle, SnapshotProvider snapshotProvider, TipsViewModel tipsViewModel, TransactionRequester transactionRequester) {
return new TransactionValidator(tangle, snapshotProvider, tipsViewModel, transactionRequester, configuration);
TransactionValidator provideTransactionValidator(SnapshotProvider snapshotProvider, TransactionRequester transactionRequester) {
return new TransactionValidator(snapshotProvider, transactionRequester, configuration);
}

@Singleton
@Provides
TransactionSolidifier provideTransactionSolidifier(Tangle tangle, SnapshotProvider snapshotProvider, TransactionRequester transactionRequester, TipsViewModel tipsViewModel){
return new TransactionSolidifierImpl(tangle, snapshotProvider, transactionRequester, tipsViewModel, configuration.getCoordinator());
}

@Singleton
Expand All @@ -149,9 +139,9 @@ CacheManager provideCacheManager() {
@Singleton
@Provides
TipSelector provideTipSelector(Tangle tangle, SnapshotProvider snapshotProvider,
LatestMilestoneTracker latestMilestoneTracker, LedgerService ledgerService) {
MilestoneSolidifier milestoneSolidifier, LedgerService ledgerService) {
EntryPointSelector entryPointSelector = new EntryPointSelectorImpl(tangle, snapshotProvider,
latestMilestoneTracker);
milestoneSolidifier);
RatingCalculator ratingCalculator = new CumulativeWeightCalculator(tangle, snapshotProvider);
TailFinder tailFinder = new TailFinderImpl(tangle);
Walker walker = new WalkerAlpha(tailFinder, tangle, new SecureRandom(), configuration);
Expand All @@ -164,19 +154,18 @@ TipSelector provideTipSelector(Tangle tangle, SnapshotProvider snapshotProvider,
Iota provideIota(SpentAddressesProvider spentAddressesProvider, SpentAddressesService spentAddressesService,
SnapshotProvider snapshotProvider, SnapshotService snapshotService,
@Nullable LocalSnapshotManager localSnapshotManager, MilestoneService milestoneService,
LatestMilestoneTracker latestMilestoneTracker, LatestSolidMilestoneTracker latestSolidMilestoneTracker,
SeenMilestonesRetriever seenMilestonesRetriever, LedgerService ledgerService,
@Nullable TransactionPruner transactionPruner, MilestoneSolidifier milestoneSolidifier,
BundleValidator bundleValidator, Tangle tangle, TransactionValidator transactionValidator,
TransactionRequester transactionRequester, NeighborRouter neighborRouter,
TransactionProcessingPipeline transactionProcessingPipeline, TipsRequester tipsRequester,
TipsViewModel tipsViewModel, TipSelector tipsSelector, LocalSnapshotsPersistenceProvider localSnapshotsDb,
CacheManager cacheManager) {
CacheManager cacheManager, TransactionSolidifier transactionSolidifier) {
return new Iota(configuration, spentAddressesProvider, spentAddressesService, snapshotProvider, snapshotService,
localSnapshotManager, milestoneService, latestMilestoneTracker, latestSolidMilestoneTracker,
seenMilestonesRetriever, ledgerService, transactionPruner, milestoneSolidifier, bundleValidator, tangle,
transactionValidator, transactionRequester, neighborRouter, transactionProcessingPipeline,
tipsRequester, tipsViewModel, tipsSelector, localSnapshotsDb, cacheManager);
localSnapshotManager, milestoneService, seenMilestonesRetriever, ledgerService,
transactionPruner, milestoneSolidifier, bundleValidator, tangle, transactionValidator,
transactionRequester, neighborRouter, transactionProcessingPipeline, tipsRequester,
tipsViewModel, tipsSelector, localSnapshotsDb, cacheManager, transactionSolidifier);
}

@Singleton
Expand All @@ -188,11 +177,18 @@ IXI provideIxi(Iota iota) {
@Singleton
@Provides
API provideApi(IXI ixi, TransactionRequester transactionRequester,
SpentAddressesService spentAddressesService, Tangle tangle, BundleValidator bundleValidator,
SnapshotProvider snapshotProvider, LedgerService ledgerService, NeighborRouter neighborRouter, TipSelector tipsSelector,
TipsViewModel tipsViewModel, TransactionValidator transactionValidator,
LatestMilestoneTracker latestMilestoneTracker, TransactionProcessingPipeline txPipeline) {
return new API(configuration, ixi, transactionRequester, spentAddressesService, tangle, bundleValidator, snapshotProvider, ledgerService, neighborRouter, tipsSelector, tipsViewModel, transactionValidator, latestMilestoneTracker, txPipeline);
SpentAddressesService spentAddressesService, Tangle tangle, BundleValidator bundleValidator,
SnapshotProvider snapshotProvider, LedgerService ledgerService, NeighborRouter neighborRouter, TipSelector tipsSelector,
TipsViewModel tipsViewModel, TransactionValidator transactionValidator,
TransactionProcessingPipeline txPipeline, TransactionSolidifier transactionSolidifier, MilestoneSolidifier milestoneSolidifier) {
return new API(configuration, ixi, transactionRequester, spentAddressesService, tangle, bundleValidator, snapshotProvider, ledgerService, neighborRouter, tipsSelector, tipsViewModel, transactionValidator, milestoneSolidifier, txPipeline, transactionSolidifier);
}

@Singleton
@Provides
MilestoneSolidifier provideMilestoneSolidifier(TransactionSolidifier transactionSolidifier, Tangle tangle, SnapshotProvider snapshotProvider, LedgerService ledgerService, TransactionRequester transactionRequester, MilestoneService milestoneService){
return new MilestoneSolidifierImpl(transactionSolidifier,tangle,snapshotProvider, ledgerService,
transactionRequester, milestoneService, configuration);
}

@Singleton
Expand Down
Loading