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.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Rogozinski committed Feb 21, 2019
2 parents c98d0cf + 8610396 commit 77dbb5a
Show file tree
Hide file tree
Showing 65 changed files with 1,551 additions and 636 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ script:
- mvn jacoco:report

after_success:
#digest of packaged jar
- test $TRAVIS_JDK_VERSION = "oraclejdk8" && sha256sum target/*.jar*
#codacy-coverage send report. Uses Travis Env variable (CODACY_PROJECT_TOKEN)
- test $TRAVIS_PULL_REQUEST = "false" && test $TRAVIS_JDK_VERSION = "oraclejdk8" && wget -O codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets[0].browser_download_url')
- test $TRAVIS_PULL_REQUEST = "false" && test $TRAVIS_JDK_VERSION = "oraclejdk8" && java -jar codacy-coverage-reporter-assembly-latest.jar report -l Java -r target/site/jacoco/jacoco.xml
Expand Down
6 changes: 3 additions & 3 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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

```docker run iotaledger/iri:v1.6.0-RELEASE -p 14265```
```docker run iotaledger/iri:v1.6.1-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.6.0-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.1-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 @@ -61,7 +61,7 @@ ExecStart=/usr/bin/docker run \
-p 14265:14265 \
-p 15600:15600 \
-p 14600:14600/udp \
iotaledger/iri:v1.6.0-RELEASE \
iotaledger/iri:v1.6.1-RELEASE \
-p 14265 \
--zmq-enabled \
--testnet
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,12 @@ IXI_DIR = ixi
DEBUG = false
DB_PATH = db
```

### Special Thanks To

### ![alt text](https://www.yourkit.com/images/yklogo.png)

YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>
and <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>,
innovative and intelligent tools for profiling Java and .NET applications.
49 changes: 49 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
1.6.1
- Fix: Db exists() method optimization (#1338)
- Fix: Do not persist pruner state (#1342)
- Fix: Reduce db access and cpu usage needed to persist spent addresses (#1332)
- Fix: Added a NULL_HASH check for genesis transaction (#1309)
- Feature: Fresh transactions to request (#1316)
- Fix: missing user-agent header in cors (#1319)
- Fix: Batch process spent addresses to avoid out of memory issues (#1314)
- Fix: added a buffer to LSManager (#1286)
- Fix: test existence of spent addresses db do not point to correct folder (#1305)
- Change: Convert from trytes to asciiString (#1302)
- Documentation: Fixed and added javadoc comments for existing classes (#1026)
- Fix: Creates rest endpoint for iotaconfig related settings as suggested (#1200)
- Fix: make storeMessage store transactions (#1186)
- Change: add a plugin to create reproducible builds. (#1194)
- Feature: Add configurable variables for spent addresses DB (#1274)
- Fix: Posting invalid json to IRI will result in detailed error message (#1202)
- Fix: dns reverse resolving issue for neighbors that are added with their IP. (#1255)

1.6.0
- Feat: added config variables for local snapshots (#981)
- Feat: added a generic helper class for dag traversal (#982)
- Feat: renamed Milestone to MilestoneTracker (#983)
- Feat: Introducing the GarbageCollector of local snapshots (#995)
- Feat: Fixes + Improvements for IRI that are required for local snapshots (#1095)
- Feat: Introducing several executor services for IRI (#1131)
- Feat: Making IRI use the initialSnapshot and the solidEntryPoints (#1135)
- MilestoneTracker and LedgerValidator rework (#1151)
- Activate Local Snapshots (#1172)
- Introducing a repair mechanism for corruptions in the ledger database (#1174)
- Introducing a parameter validation for the local snapshot config parameters (#1175)
- Introducing a dedicated Transaction Requester Background Worker (#1178)
- Fix: Removed intertwined locks to prevent deadlocks (#1195)
- Feat: Added an option to fast forward the ledger state (#1196)
- Perf: Massively improved the performance of the replayMilestones method (#1197)
- Refactor: Removed grace time from solid entry points generation (#1199)
- Increase rescan performance of old milestones after IRI restart (#1204)
- Refactor: Removed the old unused classes that got replaced by the local snapshots implementation (#1205)
- Refactor: made boolean parameters receive a value (#1224)
- Feat: Disable snapshot logic completely if disabled in the config (#1228)
- Fix: Node requested old transactions forever (#1235)
- Feat: Write snapshot files to temp files first (#1256)
- Fix first() calls in view models (#1257)
- Spentaddresses are persisted upon pruning (#1258)
- Spent Addresses should be persisted in a seperate db instance (#1263)
- Report local snapshot node transaction history via getNodeInfo (#1264)
- Don't start node if local snapshot is loaded but there is no spent ad… (#1266)
- Change the minimum value for LOCAL_SNAPSHOTS_PRUNING_DELAY (#1267)

1.5.6
- Global Snapshot (#1250)
- Refactor: refactored DedicatedScheduledExecutorService
Expand Down
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.iota</groupId>
<artifactId>iri</artifactId>
<version>1.6.0-RELEASE</version>
<version>1.6.1-RELEASE</version>
<name>IRI</name>
<description>IOTA Reference Implementation</description>

Expand Down Expand Up @@ -450,6 +450,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId>
<version>0.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>strip-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

</build>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/iota/iri/BundleValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class BundleValidator {
* If the bundle is invalid then an empty list will be returned.
* @throws Exception if a persistence error occured
*/
public static List<List<TransactionViewModel>> validate(Tangle tangle, Snapshot initialSnapshot, Hash tailHash) throws Exception {
public List<List<TransactionViewModel>> validate(Tangle tangle, Snapshot initialSnapshot, Hash tailHash) throws Exception {

TransactionViewModel tail = TransactionViewModel.fromHash(tangle, tailHash);
if (tail.getCurrentIndex() != 0 || tail.getValidity() == -1) {
Expand Down Expand Up @@ -194,10 +194,10 @@ public static List<List<TransactionViewModel>> validate(Tangle tangle, Snapshot
/**
* Checks that the bundle's inputs and outputs are balanced.
*
* @param transactionViewModels list of transactions that are in a bundle
* @param transactionViewModels collection of transactions that are in a bundle
* @return {@code true} if balanced, {@code false} if unbalanced or {@code transactionViewModels} is empty
*/
public static boolean isInconsistent(List<TransactionViewModel> transactionViewModels) {
public static boolean isInconsistent(Collection<TransactionViewModel> transactionViewModels) {
long value = 0;
for (final TransactionViewModel bundleTransactionViewModel : transactionViewModels) {
if (bundleTransactionViewModel.value() != 0) {
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/iota/iri/IRI.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class IRI {

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

/**
* The entry point of IRI.
Expand All @@ -60,6 +60,12 @@ public static void main(String[] args) throws Exception {
IRILauncher.main(args);
}

/**
* Reads the logging configuration file and logging level from system properties. You can set this values as
* arguments to the Java VM by passing <code>-Dlogback.configurationFile=/path/to/config.xml -Dlogging-level=DEBUG</code>
* to the Java VM. If no system properties are specified the logback default values and logging-level INFO will
* be used.
*/
private static void configureLogging() {
String config = System.getProperty("logback.configurationFile");
String level = System.getProperty("logging-level", "").toUpperCase();
Expand Down Expand Up @@ -178,6 +184,14 @@ private static IotaConfig createConfiguration(String[] args) {
return iotaConfig;
}

/**
* Parses the command line arguments for a config file that can be provided by parameter <code>-c</code>
* or parameter <code>--config</code>. If no filename was provided we fall back to <code>iota.ini</code> file.
* If no <code>iota.ini</code> file can be found return null.
*
* @param args command line arguments passed to main method.
* @return File the chosen file to use as config, or null.
*/
private static File chooseConfigFile(String[] args) {
int index = Math.max(ArrayUtils.indexOf(args, "-c"), ArrayUtils.indexOf(args, "--config"));
if (index != -1) {
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 @@ -95,6 +95,8 @@ public class Iota {

public final TransactionRequesterWorkerImpl transactionRequesterWorker;

public final BundleValidator bundleValidator;

public final Tangle tangle;
public final TransactionValidator transactionValidator;
public final TipsSolidifier tipsSolidifier;
Expand Down Expand Up @@ -137,6 +139,7 @@ public Iota(IotaConfig configuration) throws TransactionPruningException, Snapsh
transactionRequesterWorker = new TransactionRequesterWorkerImpl();

// legacy code
bundleValidator = new BundleValidator();
tangle = new Tangle();
messageQ = MessageQ.createWith(configuration);
tipsViewModel = new TipsViewModel();
Expand Down Expand Up @@ -200,22 +203,22 @@ private void injectDependencies() throws SnapshotException, TransactionPruningEx
//because we check whether spent addresses data exists
snapshotProvider.init(configuration);
spentAddressesProvider.init(configuration);
spentAddressesService.init(tangle, snapshotProvider, spentAddressesProvider);
spentAddressesService.init(tangle, snapshotProvider, spentAddressesProvider, bundleValidator, configuration);
snapshotService.init(tangle, snapshotProvider, spentAddressesService, spentAddressesProvider, configuration);
if (localSnapshotManager != null) {
localSnapshotManager.init(snapshotProvider, snapshotService, transactionPruner, configuration);
}
milestoneService.init(tangle, snapshotProvider, snapshotService, messageQ, configuration);
milestoneService.init(tangle, snapshotProvider, snapshotService, bundleValidator, messageQ, configuration);
latestMilestoneTracker.init(tangle, snapshotProvider, milestoneService, milestoneSolidifier,
messageQ, configuration);
latestSolidMilestoneTracker.init(tangle, snapshotProvider, milestoneService, ledgerService,
latestMilestoneTracker, messageQ);
seenMilestonesRetriever.init(tangle, snapshotProvider, transactionRequester);
milestoneSolidifier.init(snapshotProvider, transactionValidator);
ledgerService.init(tangle, snapshotProvider, snapshotService, milestoneService);
ledgerService.init(tangle, snapshotProvider, snapshotService, milestoneService, spentAddressesService,
bundleValidator);
if (transactionPruner != null) {
transactionPruner.init(tangle, snapshotProvider, spentAddressesService, tipsViewModel, configuration)
.restoreState();
transactionPruner.init(tangle, snapshotProvider, spentAddressesService, tipsViewModel, configuration);
}
transactionRequesterWorker.init(tangle, transactionRequester, tipsViewModel, node);
}
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/iota/iri/conf/BaseIotaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public abstract class BaseIotaConfig implements IotaConfig {
protected int localSnapshotsIntervalUnsynced = Defaults.LOCAL_SNAPSHOTS_INTERVAL_UNSYNCED;
protected int localSnapshotsDepth = Defaults.LOCAL_SNAPSHOTS_DEPTH;
protected String localSnapshotsBasePath = Defaults.LOCAL_SNAPSHOTS_BASE_PATH;
protected String spentAddressesDbPath = Defaults.SPENT_ADDRESSES_DB_PATH;
protected String spentAddressesDbLogPath = Defaults.SPENT_ADDRESSES_DB_LOG_PATH;

public BaseIotaConfig() {
//empty constructor
Expand Down Expand Up @@ -592,6 +594,28 @@ public int getNumberOfKeysInMilestone() {
return Defaults.NUM_KEYS_IN_MILESTONE;
}

@Override
public String getSpentAddressesDbPath() {
return spentAddressesDbPath;
}

@JsonProperty
@Parameter(names = {"--spent-addresses-db-path"}, description = SnapshotConfig.Descriptions.SPENT_ADDRESSES_DB_PATH)
protected void setSpentAddressesDbPath(String spentAddressesDbPath) {
this.spentAddressesDbPath = spentAddressesDbPath;
}

@Override
public String getSpentAddressesDbLogPath() {
return spentAddressesDbLogPath;
}

@JsonProperty
@Parameter(names = {"--spent-addresses-db-log-path"}, description = SnapshotConfig.Descriptions.SPENT_ADDRESSES_DB_LOG_PATH)
protected void setSpentAddressesDbLogPath(String spentAddressesDbLogPath) {
this.spentAddressesDbLogPath = spentAddressesDbLogPath;
}

@Override
public boolean isZmqEnabled() {
return zmqEnabled;
Expand Down Expand Up @@ -811,6 +835,8 @@ public interface Defaults {
int LOCAL_SNAPSHOTS_INTERVAL_UNSYNCED = 1000;
int LOCAL_SNAPSHOTS_DEPTH = 100;
int LOCAL_SNAPSHOTS_DEPTH_MIN = 100;
String SPENT_ADDRESSES_DB_PATH = "spent-addresses-db";
String SPENT_ADDRESSES_DB_LOG_PATH = "spent-addresses-log";

String LOCAL_SNAPSHOTS_BASE_PATH = "mainnet";
String SNAPSHOT_FILE = "/snapshotMainnet.txt";
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/com/iota/iri/conf/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@
import java.io.IOException;
import java.util.Properties;

/**
* Creates the global {@link IotaConfig} object with iri specific settings.
*/
public class ConfigFactory {

/**
* Creates the {@link IotaConfig} object for {@link TestnetConfig} or {@link MainnetConfig}.
*
* @param isTestnet true if {@link TestnetConfig} should be created.
* @return return the {@link IotaConfig} configuration.
*/
public static IotaConfig createIotaConfig(boolean isTestnet) {
IotaConfig iotaConfig;
if (isTestnet) {
Expand All @@ -26,8 +35,18 @@ public static IotaConfig createIotaConfig(boolean isTestnet) {
return iotaConfig;
}

public static IotaConfig createFromFile(File configFile, boolean testnet) throws IOException,
IllegalArgumentException {
/**
* Creates the {@link IotaConfig} object for {@link TestnetConfig} or {@link MainnetConfig} from config file. Parse
* the config file for <code>TESTNET=true</code>. If <code>TESTNET=true</code> is found we creates the
* {@link TestnetConfig} object, else creates the {@link MainnetConfig}.
*
* @param configFile A property file with configuration options.
* @param testnet When true a {@link TestnetConfig} is created.
* @return the {@link IotaConfig} configuration.
*
* @throws IOException When config file could not be found.
*/
public static IotaConfig createFromFile(File configFile, boolean testnet) throws IOException {
IotaConfig iotaConfig;

try (FileInputStream confStream = new FileInputStream(configFile)) {
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/iota/iri/conf/SnapshotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface SnapshotConfig extends Config {
long getSnapshotTime();

/**
* return {@value Descriptions#SNAPSHOT_FILE}
* @return {@value Descriptions#SNAPSHOT_FILE}
*/
String getSnapshotFile();

Expand Down Expand Up @@ -70,6 +70,16 @@ public interface SnapshotConfig extends Config {
*/
String getPreviousEpochSpentAddressesFiles();

/**
* @return {@value Descriptions#SPENT_ADDRESSES_DB_PATH}
*/
String getSpentAddressesDbPath();

/**
* @return {@value Descriptions#SPENT_ADDRESSES_DB_LOG_PATH}
*/
String getSpentAddressesDbLogPath();

interface Descriptions {

String LOCAL_SNAPSHOTS_ENABLED = "Flag that determines if local snapshots are enabled.";
Expand All @@ -88,5 +98,7 @@ interface Descriptions {
"leaves (private keys) that the coordinator can use to sign a message.";
String PREVIOUS_EPOCH_SPENT_ADDRESSES_FILE = "The file that contains the list of all used addresses " +
"from previous epochs";
String SPENT_ADDRESSES_DB_PATH = "The folder where the spent addresses DB saves its data.";
String SPENT_ADDRESSES_DB_LOG_PATH = "The folder where the spent addresses DB saves its logs.";
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/iota/iri/network/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private Runnable spawnNeighborDNSRefresherThread() {

try {
neighbors.forEach(n -> {
final String hostname = n.getAddress().getHostName();
final String hostname = n.getAddress().getHostString();
checkIp(hostname).ifPresent(ip -> {
log.info("DNS Checker: Validating DNS Address '{}' with '{}'", hostname, ip);
messageQ.publish("dnscv %s %s", hostname, ip);
Expand Down
Loading

0 comments on commit 77dbb5a

Please sign in to comment.