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

Commit

Permalink
Merge branch 'release-v1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Rogozinski committed Jan 11, 2019
2 parents 1ec6dcc + f6e84bb commit c98d0cf
Show file tree
Hide file tree
Showing 73 changed files with 2,060 additions and 535 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ If you have general questions on IOTA you can go to https://iota.stackexchange.c
### Bug description
A general description of the bug.

### IRI version
What version are you running?

### Hardware Spec
On what hardware is the node running on?

Expand Down
7 changes: 3 additions & 4 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

Run the official iotaledger/iri container, passing the mandatory -p option:

```docker run iotaledger/iri:v1.5.6-RELEASE -p 14265```

```docker run iotaledger/iri:v1.6.0-RELEASE -p 14265```

This will get your a running IRI with its API listening on port 14265, no neighbours and an empty database. The IRI Docker container by default expects data at /iri/data. Use the `-v` option of the `docker run` command to mount volumes so to have persistent data. You can also pass more command line options to the docker run command and those will be passed to IRI.

If you want to use a iri.ini file with the docker container, supposing it's stored under /path/to/conf/iri.ini on your docker host, then pass `-v /path/to/conf:/iri/conf` and add -c /iri/conf/iri.ini as docker run arguments. So for example the `docker run` command above would become:

```docker run -v /path/to/conf:/iri/conf -v /path/to/data:/iri/data iotaledger/iri:v1.5.6-RELEASE -p 14265 -c /iri/conf/iri.ini```
```docker run -v /path/to/conf:/iri/conf -v /path/to/data:/iri/data iotaledger/iri:v1.6.0-RELEASE -p 14265 -c /iri/conf/iri.ini```

Please refer to the IRI documentation for further command line options and iri.ini options.

Expand Down Expand Up @@ -62,7 +61,7 @@ ExecStart=/usr/bin/docker run \
-p 14265:14265 \
-p 15600:15600 \
-p 14600:14600/udp \
iotaledger/iri:v1.5.6-RELEASE \
iotaledger/iri:v1.6.0-RELEASE \
-p 14265 \
--zmq-enabled \
--testnet
Expand Down
14 changes: 11 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

<groupId>com.iota</groupId>
<artifactId>iri</artifactId>
<version>1.5.6-RELEASE</version>

<version>1.6.0-RELEASE</version>
<name>IRI</name>
<description>IOTA Reference Implementation</description>

Expand Down Expand Up @@ -197,6 +196,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>pl.touk</groupId>
<artifactId>throwing-function</artifactId>
<version>1.3</version>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -372,6 +377,9 @@
<urn>
com.beust:jcommander:1.72:jar:null:compile:6375e521c1e11d6563d4f25a07ce124ccf8cd171
</urn>
<urn>
pl.touk:throwing-function:1.3:jar:null:compile:32947866b8754295efde73ee7d39ea29a247a2b5
</urn>

<!-- A check for the rules themselves -->
<urn>
Expand Down Expand Up @@ -652,4 +660,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Feature: Test API calls on Machine 1
|latestSolidSubtangleMilestone |
|latestSolidSubtangleMilestoneIndex |
|milestoneStartIndex |
|lastSnapshottedMilestoneIndex |
|neighbors |
|packetsQueueSize |
|time |
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/com/iota/iri/IRI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import org.slf4j.LoggerFactory;

/**
*
*
* Main IOTA Reference Implementation (IRI) starting class.
* <p>
* The IRI software enables the Tangle to operate. Individuals can run IRI to operates Nodes.
* The Node running the IRI software enables your device to communicate with neighbors
* in the peer-to-peer network that the Tangle operates on.
* The Node running the IRI software enables your device to communicate with neighbors
* in the peer-to-peer network that the Tangle operates on.
* </p>
* <p>
* IRI implements all the core functionality necessary for participating in an IOTA network as a full node.
Expand All @@ -35,26 +35,26 @@
* <li>Loading custom modules that extend the API.</li>
* </ul>
* </p>
*
*
* @see <a href="https://docs.iota.org/iri">Online documentation on iri</a>
*/
public class IRI {

public static final String MAINNET_NAME = "IRI";
public static final String TESTNET_NAME = "IRI Testnet";
public static final String VERSION = "1.5.6-RELEASE";
public static final String VERSION = "1.6.0-RELEASE";

/**
* The entry point of IRI.
* Starts by configuring the logging settings, then proceeds to {@link IRILauncher#main(String[])}
* The log level is set to INFO by default.
*
*
* @param args Configuration arguments. See {@link BaseIotaConfig} for a list of all options.
* @throws Exception If we fail to start the IRI launcher.
*/
public static void main(String[] args) throws Exception {
// Logging is configured first before any references to Logger or LoggerFactory.
// Any public method or field accessors needed in IRI should be put in IRI and then delegate to IRILauncher.
// Logging is configured first before ANY references to Logger or LoggerFactory.
// Any public method or field accessors needed in IRI should be put in IRI and then delegate to IRILauncher.
// That ensures that future code does not need to know about this setup.
configureLogging();
IRILauncher.main(args);
Expand Down Expand Up @@ -98,11 +98,11 @@ private static class IRILauncher {
* <li>Load the configuration.</li>
* <li>Create {@link Iota}, {@link IXI} and {@link API}.</li>
* <li>Listen for node shutdown.</li>
* <li>Initialize {@link Iota}, {@link IXI} and {@link API} using their <tt>init()</tt> methods.</li>
* </ul>
*
* <li>Initialize {@link Iota}, {@link IXI} and {@link API} using their <tt>init()</tt> methods.</li>
* </ul>
*
* If no exception is thrown, the node starts synchronizing with the network, and the API can be used.
*
*
* @param args Configuration arguments. See {@link BaseIotaConfig} for a list of all options.
* @throws Exception If any of the <tt>init()</tt> methods failed to initialize.
*/
Expand Down
20 changes: 16 additions & 4 deletions src/main/java/com/iota/iri/IXI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.GsonBuilder;
import com.iota.iri.service.CallableRequest;
import com.iota.iri.service.dto.AbstractResponse;
import com.iota.iri.service.dto.ErrorResponse;
import com.sun.nio.file.SensitivityWatchEventModifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -19,7 +20,10 @@
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.Instant;
import java.util.*;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -183,6 +187,10 @@ private Path getPackagePath(Path modulePath) {
}

public AbstractResponse processCommand(final String command, Map<String, Object> request) {
if(command == null || command.isEmpty()) {
return ErrorResponse.create("Command can not be null or empty");
}

Pattern pattern = Pattern.compile("^(.*)\\.(.*)$");
Matcher matcher = pattern.matcher(command);

Expand All @@ -192,7 +200,7 @@ public AbstractResponse processCommand(final String command, Map<String, Object>
return ixiMap.get(matcher.group(2)).call(request);
}
}
return null;
return ErrorResponse.create("Command [" + command + "] is unknown");
}

private void loadModule(Path modulePath) {
Expand All @@ -202,7 +210,7 @@ private void loadModule(Path modulePath) {
log.info("No package.json found in {}", modulePath);
return;
}
final Map packageJson;
Map packageJson;
Reader packageJsonReader;
try {
packageJsonReader = new FileReader(packageJsonPath.toFile());
Expand Down Expand Up @@ -275,6 +283,10 @@ private void detach(String moduleName) {
ixiLifetime.remove(moduleName);
}

/**
* Cleans up the environment, shutdown the dir watcher thread and wait till all running api calls are completed.
* @throws InterruptedException if directory watching thread was unexpected interrupted.
*/
public void shutdown() throws InterruptedException {
if(dirWatchThread != null) {
shutdown = true;
Expand All @@ -284,4 +296,4 @@ public void shutdown() throws InterruptedException {
ixiLifetime.clear();
}
}
}
}
35 changes: 28 additions & 7 deletions src/main/java/com/iota/iri/Iota.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import com.iota.iri.service.snapshot.impl.LocalSnapshotManagerImpl;
import com.iota.iri.service.snapshot.impl.SnapshotProviderImpl;
import com.iota.iri.service.snapshot.impl.SnapshotServiceImpl;
import com.iota.iri.service.spentaddresses.SpentAddressesException;
import com.iota.iri.service.spentaddresses.impl.SpentAddressesProviderImpl;
import com.iota.iri.service.spentaddresses.impl.SpentAddressesServiceImpl;
import com.iota.iri.service.tipselection.*;
import com.iota.iri.service.tipselection.impl.*;
import com.iota.iri.service.transactionpruning.TransactionPruningException;
Expand Down Expand Up @@ -66,6 +69,10 @@
public class Iota {
private static final Logger log = LoggerFactory.getLogger(Iota.class);

public final SpentAddressesProviderImpl spentAddressesProvider;

public final SpentAddressesServiceImpl spentAddressesService;

public final SnapshotProviderImpl snapshotProvider;

public final SnapshotServiceImpl snapshotService;
Expand Down Expand Up @@ -108,19 +115,25 @@ public class Iota {
* @throws SnapshotException If the Snapshot fails to initialize.
* This can happen if the snapshot signature is invalid or the file cannot be read.
*/
public Iota(IotaConfig configuration) throws TransactionPruningException, SnapshotException {
public Iota(IotaConfig configuration) throws TransactionPruningException, SnapshotException, SpentAddressesException {
this.configuration = configuration;

// new refactored instances
spentAddressesProvider = new SpentAddressesProviderImpl();
spentAddressesService = new SpentAddressesServiceImpl();
snapshotProvider = new SnapshotProviderImpl();
snapshotService = new SnapshotServiceImpl();
localSnapshotManager = null;
localSnapshotManager = configuration.getLocalSnapshotsEnabled()
? new LocalSnapshotManagerImpl()
: null;
milestoneService = new MilestoneServiceImpl();
latestMilestoneTracker = new LatestMilestoneTrackerImpl();
latestSolidMilestoneTracker = new LatestSolidMilestoneTrackerImpl();
seenMilestonesRetriever = new SeenMilestonesRetrieverImpl();
milestoneSolidifier = new MilestoneSolidifierImpl();
transactionPruner = null;
transactionPruner = configuration.getLocalSnapshotsEnabled() && configuration.getLocalSnapshotsPruningEnabled()
? new AsyncTransactionPruner()
: null;
transactionRequesterWorker = new TransactionRequesterWorkerImpl();

// legacy code
Expand Down Expand Up @@ -182,9 +195,13 @@ public void init() throws Exception {
}
}

private void injectDependencies() throws SnapshotException, TransactionPruningException {
private void injectDependencies() throws SnapshotException, TransactionPruningException, SpentAddressesException {
//snapshot provider must be initialized first
//because we check whether spent addresses data exists
snapshotProvider.init(configuration);
snapshotService.init(tangle, snapshotProvider, configuration);
spentAddressesProvider.init(configuration);
spentAddressesService.init(tangle, snapshotProvider, spentAddressesProvider);
snapshotService.init(tangle, snapshotProvider, spentAddressesService, spentAddressesProvider, configuration);
if (localSnapshotManager != null) {
localSnapshotManager.init(snapshotProvider, snapshotService, transactionPruner, configuration);
}
Expand All @@ -197,7 +214,8 @@ private void injectDependencies() throws SnapshotException, TransactionPruningEx
milestoneSolidifier.init(snapshotProvider, transactionValidator);
ledgerService.init(tangle, snapshotProvider, snapshotService, milestoneService);
if (transactionPruner != null) {
transactionPruner.init(tangle, snapshotProvider, tipsViewModel, configuration).restoreState();
transactionPruner.init(tangle, snapshotProvider, spentAddressesService, tipsViewModel, configuration)
.restoreState();
}
transactionRequesterWorker.init(tangle, transactionRequester, tipsViewModel, node);
}
Expand Down Expand Up @@ -264,7 +282,10 @@ private void initializeTangle() {
tangle.addPersistenceProvider(new RocksDBPersistenceProvider(
configuration.getDbPath(),
configuration.getDbLogPath(),
configuration.getDbCacheSize()));
configuration.getDbCacheSize(),
Tangle.COLUMN_FAMILIES,
Tangle.METADATA_COLUMN_FAMILY)
);
break;
}
default: {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/iota/iri/conf/BaseIotaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ public interface Defaults {
boolean LOCAL_SNAPSHOTS_ENABLED = true;
boolean LOCAL_SNAPSHOTS_PRUNING_ENABLED = true;

int LOCAL_SNAPSHOTS_PRUNING_DELAY = 50000;
int LOCAL_SNAPSHOTS_PRUNING_DELAY_MIN = 40000;
int LOCAL_SNAPSHOTS_PRUNING_DELAY = 40000;
int LOCAL_SNAPSHOTS_PRUNING_DELAY_MIN = 10000;
int LOCAL_SNAPSHOTS_INTERVAL_SYNCED = 10;
int LOCAL_SNAPSHOTS_INTERVAL_UNSYNCED = 1000;
int LOCAL_SNAPSHOTS_DEPTH = 100;
Expand Down
Loading

0 comments on commit c98d0cf

Please sign in to comment.