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.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gal Rogozinski committed Apr 10, 2019
2 parents 77dbb5a + 35a7eda commit dc6dd3d
Show file tree
Hide file tree
Showing 19 changed files with 44,455 additions and 20,087 deletions.
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.1-RELEASE -p 14265```
```docker run iotaledger/iri:v1.7.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.6.1-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.7.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 @@ -61,7 +61,7 @@ ExecStart=/usr/bin/docker run \
-p 14265:14265 \
-p 15600:15600 \
-p 14600:14600/udp \
iotaledger/iri:v1.6.1-RELEASE \
iotaledger/iri:v1.7.0-RELEASE \
-p 14265 \
--zmq-enabled \
--testnet
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.7.0
- refactor milestone signature parameters to be configurable (#1322)
- migration from legacy coordinator to compass

1.6.1
- Fix: Db exists() method optimization (#1338)
- Fix: Do not persist pruner state (#1342)
Expand Down
2 changes: 1 addition & 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.1-RELEASE</version>
<version>1.7.0-RELEASE</version>
<name>IRI</name>
<description>IOTA Reference Implementation</description>

Expand Down
2 changes: 1 addition & 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.1-RELEASE";
public static final String VERSION = "1.7.0-RELEASE";

/**
* The entry point of IRI.
Expand Down
46 changes: 33 additions & 13 deletions src/main/java/com/iota/iri/conf/BaseIotaConfig.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.iota.iri.conf;

import com.iota.iri.IRI;
import com.iota.iri.utils.IotaUtils;

import java.util.ArrayList;
import java.util.List;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import com.iota.iri.IRI;
import com.iota.iri.crypto.SpongeFactory;
import com.iota.iri.model.Hash;
import com.iota.iri.model.HashFactory;
import com.iota.iri.utils.IotaUtils;
import org.apache.commons.lang3.ArrayUtils;

import java.util.ArrayList;
import java.util.List;

/*
Note: the fields in this class are being deserialized from Jackson so they must follow Java Bean convention.
Meaning that every field must have a getter that is prefixed with `get` unless it is a boolean and then it should be
Expand Down Expand Up @@ -589,6 +590,11 @@ public int getMilestoneStartIndex() {
return Defaults.MILESTONE_START_INDEX;
}

@Override
public int getMaxMilestoneIndex() {
return Defaults.MAX_MILESTONE_INDEX;
}

@Override
public int getNumberOfKeysInMilestone() {
return Defaults.NUM_KEYS_IN_MILESTONE;
Expand Down Expand Up @@ -694,10 +700,20 @@ protected void setCacheSizeBytes(int cacheSizeBytes) {
}

@Override
public String getCoordinator() {
public Hash getCoordinator() {
return Defaults.COORDINATOR_ADDRESS;
}

@Override
public int getCoordinatorSecurityLevel() {
return Defaults.COORDINATOR_SECURITY_LEVEL;
}

@Override
public SpongeFactory.Mode getCoordinatorSignatureMode() {
return Defaults.COORDINATOR_SIGNATURE_MODE;
}

@Override
public boolean isDontValidateTestnetMilestoneSig() {
return false;
Expand Down Expand Up @@ -822,8 +838,12 @@ public interface Defaults {
int POW_THREADS = 0;

//Coo
String COORDINATOR_ADDRESS =
"KPWCHICGJZXKE9GSUDXZYUAPLHAKAHYHDXNPHENTERYMMBQOPSQIDENXKLKCEYCPVTZQLEEJVYJZV9BWU";
Hash COORDINATOR_ADDRESS = HashFactory.ADDRESS.create(
"EQSAUZXULTTYZCLNJNTXQTQHOMOFZERHTCGTXOLTVAHKSA9OGAZDEKECURBRIXIJWNPFCQIOVFVVXJVD9");
int COORDINATOR_SECURITY_LEVEL = 2;
SpongeFactory.Mode COORDINATOR_SIGNATURE_MODE = SpongeFactory.Mode.KERL;
int NUM_KEYS_IN_MILESTONE = 23;
int MAX_MILESTONE_INDEX = 1 << NUM_KEYS_IN_MILESTONE;

//Snapshot
boolean LOCAL_SNAPSHOTS_ENABLED = true;
Expand All @@ -844,9 +864,9 @@ public interface Defaults {
String PREVIOUS_EPOCHS_SPENT_ADDRESSES_TXT =
"/previousEpochsSpentAddresses1.txt /previousEpochsSpentAddresses2.txt " +
"/previousEpochsSpentAddresses3.txt";
long GLOBAL_SNAPSHOT_TIME = 1545469620;
int MILESTONE_START_INDEX = 933_210;
int NUM_KEYS_IN_MILESTONE = 20;
long GLOBAL_SNAPSHOT_TIME = 1554904800;
int MILESTONE_START_INDEX = 1050000;
int MAX_ANALYZED_TXS = 20_000;

}
}
33 changes: 32 additions & 1 deletion src/main/java/com/iota/iri/conf/MilestoneConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.iota.iri.conf;

import com.iota.iri.crypto.SpongeFactory;
import com.iota.iri.model.Hash;

/**
* Configs that should be used for tracking milestones
*/
Expand All @@ -8,16 +11,44 @@ public interface MilestoneConfig extends Config {
/**
* @return Descriptions#COORDINATOR
*/
String getCoordinator();
Hash getCoordinator();

/**
* @return {@value Descriptions#DONT_VALIDATE_TESTNET_MILESTONE_SIG}
*/
boolean isDontValidateTestnetMilestoneSig();

/**
* Default Value: {@value BaseIotaConfig.Defaults#NUM_KEYS_IN_MILESTONE}
* @return {@value Descriptions#NUMBER_OF_KEYS_IN_A_MILESTONE}
*/
int getNumberOfKeysInMilestone();

/**
* This is a meta-config. Its value depends on {@link #getNumberOfKeysInMilestone()}
* @return the maximal amount of possible milestones that can be issued
*/
int getMaxMilestoneIndex();

/**
* Default Value: {@value BaseIotaConfig.Defaults#COORDINATOR_SECURITY_LEVEL}
* @return {@value Descriptions#COORDINATOR_SECURITY_LEVEL}
*/
int getCoordinatorSecurityLevel();

/**
* Default Value: {@link BaseIotaConfig.Defaults#COORDINATOR_SIGNATURE_MODE}
* @return {@value Descriptions#COORDINATOR_SIGNATURE_MODE}
*/
SpongeFactory.Mode getCoordinatorSignatureMode();

interface Descriptions {

String COORDINATOR = "The address of the coordinator";
String COORDINATOR_SECURITY_LEVEL = "The security level used in coordinator signatures";
String COORDINATOR_SIGNATURE_MODE = "The signature mode used in coordinator signatures";
String DONT_VALIDATE_TESTNET_MILESTONE_SIG = "Disable coordinator validation on testnet";
String NUMBER_OF_KEYS_IN_A_MILESTONE = "The depth of the Merkle tree which in turn determines the number of" +
"leaves (private keys) that the coordinator can use to sign a message.";
}
}
6 changes: 0 additions & 6 deletions src/main/java/com/iota/iri/conf/SnapshotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ public interface SnapshotConfig extends Config {
*/
String getLocalSnapshotsBasePath();

/**
* @return {@value Descriptions#NUMBER_OF_KEYS_IN_A_MILESTONE}
*/
int getNumberOfKeysInMilestone();

/**
* @return {@value Descriptions#PREVIOUS_EPOCH_SPENT_ADDRESSES_FILE}
Expand Down Expand Up @@ -94,8 +90,6 @@ interface Descriptions {
String SNAPSHOT_SIGNATURE_FILE = "Path to the file that contains a signature for the snapshot file.";
String MILESTONE_START_INDEX = "The start index of the milestones. This index is encoded in each milestone " +
"transaction by the coordinator.";
String NUMBER_OF_KEYS_IN_A_MILESTONE = "The depth of the Merkle tree which in turn determines the number of" +
"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.";
Expand Down
75 changes: 58 additions & 17 deletions src/main/java/com/iota/iri/conf/TestnetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.iota.iri.crypto.SpongeFactory;
import com.iota.iri.model.Hash;
import com.iota.iri.model.HashFactory;

import java.util.Objects;

public class TestnetConfig extends BaseIotaConfig {

protected String coordinator = Defaults.COORDINATOR_ADDRESS;
protected Hash coordinator = Defaults.COORDINATOR_ADDRESS;
protected int numberOfKeysInMilestone = Defaults.KEYS_IN_MILESTONE;
protected int maxMilestoneIndex = Defaults.MAX_MILESTONE_INDEX;
protected int coordinatorSecurityLevel = Defaults.COORDINATOR_SECURITY_LEVEL;

protected boolean dontValidateTestnetMilestoneSig = Defaults.DONT_VALIDATE_MILESTONE_SIG;
protected String snapshotFile = Defaults.SNAPSHOT_FILE;
protected String snapshotSignatureFile = Defaults.SNAPSHOT_SIG;
protected long snapshotTime = Defaults.SNAPSHOT_TIME;
protected int mwm = Defaults.MWM;
protected int milestoneStartIndex = Defaults.MILESTONE_START_INDEX;
protected int numberOfKeysInMilestone = Defaults.KEYS_IN_MILESTONE;
protected int transactionPacketSize = Defaults.PACKET_SIZE;
protected int requestHashSize = Defaults.REQUEST_HASH_SIZE;
protected SpongeFactory.Mode coordinatorSignatureMode = Defaults.COORDINATOR_SIGNATURE_MODE;

public TestnetConfig() {
super();
Expand All @@ -32,14 +39,14 @@ public boolean isTestnet() {
}

@Override
public String getCoordinator() {
public Hash getCoordinator() {
return coordinator;
}

@JsonProperty
@Parameter(names = "--testnet-coordinator", description = MilestoneConfig.Descriptions.COORDINATOR)
protected void setCoordinator(String coordinator) {
this.coordinator = coordinator;
this.coordinator = HashFactory.ADDRESS.create(coordinator);
}

@Override
Expand All @@ -53,6 +60,45 @@ protected void setDontValidateTestnetMilestoneSig(boolean dontValidateTestnetMil
this.dontValidateTestnetMilestoneSig = dontValidateTestnetMilestoneSig;
}

@Override
public int getNumberOfKeysInMilestone() {
return numberOfKeysInMilestone;
}

@JsonProperty("NUMBER_OF_KEYS_IN_A_MILESTONE")
@Parameter(names = "--milestone-keys", description = MilestoneConfig.Descriptions.NUMBER_OF_KEYS_IN_A_MILESTONE)
protected void setNumberOfKeysInMilestone(int numberOfKeysInMilestone) {
this.numberOfKeysInMilestone = numberOfKeysInMilestone;
this.maxMilestoneIndex = 1 << numberOfKeysInMilestone;
}

@Override
public int getMaxMilestoneIndex() {
return maxMilestoneIndex;
}

@Override
public int getCoordinatorSecurityLevel() {
return coordinatorSecurityLevel;
}

@JsonProperty("COORDINATOR_SECURITY_LEVEL")
@Parameter(names = "--testnet-coordinator-security-level", description = MilestoneConfig.Descriptions.COORDINATOR_SECURITY_LEVEL)
protected void setCoordinatorSecurityLevel(int coordinatorSecurityLevel) {
this.coordinatorSecurityLevel = coordinatorSecurityLevel;
}

@Override
public SpongeFactory.Mode getCoordinatorSignatureMode() {
return coordinatorSignatureMode;
}

@JsonProperty("COORDINATOR_SIGNATURE_MODE")
@Parameter(names = "--testnet-coordinator-signature-mode", description = MilestoneConfig.Descriptions.COORDINATOR_SIGNATURE_MODE)
protected void setCoordinatorSignatureMode(SpongeFactory.Mode coordinatorSignatureMode) {
this.coordinatorSignatureMode = coordinatorSignatureMode;
}

@Override
public String getSnapshotFile() {
return snapshotFile;
Expand Down Expand Up @@ -108,17 +154,6 @@ protected void setMilestoneStartIndex(int milestoneStartIndex) {
this.milestoneStartIndex = milestoneStartIndex;
}

@Override
public int getNumberOfKeysInMilestone() {
return numberOfKeysInMilestone;
}

@JsonProperty("NUMBER_OF_KEYS_IN_A_MILESTONE")
@Parameter(names = "--milestone-keys", description = SnapshotConfig.Descriptions.NUMBER_OF_KEYS_IN_A_MILESTONE)
protected void setNumberOfKeysInMilestone(int numberOfKeysInMilestone) {
this.numberOfKeysInMilestone = numberOfKeysInMilestone;
}

@Override
public int getTransactionPacketSize() {
return transactionPacketSize;
Expand Down Expand Up @@ -160,18 +195,24 @@ public void setDbLogPath(String dbLogPath) {
}

public interface Defaults {
String COORDINATOR_ADDRESS = "EQQFCZBIHRHWPXKMTOLMYUYPCN9XLMJPYZVFJSAY9FQHCCLWTOLLUGKKMXYFDBOOYFBLBI9WUEILGECYM";
Hash COORDINATOR_ADDRESS = HashFactory.ADDRESS.create(
"EQQFCZBIHRHWPXKMTOLMYUYPCN9XLMJPYZVFJSAY9FQHCCLWTOLLUGKKMXYFDBOOYFBLBI9WUEILGECYM");
boolean DONT_VALIDATE_MILESTONE_SIG = false;
int COORDINATOR_SECURITY_LEVEL = 1;
SpongeFactory.Mode COORDINATOR_SIGNATURE_MODE = SpongeFactory.Mode.CURLP27;
int KEYS_IN_MILESTONE = 22;
int MAX_MILESTONE_INDEX = 1 << KEYS_IN_MILESTONE;

String LOCAL_SNAPSHOTS_BASE_PATH = "testnet";
String SNAPSHOT_FILE = "/snapshotTestnet.txt";
int REQUEST_HASH_SIZE = 49;
String SNAPSHOT_SIG = "/snapshotTestnet.sig";
int SNAPSHOT_TIME = 1522306500;
int MWM = 9;
int MILESTONE_START_INDEX = 434525;
int KEYS_IN_MILESTONE = 22;
int PACKET_SIZE = 1653;
String DB_PATH = "testnetdb";
String DB_LOG_PATH = "testnetdb.log";

}
}
2 changes: 1 addition & 1 deletion src/main/java/com/iota/iri/service/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ private AbstractResponse getNodeInfoStatement() throws Exception{
instance.tipsViewModel.size(),
instance.transactionRequester.numberOfTransactionsToRequest(),
features,
instance.configuration.getCoordinator());
instance.configuration.getCoordinator().toString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.iota.iri.controllers.MilestoneViewModel;
import com.iota.iri.controllers.TransactionViewModel;
import com.iota.iri.crypto.SpongeFactory;
import com.iota.iri.model.Hash;

import java.util.Optional;
Expand Down Expand Up @@ -34,13 +33,11 @@ public interface MilestoneService {
*
* @param transactionViewModel transaction that shall be analyzed
* @param milestoneIndex milestone index of the transaction (see {@link #getMilestoneIndex(TransactionViewModel)})
* @param mode mode that gets used for the signature verification
* @param securityLevel security level that gets used for the signature verification
* @return validity status of the transaction regarding its role as a milestone
* @throws MilestoneException if anything unexpected goes wrong while validating the milestone transaction
*/
MilestoneValidity validateMilestone(TransactionViewModel transactionViewModel, int milestoneIndex,
SpongeFactory.Mode mode, int securityLevel) throws MilestoneException;
MilestoneValidity validateMilestone(TransactionViewModel transactionViewModel, int milestoneIndex)
throws MilestoneException;

/**
* Updates the milestone index of all transactions that belong to a milestone.<br />
Expand Down
Loading

0 comments on commit dc6dd3d

Please sign in to comment.