Skip to content

Commit

Permalink
Merge pull request #315 from LucasMLK/develop
Browse files Browse the repository at this point in the history
upgrade maven dependency
  • Loading branch information
LucasMLK authored May 9, 2024
2 parents 2e96ecf + 0bb7c29 commit c225be0
Show file tree
Hide file tree
Showing 56 changed files with 342 additions and 421 deletions.
103 changes: 43 additions & 60 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,46 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<kotlin.version>1.7.22</kotlin.version>
<kotlin.version>1.8.21</kotlin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<dist.phase>package</dist.phase>
<dist.base>${project.basedir}/dist</dist.base>

<netty.version>4.1.107.Final</netty.version>
<tuweni.version>2.3.1</tuweni.version>
<json.version>2.14.2</json.version>
<kryo.version>5.4.0</kryo.version>
<lombok.version>1.18.26</lombok.version>
<caffeine.version>3.1.5</caffeine.version>
<jline.version>3.25.0</jline.version>
<netty.version>4.1.108.Final</netty.version>
<tuweni.version>2.4.2</tuweni.version>
<jackson.version>2.17.1</jackson.version>
<kryo.version>5.5.0</kryo.version>
<lombok.version>1.18.32</lombok.version>
<caffeine.version>3.1.8</caffeine.version>
<jline.version>3.25.1</jline.version>
<junit.version>4.13.2</junit.version>
<mockito.version>5.2.0</mockito.version>
<mockito.version>5.11.0</mockito.version>
<system-lambda.version>1.2.1</system-lambda.version>
<log4j.version>2.20.0</log4j.version>
<commons-lang3.version>3.13.0</commons-lang3.version>
<commons-collections4.version>4.4</commons-collections4.version>
<commons-codec.version>1.16.0</commons-codec.version>
<commons-io.version>2.13.0</commons-io.version>
<commons-cli.version>1.5.0</commons-cli.version>
<guava.version>32.1.2-jre</guava.version>
<rocksdbjni.version>8.0.0</rocksdbjni.version>
<log4j.version>2.23.1</log4j.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<commons-rng.version>1.5</commons-rng.version>
<commons-collections4.version>4.5.0-M1</commons-collections4.version>
<commons-codec.version>1.17.0</commons-codec.version>
<commons-io.version>2.16.1</commons-io.version>
<commons-cli.version>1.7.0</commons-cli.version>
<guava.version>33.2.0-jre</guava.version>
<rocksdbjni.version>9.1.1</rocksdbjni.version>
<okhttp.version>4.12.0</okhttp.version>
<assertj-core.version>3.24.2</assertj-core.version>
<assertj-core.version>3.25.3</assertj-core.version>
<crypto.version>23.1.3</crypto.version>
<bcprov-jdk18on.version>1.76</bcprov-jdk18on.version>
<bcpkix-jdk18on.version>1.76</bcpkix-jdk18on.version>
<vertx-core.version>4.4.0</vertx-core.version>
<bcprov-jdk18on.version>1.78</bcprov-jdk18on.version>
<bcpkix-jdk18on.version>1.78</bcpkix-jdk18on.version>
<vertx-core.version>4.5.7</vertx-core.version>
<jsonrpc4j.version>1.6</jsonrpc4j.version>
<jaxws-ri.version>4.0.1</jaxws-ri.version>
<config.version>1.4.2</config.version>
<agrona.version>1.17.1</agrona.version>
<jaxws-ri.version>4.0.2</jaxws-ri.version>
<config.version>1.4.3</config.version>
<agrona.version>1.21.1</agrona.version>
<snappy-java.version>1.1.10.4</snappy-java.version>
<druid.version>1.2.18</druid.version>
<mysql-connector.version>8.0.33</mysql-connector.version>
<h2.version>2.2.220</h2.version>
<druid.version>1.2.22</druid.version>
<mysql-connector.version>8.4.0</mysql-connector.version>
<h2.version>2.2.224</h2.version>
<gson.version>2.10</gson.version>
<surefire.test.excludes>**/*RandomXSyncTest.java,**/*SyncTest.java,**/*SnapshotJTest.java</surefire.test.excludes>
</properties>

Expand All @@ -66,26 +68,6 @@
</licenses>

<repositories>
<repository>
<id>bintray</id>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>consensys-maven</id>
<url>https://artifacts.consensys.net/public/maven/maven/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>hyperledger.jfrog.io</id>
<url>https://hyperledger.jfrog.io/artifactory/besu-maven/</url>
Expand Down Expand Up @@ -432,6 +414,12 @@
<version>${commons-collections4.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-rng-simple</artifactId>
<version>${commons-rng.version}</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down Expand Up @@ -619,7 +607,7 @@
</dependency>

<dependency>
<groupId>org.apache.tuweni</groupId>
<groupId>io.tmio</groupId>
<artifactId>tuweni-bytes</artifactId>
<version>${tuweni.version}</version>
<exclusions>
Expand All @@ -635,7 +623,7 @@
</dependency>

<dependency>
<groupId>org.apache.tuweni</groupId>
<groupId>io.tmio</groupId>
<artifactId>tuweni-units</artifactId>
<version>${tuweni.version}</version>
<exclusions>
Expand All @@ -647,7 +635,7 @@
</dependency>

<dependency>
<groupId>org.apache.tuweni</groupId>
<groupId>io.tmio</groupId>
<artifactId>tuweni-io</artifactId>
<version>${tuweni.version}</version>
<exclusions>
Expand Down Expand Up @@ -793,19 +781,19 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${json.version}</version>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${json.version}</version>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${json.version}</version>
<version>${jackson.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.github.briandilley.jsonrpc4j/jsonrpc4j -->
Expand Down Expand Up @@ -901,16 +889,11 @@
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
<version>${gson.version}</version>
<scope>compile</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/xdag/Kernel.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private JsonRpcWeb3ServerHandler getJsonRpcWeb3ServerHandler() {
config.getRPCSpec().getRpcModules()
);
} catch (Exception e) {
log.error("catch an error " + e.getMessage());
log.error("catch an error {}", e.getMessage());
}
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/xdag/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ protected void addOption(Option option) {

/**
* Parses options from the given arguments.
*
* Priority: arguments => system property => console input
*/
protected CommandLine parseOptions(String[] args) throws ParseException {
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/io/xdag/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public class Wallet {
private static final int SALT_LENGTH = 16;
private static final int BCRYPT_COST = 12;
private static final String MNEMONIC_PASS_PHRASE = "";
/**
* -- GETTER --
* Returns the file where the wallet is persisted.
*/
@Getter
private final File file;
private final Config config;

Expand Down Expand Up @@ -123,13 +128,6 @@ public void delete() throws IOException {
Files.delete(file.toPath());
}

/**
* Returns the file where the wallet is persisted.
*/
public File getFile() {
return file;
}

/**
* Locks the wallet.
*/
Expand Down Expand Up @@ -502,7 +500,7 @@ public List<BlockWrapper> createTransactionBlock(Map<Address, KeyPair> ourKeys,
int base = 1 + 1 + 2 + hasRemark;
XAmount amount = XAmount.ZERO;

while (stack.size() > 0) {
while (!stack.isEmpty()) {
Map.Entry<Address, KeyPair> key = stack.peek();
base += 1;
int originSize = keysPerBlock.size();
Expand All @@ -527,7 +525,7 @@ public List<BlockWrapper> createTransactionBlock(Map<Address, KeyPair> ourKeys,
amount = XAmount.ZERO;
}
}
if (keys.size() != 0) {
if (!keys.isEmpty()) {
res.add(createTransaction(to, amount, keys, remark));
}

Expand Down Expand Up @@ -571,12 +569,12 @@ private Block createNewBlock(Map<Address, KeyPair> pairs, List<Address> to,
int defKeyIndex = -1;

// if no input, return null
if (pairs == null || pairs.size() == 0) {
if (pairs == null || pairs.isEmpty()) {
return null;
}

// if no output, return null
if (to == null || to.size() == 0) {
if (to == null || to.isEmpty()) {
return null;
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/xdag/cli/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
import static io.xdag.utils.BasicUtils.*;
import static io.xdag.utils.WalletUtils.*;

@Getter
@Slf4j
public class Commands {

@Getter
private final Kernel kernel;

public Commands(Kernel kernel) {
Expand Down Expand Up @@ -273,7 +273,7 @@ private List<BlockWrapper> createTransactionBlock(Map<Address, KeyPair> ourKeys,
int base = 1 + 1 + 2 + hasRemark;
XAmount amount = XAmount.ZERO;

while (stack.size() > 0) {
while (!stack.isEmpty()) {
Map.Entry<Address, KeyPair> key = stack.peek();
base += 1;
int originSize = keysPerBlock.size();
Expand All @@ -298,7 +298,7 @@ private List<BlockWrapper> createTransactionBlock(Map<Address, KeyPair> ourKeys,
amount = XAmount.ZERO;
}
}
if (keys.size() != 0) {
if (!keys.isEmpty()) {
res.add(createTransaction(to, amount, keys, remark));
}
return res;
Expand Down Expand Up @@ -432,7 +432,7 @@ public String printBlockInfo(Block block, boolean raw) {
StringBuilder inputs = null;
StringBuilder outputs = null;
if (raw) {
if (block.getInputs().size() != 0) {
if (!block.getInputs().isEmpty()) {
inputs = new StringBuilder();
for (Address input : block.getInputs()) {
inputs.append(String.format(" input: %s %s%n",
Expand All @@ -441,7 +441,7 @@ public String printBlockInfo(Block block, boolean raw) {
));
}
}
if (block.getOutputs().size() != 0) {
if (!block.getOutputs().isEmpty()) {
outputs = new StringBuilder();
for (Address output : block.getOutputs()) {
if (output.getType().equals(XDAG_FIELD_COINBASE)) continue;
Expand All @@ -461,7 +461,7 @@ public String printBlockInfo(Block block, boolean raw) {
-----------------------------------------------------------------------------------------------------------------------------
block as address: details
direction address amount time
""";
""";
StringBuilder tx = new StringBuilder();
if (getStateByFlags(block.getInfo().getFlags()).equals(MAIN.getDesc()) && block.getInfo().getHeight() > kernel.getConfig().getSnapshotSpec().getSnapshotHeight()) {
tx.append(String.format(" earn: %s %s %s%n", hash2Address(block.getHashLow()),
Expand Down Expand Up @@ -573,7 +573,7 @@ public String listConnect() {
StringBuilder stringBuilder = new StringBuilder();
for (Channel channel : channelList) {
stringBuilder.append(channel).append(" ")
.append(System.getProperty("line.separator"));
.append(System.lineSeparator());
}

return stringBuilder.toString();
Expand Down Expand Up @@ -627,7 +627,7 @@ public String address(Bytes32 wrap, int page) {
-----------------------------------------------------------------------------------------------------------------------------
histories of address: details
direction address amount time
""";
""";
StringBuilder tx = new StringBuilder();

for (TxHistory txHistory : kernel.getBlockchain().getBlockTxHistoryByAddress(wrap, page)) {
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/io/xdag/cli/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class Shell extends JlineCommandRegistry implements CommandRegistry, Teln
@Setter
private Kernel kernel;
private Commands commands;
@Setter
private LineReader reader;

public Shell() {
Expand Down Expand Up @@ -162,10 +163,6 @@ private void processOldBalance(CommandInput input) {
}
}

public void setReader(LineReader reader) {
this.reader = reader;
}

private void println(final String msg) {
reader.getTerminal().writer().println(msg);
reader.getTerminal().writer().flush();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/xdag/config/AbstractConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class AbstractConfig implements Config, AdminSpec, NodeSpec, WalletSpec,
// Pool websocket spec
// =========================

protected int WebsocketServerPort;
protected int websocketServerPort;

protected int maxShareCountPerChannel = 20;
protected int awardEpoch = 0xf;
Expand Down Expand Up @@ -253,7 +253,7 @@ public void getSetting() {

poolWhiteIPList = config.hasPath("pool.whiteIPs") ? config.getStringList("pool.whiteIPs") : Collections.singletonList("127.0.0.1");
log.info("Pool whitelist {}. Any IP allowed? {}", poolWhiteIPList, poolWhiteIPList.contains("0.0.0.0"));
WebsocketServerPort = config.hasPath("pool.ws.port") ? config.getInt("pool.ws.port") : 7001;
websocketServerPort = config.hasPath("pool.ws.port") ? config.getInt("pool.ws.port") : 7001;
nodeIp = config.hasPath("node.ip") ? config.getString("node.ip") : "127.0.0.1";
nodePort = config.hasPath("node.port") ? config.getInt("node.port") : 8001;
nodeTag = config.hasPath("node.tag") ? config.getString("node.tag") : "xdagj";
Expand Down Expand Up @@ -393,7 +393,7 @@ public List<String> getPoolWhiteIPList() {

@Override
public int getWebsocketServerPort() {
return WebsocketServerPort;
return websocketServerPort;
}


Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/xdag/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class Constants {
public static final byte BI_EXTRA = 0x40;
public static final byte BI_REMARK = (byte) 0x80;
public static final Long SEND_PERIOD = 10L;
public static final int DNET_PKT_XDAG = 0x8B;

public static final long REQUEST_BLOCKS_MAX_TIME = UInt64.valueOf(1L << 20).toLong();
public static final long REQUEST_WAIT = 64;
Expand Down
Loading

0 comments on commit c225be0

Please sign in to comment.