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

Feature: Add solidification stage to pipeline and only broadcast solid transactions #1646

Open
wants to merge 79 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 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
1b5294a
Add propagation queue back, remove addToSolidificationQueue from soli…
DyrellC Dec 24, 2019
ab6e628
Codacy corrections
DyrellC Dec 30, 2019
839d9cb
Move update status from validation to solidification
DyrellC Dec 30, 2019
031180b
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Dec 30, 2019
f61e6ff
Codacy conflicts
DyrellC Dec 30, 2019
6e0a383
reremove old transaction validator
DyrellC Dec 30, 2019
4126903
Merge branch 'dev' into add-Broadcast-queue
Jan 6, 2020
ff4a13c
Fix codacy import error, break up runValidation
DyrellC Jan 6, 2020
5bd3066
Merge branch 'add-Broadcast-queue' of https://github.com/DyrellC/iri …
DyrellC Jan 6, 2020
10baada
Merge branch 'dev' into add-Broadcast-queue
DyrellC Jan 15, 2020
4327b10
Merge branch 'dev' into add-Broadcast-queue
DyrellC Jan 16, 2020
092cfa5
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Jan 17, 2020
cc220b0
Merge branch 'add-Broadcast-queue' of https://github.com/DyrellC/iri …
DyrellC Jan 17, 2020
82359a7
Update regression logging
DyrellC Jan 21, 2020
7adfdc5
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Jan 21, 2020
d3baeee
Remove double import from merge
DyrellC Jan 21, 2020
ffea048
Verbose logging for debugging
DyrellC Jan 21, 2020
0f29416
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Feb 3, 2020
0084b48
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Feb 6, 2020
4664000
Revert "Fix: sort milestone candidates before analyzing for faster so…
DyrellC Feb 10, 2020
cc5e8b8
Broadcast latest tip even if not solid (will be latest milestone)
DyrellC Feb 14, 2020
d488a1d
Correct cpu load issues
DyrellC Feb 26, 2020
9ad4886
Remove max to propagation cascade
DyrellC Feb 26, 2020
9ab2a7d
Reintroduce limiter to adding duplicates for solidification
DyrellC Feb 26, 2020
5663d30
Merge branch 'dev' of https://github.com/iotaledger/iri into dev
DyrellC Mar 5, 2020
b2cb269
Update DagHelper
DyrellC Mar 6, 2020
31223b3
Update regression logging
DyrellC Jan 21, 2020
ea3bbf8
Move validation to validation service package
DyrellC Mar 18, 2020
e4feaf6
Merge branch 'update-regression-logging' into merge-transaction-solid…
DyrellC Mar 18, 2020
059e7e4
Merge branch 'dev' of https://github.com/iotaledger/iri into add-Broa…
DyrellC Mar 18, 2020
7528b22
Merge branch 'merge-transaction-solidifier' into add-Broadcast-queue
DyrellC Mar 19, 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
5 changes: 2 additions & 3 deletions python-regression/tests/features/steps/api_test_steps.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from aloe import *
from util import static_vals
from util import logger as log
from util.test_logic import api_test_logic as api_utils
from util.threading_logic import pool_logic as pool
from util.neighbor_logic import neighbor_logic as neighbors
from util.response_logic import response_handling as responses
from time import sleep, time

import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)

testAddress = static_vals.TEST_ADDRESS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from aloe import step
from util.test_logic import api_test_logic as api_utils
from util import logger as log

import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)


@step(r'A local snapshot was taken on "([^"]+)" at index (\d+)')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
from aloe import world, step
from util.response_logic import response_handling as response_handling
from util.test_logic import api_test_logic as api_utils
from util.test_logic import value_fetch_logic
from util.response_logic import response_handling as response_handling
from util import logger as log

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)

world.test_vars = {}

Expand Down
9 changes: 4 additions & 5 deletions python-regression/tests/features/steps/transaction_steps.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from aloe import world, step
from iota import Transaction
from util import static_vals as static
from util import logger as log
from util.test_logic import api_test_logic as api_utils
from util.transaction_bundle_logic import transaction_logic as transactions
from util.milestone_logic import milestones
from time import sleep

import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

logger = log.getLogger(__name__)

@step(r'a transaction is generated and attached on "([^"]+)" with:')
def generate_transaction_and_attach(step, node):
Expand Down Expand Up @@ -204,7 +202,8 @@ def wait_for_update(index, api):
if node_info['latestSolidSubtangleMilestoneIndex'] == index:
updated = True
break
i += 1;
i += 1
sleep(1)
logger.info("Waiting... {}".format(i))

assert updated is True, "The node was unable to update to index {}".format(index)
5 changes: 5 additions & 0 deletions python-regression/util/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s: %(message)s')

def getLogger(name):
return logging.getLogger(name)
6 changes: 2 additions & 4 deletions python-regression/util/milestone_logic/milestones.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from iota import ProposedTransaction, ProposedBundle, Tag, Address, Transaction
from util import conversion as converter
from util import logger as log
from util.transaction_bundle_logic import bundle_logic

import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

logger = log.getLogger(__name__)

def issue_milestone(address, api, index, *reference_transaction):
txn1 = ProposedTransaction(
Expand Down
5 changes: 2 additions & 3 deletions python-regression/util/neighbor_logic/neighbor_logic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
from util import logger as log
logger = log.getLogger(__name__)


def check_if_neighbors(api, neighbors, expected_neighbor):
Expand Down
5 changes: 2 additions & 3 deletions python-regression/util/response_logic/response_handling.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
from util.threading_logic import pool_logic as pool
from util import logger as log

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)


def find_in_response(key, response):
Expand Down
5 changes: 2 additions & 3 deletions python-regression/util/test_logic/api_test_logic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import json
import logging
import urllib3
from aloe import world
from iota import Iota, Address, Tag, TryteString

from . import value_fetch_logic as value_fetch
from util import logger as log

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)


def prepare_api_call(node_name, **kwargs):
Expand Down
5 changes: 2 additions & 3 deletions python-regression/util/threading_logic/pool_logic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from multiprocessing.dummy import Pool
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
from util import logger as log
logger = log.getLogger(__name__)


def start_pool(function, iterations, args):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
from util import static_vals as static
from util.test_logic import api_test_logic as api_utils
from util.test_logic import value_fetch_logic as value_fetch
import logging
from util import logger as log

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger = log.getLogger(__name__)


def create_transaction_bundle(address, tag, value):
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/com/iota/iri/Iota.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
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.*;
import com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider;
import com.iota.iri.utils.Pair;
Expand Down Expand Up @@ -95,6 +97,8 @@ public class Iota {

public final MilestoneSolidifier milestoneSolidifier;

public final TransactionSolidifier transactionSolidifier;

public final BundleValidator bundleValidator;

public final Tangle tangle;
Expand Down Expand Up @@ -126,7 +130,7 @@ public Iota(IotaConfig configuration, SpentAddressesProvider spentAddressesProvi
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 @@ -144,9 +148,9 @@ public Iota(IotaConfig configuration, SpentAddressesProvider spentAddressesProvi
this.neighborRouter = neighborRouter;
this.txPipeline = transactionProcessingPipeline;
this.tipsRequester = tipsRequester;
this.transactionSolidifier = transactionSolidifier;
this.localSnapshotsDb = localSnapshotsDb;


// legacy classes
this.bundleValidator = bundleValidator;
this.tangle = tangle;
Expand Down Expand Up @@ -199,8 +203,6 @@ public void init() throws Exception {
tangle.clearMetadata(com.iota.iri.model.persistables.Transaction.class);
}

transactionValidator.init();

txPipeline.start();
neighborRouter.start();
tipsRequester.start();
Expand All @@ -209,6 +211,7 @@ public void init() throws Exception {
latestSolidMilestoneTracker.start();
seenMilestonesRetriever.start();
milestoneSolidifier.start();
transactionSolidifier.start();

if (localSnapshotManager != null) {
localSnapshotManager.addSnapshotCondition(new SnapshotDepthCondition(configuration, snapshotProvider));
Expand Down Expand Up @@ -255,6 +258,7 @@ 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();
Expand All @@ -269,7 +273,6 @@ public void shutdown() throws Exception {
tipsRequester.shutdown();
txPipeline.shutdown();
neighborRouter.shutdown();
transactionValidator.shutdown();
localSnapshotsDb.shutdown();
tangle.shutdown();

Expand Down
25 changes: 17 additions & 8 deletions src/main/java/com/iota/iri/MainInjectionConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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 @@ -114,8 +117,8 @@ SeenMilestonesRetriever provideSeenMilestonesRetriever(Tangle tangle, SnapshotPr

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

@Singleton
Expand All @@ -136,8 +139,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);
}

@Singleton
Expand Down Expand Up @@ -171,12 +180,12 @@ Iota provideIota(SpentAddressesProvider spentAddressesProvider, SpentAddressesSe
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);
tipsRequester, tipsViewModel, tipsSelector, localSnapshotsDb, cacheManager, transactionSolidifier);
}

@Singleton
Expand All @@ -191,8 +200,8 @@ 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);
LatestMilestoneTracker latestMilestoneTracker, TransactionProcessingPipeline txPipeline, TransactionSolidifier transactionSolidifier) {
return new API(configuration, ixi, transactionRequester, spentAddressesService, tangle, bundleValidator, snapshotProvider, ledgerService, neighborRouter, tipsSelector, tipsViewModel, transactionValidator, latestMilestoneTracker, txPipeline, transactionSolidifier);
}

@Singleton
Expand Down
Loading