Skip to content

Commit

Permalink
Merge pull request #840 from kyonRay/master
Browse files Browse the repository at this point in the history
Release v3.7.0
  • Loading branch information
kyonRay authored Mar 25, 2024
2 parents 3c7f8e2 + a099c4d commit 891b889
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 50 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ googleJavaFormat {
include '**/*.java'
}

def log4j_version = '2.19.0'
def log4j_version = '2.22.1'
List logger = [
"org.apache.logging.log4j:log4j-api:$log4j_version",
"org.apache.logging.log4j:log4j-core:$log4j_version",
Expand All @@ -42,7 +42,7 @@ dependencies {
//implementation 'org.fisco-bcos:solcJ:0.5.2.1'
implementation 'org.fisco-bcos:solcJ:0.8.11.1'

implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.6.0') {
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.7.0-SNAPSHOT') {
exclude group: "org.slf4j"
}

Expand All @@ -53,7 +53,7 @@ dependencies {
implementation('org.jline:jline:3.21.0')
implementation('io.bretty:console-table-builder:1.2')
implementation('com.github.jsqlparser:jsqlparser:2.0')
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.3.0') {
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.5.0-SNAPSHOT') {
exclude group: "org.fisco-bcos.java-sdk"
exclude group: "org.slf4j"
}
Expand Down
2 changes: 1 addition & 1 deletion release_note.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.6.0
v3.7.0
18 changes: 18 additions & 0 deletions src/main/java/console/ConsoleInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class ConsoleInitializer {
private LineReader lineReader;
private boolean useV1TxService;

// v2 transaction extension
private byte[] extension;

public LineReader getLineReader() {
return lineReader;
}
Expand All @@ -73,11 +76,20 @@ public void init(String[] args) throws ConfigException {

if (args.length > 3 && "-v1".equals(args[3])) {
// use v1 transaction service
logger.info("use v1 transaction service");
useV1TxService = true;
}
if (args.length > 3 && "-v2".equals(args[3])) {
logger.info("use v2 transaction service");
useV1TxService = true;
extension = args.length > 4 ? args[4].getBytes() : null;
}
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
}
Expand Down Expand Up @@ -284,6 +296,9 @@ public void switchGroup(String[] params) {
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
JlineUtils.switchGroup(client);
Expand Down Expand Up @@ -358,6 +373,9 @@ public void loadAccount(String[] params) {
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
System.out.println("Load account " + params[1] + " success!");
Expand Down
84 changes: 42 additions & 42 deletions src/main/java/console/command/JlineUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfo;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfoList;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigFeature;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService;
import org.fisco.bcos.sdk.v3.model.EnumNodeVersion;
Expand Down Expand Up @@ -183,50 +188,45 @@ private static List<Completer> generateComplters(Client client) {
if (client.isEnableCommittee()) {
commands.add(AuthOpCommand.SET_SYS_CONFIG_PROPOSAL.getCommand());
}
Set<String> keys = new HashSet<>();
keys.add(SystemConfigService.TX_COUNT_LIMIT);
keys.add(SystemConfigService.TX_GAS_LIMIT);
keys.add(SystemConfigService.TX_GAS_PRICE);
keys.add(SystemConfigService.CONSENSUS_PERIOD);
keys.add(SystemConfigService.COMPATIBILITY_VERSION);
keys.add(SystemConfigService.AUTH_STATUS);
for (SystemConfigFeature.Features feature : SystemConfigFeature.Features.values()) {
if (client.getChainCompatibilityVersion()
.compareTo(EnumNodeVersion.convertToVersion(feature.enableVersion()))
>= 0) {
keys.add(feature.toString());
}
}
BcosGroupInfoList groupInfoList;
try {
groupInfoList = client.getGroupInfoList();
Optional<BcosGroupInfo.GroupInfo> group =
groupInfoList
.getResult()
.stream()
.filter(groupInfo -> groupInfo.getGroupID().equals(client.getGroup()))
.findFirst();
if (group.isPresent() && !group.get().getNodeList().isEmpty()) {
group.get()
.getNodeList()
.forEach(groupNodeInfo -> keys.addAll(groupNodeInfo.getFeatureKeys()));
}
} catch (Exception ignored) {
logger.info("Failed to get group info list, skip feature keys.");
}

for (String command : commands) {
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.TX_COUNT_LIMIT),
new StringsCompleterIgnoreCase()));

completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.TX_GAS_LIMIT),
new StringsCompleterIgnoreCase()));
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.TX_GAS_PRICE),
new StringsCompleterIgnoreCase()));
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.CONSENSUS_PERIOD),
new StringsCompleterIgnoreCase()));
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.COMPATIBILITY_VERSION),
new StringsCompleterIgnoreCase()));
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(SystemConfigService.AUTH_STATUS),
new StringsCompleterIgnoreCase()));
for (SystemConfigFeature.Features feature : SystemConfigFeature.Features.values()) {
if (client.getChainCompatibilityVersion()
.compareTo(
EnumNodeVersion.convertToVersion(feature.enableVersion()))
>= 0) {
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(feature.toString()),
new StringsCompleterIgnoreCase()));
}
for (String key : keys) {
completers.add(
new ArgumentCompleter(
new StringsCompleter(command),
new StringsCompleter(key),
new StringsCompleterIgnoreCase()));
}
}
completers.add(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/console/common/ConsoleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public static void main(String[] args) {
"t",
TRANSACTION_VERSION,
true,
"[Optional] Specify transaction version interface, default is 0; If you want to use the latest transaction interface, please specify 1.");
"[Optional] Specify transaction version interface, default is 0; Supporting {0,1,2}; If you want to use the latest transaction interface, please specify 2.");
transactionVersion.setRequired(false);
options.addOption(transactionVersion);
if (mode.equals("solidity")) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/console/common/ConsoleVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ConsoleVersion {

public static final String Version = "3.6.0";
public static final String Version = "3.7.0";

public static void main(String[] args) {
System.out.println("console version: " + Version);
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/console/contract/ConsoleContractImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class ConsoleContractImpl implements ConsoleContractFace {
private AssembleTransactionService assembleTransactionService = null;
private final TransferTransactionService transferTransactionService;
private final BFSService bfsService;

private byte[] extension = null;
private boolean useTransactionV1 = false;

public ConsoleContractImpl(Client client) {
Expand Down Expand Up @@ -117,6 +117,10 @@ public ConsoleContractImpl(Client client, boolean useTransactionV1) {
}
}

public void setExtension(byte[] extension) {
this.extension = extension;
}

@Override
public void deploy(String[] params, String pwd) throws Exception {
List<String> paramsList = new ArrayList<>(Arrays.asList(params));
Expand Down Expand Up @@ -268,6 +272,7 @@ public TransactionResponse deploySolidity(
if (useTransactionV1) {
DeployTransactionRequestWithStringParams request =
new TransactionRequestBuilder(abiAndBin.getAbi(), bin)
.setExtension(extension)
.buildDeployStringParamsRequest(tempInputParams);
response = assembleTransactionService.deployContract(request);
} else {
Expand Down Expand Up @@ -333,6 +338,7 @@ public TransactionResponse deployWasm(
DeployTransactionRequestWithStringParams request =
new TransactionRequestBuilder(abi, binStr)
.setTo(path)
.setExtension(extension)
.buildDeployStringParamsRequest(inputParams);
response = assembleTransactionService.deployContract(request);
} else {
Expand Down Expand Up @@ -768,6 +774,7 @@ private void sendTransaction(
if (useTransactionV1) {
TransactionRequestWithStringParams request =
new TransactionRequestBuilder(abiAndBin.getAbi(), functionName, contractAddress)
.setExtension(extension)
.buildStringParamsRequest(callParams);
response = assembleTransactionService.sendTransaction(request);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tools/download_console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package_name="console.tar.gz"
solcj_name=""
solcj_default_version="solcJ-0.8.11.1.jar"
only_solc_flag=""
default_version="3.6.0"
default_version="3.7.0"
download_version="${default_version}"
solc_download_version="3.0.0"
specify_console=0
Expand Down

0 comments on commit 891b889

Please sign in to comment.