Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f4812ba
TransactionRequesterWorkerImpl refactoring
Jun 15, 2019
c23ee53
javadoc was updated
Jun 15, 2019
414e590
new util functions were added
Jun 15, 2019
0789f07
building a transaction from bytes was added
Jun 15, 2019
2f81247
TangleMockUtils was added
Jun 16, 2019
1a76844
test for TransactionRequesterWorkerImpl
Jun 16, 2019
065e419
Merge branch 'dev' into dev-pow
oracle58 Jun 16, 2019
696828b
Merge pull request #72 from HelixNetwork/dev-pow
oracle58 Jun 16, 2019
f6d62e3
Update changelog
oracle58 Jun 16, 2019
60ed4e1
update README.md
oracle58 Jun 16, 2019
8a324fd
bump version
oracle58 Jun 16, 2019
a2e4352
Added missing import
oracle58 Jun 16, 2019
076530e
Check that remoteAuth isn't null (#74)
oracle58 Jun 16, 2019
dc41f7b
test for RestEasy server
Jun 17, 2019
08df03b
Merge pull request #75 from HelixNetwork/dev-pow
oracle58 Jun 17, 2019
9ace650
Change defaults for base config
oracle58 Jun 17, 2019
0cb3348
Change defaults for testnet config
oracle58 Jun 17, 2019
487f5ab
Change values in test config
oracle58 Jun 17, 2019
049c4f5
cleanup
oracle58 Jun 17, 2019
f6f2d1d
Added code coverage plugin
oracle58 Jun 17, 2019
4d98d2e
Added codecov to ci
oracle58 Jun 17, 2019
0106107
Added badges
oracle58 Jun 17, 2019
f614c54
use jacoco as report for codecov
oracle58 Jun 18, 2019
97b79c8
Fix badge link
oracle58 Jun 18, 2019
f6b56f7
Added matrix chat badge
oracle58 Jun 18, 2019
f1ce5b8
Added code quality badge and fixes to readme
oracle58 Jun 18, 2019
3a65b03
Added custom deserializers to ConfigFactory
oracle58 Jun 18, 2019
73b1083
Added ipc/tcp getters to ZMQConfig
oracle58 Jun 18, 2019
b7a1193
Added parameters for zmq ipc/tcp
oracle58 Jun 18, 2019
3a592d7
Unit test for ConfigFactory
oracle58 Jun 18, 2019
3418caf
Unit test for ZMQConfig
oracle58 Jun 18, 2019
b5e12b2
Update changelog
oracle58 Jun 18, 2019
ae0200c
Fix and cleanup ConfigTest
oracle58 Jun 18, 2019
f56aaef
Add discord badge
oracle58 Jun 18, 2019
63ec72f
Fix matrix badge
oracle58 Jun 18, 2019
4a172e7
Fix matrix badge2
oracle58 Jun 18, 2019
d845876
Properly link to riot.im
oracle58 Jun 18, 2019
4ad683c
Comment matrix badge, as unresponsiveness leads to long loadup times …
oracle58 Jun 18, 2019
9256712
Pass token using flag - Test
oracle58 Jun 18, 2019
6b2f35e
Pass token using yml - Test2
oracle58 Jun 18, 2019
d407276
Pass token using yml - Test3
oracle58 Jun 18, 2019
ec9ef31
Pass token using -t diff syntax - Test4
oracle58 Jun 18, 2019
4b7ff90
Pass as env parameter Test5
oracle58 Jun 18, 2019
6dda9f4
generate new token
oracle58 Jun 18, 2019
98572fe
Try flag again without colon Test6
oracle58 Jun 18, 2019
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: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ matrix:
fast_finish: true

script:
# run tests and integration tests
# run tests
# see https://stackoverflow.com/questions/34405047/how-do-you-merge-into-another-branch-using-travis-with-git-commands?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
- build_head=$(git rev-parse HEAD)
- git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
Expand All @@ -38,6 +38,9 @@ script:
- VERSION=$(mvn help:evaluate -Dexpression=project.version | grep -E '^[0-9.]+')
- echo $VERSION

after_success:
- bash <(curl -s https://codecov.io/bash) -t 84b2530c-63d2-4e67-9aec-fabf6d7ccbde

notifications:
webhooks:
urls:
Expand Down
8 changes: 8 additions & 0 deletions changelog.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.5.6
- TransactionRequesterWorkerImpl refactoring
- Added New util functions
- Added build tx from bytes
- Added TangleMockUtils
- Added Test for TransactionRequesterWorkerImpl
- Updated ConfigFactory and added corresponding unit tests

# 0.5.5
- Added Unit Tests:
- NodeTest
Expand Down
387 changes: 58 additions & 329 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>net.helix</groupId>
<artifactId>helix</artifactId>
<version>0.5.5</version>
<version>0.5.6</version>

<name>Helix</name>
<description>Helix-1.0</description>
Expand Down Expand Up @@ -339,7 +339,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<version>0.8.4</version>
<executions>
<execution>
<goals>
Expand All @@ -348,7 +348,7 @@
</execution>
<execution>
<id>report</id>
<phase>integration-test</phase>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
Expand Down
18 changes: 3 additions & 15 deletions src/main/java/net/helix/hlx/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public static void main(String[] args) {
}

public static String[] bytesToBitStrings(byte[] bytes) {
String[] bytestring = new String[bytes.length];
String[] byteString = new String[bytes.length];
for (int i = 0; i < bytes.length; i++) {
String bits = String.format("%8s", Integer.toBinaryString(bytes[i] & 0xFF)).replace(' ', '0');
bytestring[i] = bits;
byteString[i] = bits;
}
return bytestring;
return byteString;
}

public static byte[] bitsToBytes(String[] bits){
Expand All @@ -26,16 +26,4 @@ public static byte[] bitsToBytes(String[] bits){
}
return bytes;
}

public static long bytesToLong(byte[] array, int offset) {
return
((long)(array[offset] & 0xff) << 56) |
((long)(array[offset+1] & 0xff) << 48) |
((long)(array[offset+2] & 0xff) << 40) |
((long)(array[offset+3] & 0xff) << 32) |
((long)(array[offset+4] & 0xff) << 24) |
((long)(array[offset+5] & 0xff) << 16) |
((long)(array[offset+6] & 0xff) << 8) |
((long)(array[offset+7] & 0xff));
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/helix/hlx/HLX.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class HLX {

public static final String MAINNET_NAME = "HLX";
public static final String TESTNET_NAME = "HLX Testnet";
public static final String VERSION = "0.5.5";
public static final String VERSION = "0.5.6";

/**
* The entry point of the helix sandbox.
Expand Down
61 changes: 52 additions & 9 deletions src/main/java/net/helix/hlx/conf/BaseHelixConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,19 @@ public abstract class BaseHelixConfig implements HelixConfig {
protected double pPropagateRequest = Defaults.P_PROPAGATE_REQUEST;

//ZMQ
protected boolean zmqEnabled = Defaults.ZMQ_ENABLED;
protected boolean zmqEnableTcp = Defaults.ZMQ_ENABLE_TCP;
protected boolean zmqEnableIpc = Defaults.ZMQ_ENABLE_IPC;
protected int zmqPort = Defaults.ZMQ_PORT;
protected int zmqThreads = Defaults.ZMQ_THREADS;
protected String zmqIpc = Defaults.ZMQ_IPC;
protected int qSizeNode = Defaults.QUEUE_SIZE;
protected int cacheSizeBytes = Defaults.CACHE_SIZE_BYTES;
/**
* @deprecated This field was replaced by {@link #zmqEnableTcp} and {@link #zmqEnableIpc}. It is only needed
* for backward compatibility to --zmq-enabled parameter with JCommander.
*/
@Deprecated
private boolean zmqEnabled;

//Graphstream
protected boolean graphEnabled = Defaults.GRAPH_ENABLED;
Expand Down Expand Up @@ -611,15 +618,48 @@ public int getNumberOfKeysInMilestone() {
return Defaults.NUM_KEYS_IN_MILESTONE;
}

/**
* Checks if ZMQ is enabled.
* @return true if zmqEnableTcp or zmqEnableIpc is set.
*/
@Override
public boolean isZmqEnabled() {
return zmqEnabled;
return zmqEnableTcp || zmqEnableIpc;
}

/**
* Activates ZMQ to listen on TCP and IPC.
* @deprecated Use {@link #setZmqEnableTcp(boolean) and/or {@link #setZmqEnableIpc(boolean)}} instead.
* @param zmqEnabled true if ZMQ should listen in TCP and IPC.
*/
@Deprecated
@JsonProperty
@Parameter(names = "--zmq-enabled", description = ZMQConfig.Descriptions.ZMQ_ENABLED)
@Parameter(names = "--zmq-enabled", description = ZMQConfig.Descriptions.ZMQ_ENABLED, arity = 1)
protected void setZmqEnabled(boolean zmqEnabled) {
this.zmqEnabled = zmqEnabled;
this.zmqEnableTcp = zmqEnabled;
this.zmqEnableIpc = zmqEnabled;
}

@Override
public boolean isZmqEnableTcp() {
return zmqEnableTcp;
}

@JsonProperty
@Parameter(names = "--zmq-enable-tcp", description = ZMQConfig.Descriptions.ZMQ_ENABLE_TCP, arity = 1)
public void setZmqEnableTcp(boolean zmqEnableTcp) {
this.zmqEnableTcp = zmqEnableTcp;
}

@Override
public boolean isZmqEnableIpc() {
return zmqEnableIpc;
}

@JsonProperty
@Parameter(names = "--zmq-enable-ipc", description = ZMQConfig.Descriptions.ZMQ_ENABLE_IPC, arity = 1)
public void setZmqEnableIpc(boolean zmqEnableIpc) {
this.zmqEnableIpc = zmqEnableIpc;
}

@Override
Expand All @@ -631,6 +671,7 @@ public int getZmqPort() {
@Parameter(names = "--zmq-port", description = ZMQConfig.Descriptions.ZMQ_PORT)
protected void setZmqPort(int zmqPort) {
this.zmqPort = zmqPort;
this.zmqEnableTcp = true;
}

@Override
Expand All @@ -639,7 +680,7 @@ public int getZmqThreads() {
}

@JsonProperty
@Parameter(names = "--zmq-threads", description = ZMQConfig.Descriptions.ZMQ_PORT)
@Parameter(names = "--zmq-threads", description = ZMQConfig.Descriptions.ZMQ_THREADS)
protected void setZmqThreads(int zmqThreads) {
this.zmqThreads = zmqThreads;
}
Expand All @@ -653,6 +694,7 @@ public String getZmqIpc() {
@Parameter(names = "--zmq-ipc", description = ZMQConfig.Descriptions.ZMQ_IPC)
protected void setZmqIpc(String zmqIpc) {
this.zmqIpc = zmqIpc;
this.zmqEnableIpc = true;
}

@Override
Expand Down Expand Up @@ -816,7 +858,7 @@ public int getSpamDelay() {

public interface Defaults {
//API
int API_PORT = 14700;
int API_PORT = 8085;
String API_HOST = "localhost";
List<String> REMOTE_LIMIT_API = HelixUtils.createImmutableList(); // "addNeighbors", "getNeighbors", "removeNeighbors", "attachToTangle", "interruptAttachingToTangle" <- TODO: limit these in production!
InetAddress REMOTE_LIMIT_API_DEFAULT_HOST = InetAddress.getLoopbackAddress();
Expand All @@ -829,8 +871,8 @@ public interface Defaults {
boolean IS_POW_DISABLED = false;

//Network
int UDP_RECEIVER_PORT = 14600;
int TCP_RECEIVER_PORT = 15600;
int UDP_RECEIVER_PORT = 4100;
int TCP_RECEIVER_PORT = 5100;
double P_REMOVE_REQUEST = 0.01d;
int SEND_LIMIT = -1;
int MAX_PEERS = 0;
Expand Down Expand Up @@ -863,8 +905,9 @@ public interface Defaults {

//Zmq
int ZMQ_THREADS = 1;
boolean ZMQ_ENABLE_IPC = false;
String ZMQ_IPC = "ipc://hlx";
boolean ZMQ_ENABLED = false;
boolean ZMQ_ENABLE_TCP = false;
int ZMQ_PORT = 5556;

//Graphstream
Expand Down
28 changes: 26 additions & 2 deletions src/main/java/net/helix/hlx/conf/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.module.SimpleModule;
import net.helix.hlx.conf.deserializers.CustomBoolDeserializer;
import net.helix.hlx.conf.deserializers.CustomStringDeserializer;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -21,9 +24,20 @@ public static HelixConfig createHelixConfig(boolean isTestnet) {
}
return helixConfig;
}
public static HelixConfig createFromFile(File configFile, boolean testnet) throws IOException,
IllegalArgumentException {
/**
* Creates the {@link HelixConfig} 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 HelixConfig} configuration.
*
* @throws IOException When config file could not be found.
*/
public static HelixConfig createFromFile(File configFile, boolean testnet) throws IOException {
HelixConfig helixConfig;

try (FileInputStream confStream = new FileInputStream(configFile)) {
Properties props = new Properties();
props.load(confStream);
Expand All @@ -33,7 +47,17 @@ public static HelixConfig createFromFile(File configFile, boolean testnet) throw
objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true);
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);

SimpleModule booleanParser = new SimpleModule("BooleanParser");
booleanParser.addDeserializer(Boolean.TYPE, new CustomBoolDeserializer());
objectMapper.registerModule(booleanParser);

SimpleModule stringParser = new SimpleModule("StringParser");
stringParser.addDeserializer(String.class, new CustomStringDeserializer());
objectMapper.registerModule(stringParser);

helixConfig = objectMapper.convertValue(props, helixConfigClass);
}
return helixConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/helix/hlx/conf/TestnetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public interface Defaults {
int MWM = 1;
int MILESTONE_START_INDEX = 0;
int KEYS_IN_MILESTONE = 10;
int PACKET_SIZE = 1200;
int PACKET_SIZE = 800;
String DB_PATH = "testnetdb";
String DB_LOG_PATH = "testnetdb.log";
}
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/net/helix/hlx/conf/ZMQConfig.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
package net.helix.hlx.conf;

public interface ZMQConfig extends Config {
/**
* @return Descriptions#ZMQ_ENABLED
*/
boolean isZmqEnabled();

/**
* @return Descriptions#ZMQ_ENABLE_TCP
*/
boolean isZmqEnableTcp();

/**
* @return Descriptions#ZMQ_ENABLE_IPC
*/
boolean isZmqEnableIpc();

/**
* @return Descriptions#ZMQ_PORT
*/
int getZmqPort();

/**
* @return Descriptions#ZMQ_THREADS
*/
int getZmqThreads();

/**
* @return Descriptions#ZMQ_IPC
*/
String getZmqIpc();

interface Descriptions {
String ZMQ_ENABLED = "Enabling zmq channels.";
String ZMQ_PORT = "The port used to connect to the ZMQ feed";
String ZMQ_IPC = "The path that is used to communicate with ZMQ in IPC";
String ZMQ_ENABLED = "Enable zmq channels (deprecated). Use --zmq-enable-tcp or --zmq-enable-ipc instead";
String ZMQ_ENABLE_TCP = "Enable zmq channels on tcp port 5556. Use --zmq-port=[PORT] to override.";
String ZMQ_ENABLE_IPC = "Enable zmq channels on ipc://iri. Use --zmq-ipc=[SOCKET] to override.";
String ZMQ_THREADS = "The threads used by ZMQ publisher";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Created by paul on 5/15/17.
*/


/**
* The ApproveeViewModel class is an implementation of the <code> HashesViewModel </code> interface.
* It consists of an <code> Indexable </code> transaction hash and the Approvee model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* Created by paul on 5/15/17.
*/


/**
* The BundleViewModel class is an implementation of the <code> HashesViewModel </code> interface.
* It consists of an <code> Indexable </code> bundle hash and the Bundle model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public static MilestoneViewModel latest(Tangle tangle) throws Exception {
return null;
}


/**
* Fetches the previously indexed persistable {@link Milestone} object from the database and generates a new
* {@link MilestoneViewModel} from it. If no {@link Milestone} objects exist in the database, it will return null.
Expand Down
Loading