Skip to content

Commit

Permalink
Merge pull request #857 from kyonRay/master
Browse files Browse the repository at this point in the history
<sync>(code): sync code from release-3.8.0
  • Loading branch information
kyonRay authored Sep 6, 2024
2 parents 5e0f36d + 69c107d commit ca6e7f4
Show file tree
Hide file tree
Showing 56 changed files with 1,397 additions and 181 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ jobs:
- run:
name: Setup dependencies
command: |
yum install -y epel-release centos-release-scl which python python-devel
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update -y
yum install -y git openssl-devel openssl java java-devel
- checkout
- run:
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
container: docker.io/centos:7
os: [ ubuntu-20.04 ]
container: docker.io/centos:latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- name: install CentOS dependencies
run: yum install -y epel-release centos-release-scl which git openssl-devel openssl wget
run: |
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update -y
yum install -y which git openssl-devel openssl wget
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
Expand All @@ -60,4 +65,4 @@ jobs:
- name: run integration testing
run: /bin/bash -x .ci/ci_check.sh
- name: upload coverage
run: curl -LO https://codecov.io/bash && /bin/bash ./bash
run: curl -LO https://codecov.io/bash && /bin/bash ./bash
40 changes: 30 additions & 10 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
## v3.8.0

(2024-08-20)

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

- 在编译合约时支持解析所有依赖合约,并合并成同一份合约文件。详情见:[#853](https://github.com/FISCO-BCOS/console/pull/853)
- 新增在部署合约时指定编译器版本的功能,支持 `deploy` 命令后使用 `-v` 或者 `--sol-version` 参数指定编译器版本编译合约。详情见:[#846](https://github.com/FISCO-BCOS/console/pull/846)
- 新增 `listSystemConfigs` 命令,可以查看链上所有系统配置项。详情见:[#848](https://github.com/FISCO-BCOS/console/pull/848)
- 新增 `getLatestBlock` 命令,可以查看链上最新的区块信息。详情见:[#848](https://github.com/FISCO-BCOS/console/pull/848)
- 新增Solidity `0.8.26` 版本的支持,提供示例合约。详情见:[#851](https://github.com/FISCO-BCOS/console/pull/851)

### 更新

- 更新 `code-generator``1.6.0` 版本,以支持根据Solidity合约中devdoc和userdoc生成Java接口注释,解决合约接口返回struct类型时生成Java接口文件的问题。

## v3.7.0

(2024-03-25)

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -38,7 +58,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -74,7 +94,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -107,7 +127,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 更新

Expand All @@ -129,7 +149,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -165,7 +185,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -194,7 +214,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand All @@ -210,7 +230,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -239,7 +259,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down Expand Up @@ -267,7 +287,7 @@

请阅读控制台 v3.x+文档:

- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh_CN/latest/docs/develop/console/index.html)
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)

### 新增

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ dependencies {
//implementation 'org.fisco-bcos:solcJ:0.4.25.1'
//implementation 'org.fisco-bcos:solcJ:0.6.10.1'
//implementation 'org.fisco-bcos:solcJ:0.5.2.1'
implementation 'org.fisco-bcos:solcJ:0.8.11.1'
implementation 'org.fisco-bcos:solcJ:1.0.0-SNAPSHOT'

implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.7.0') {
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.8.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.5.0') {
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.6.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.7.0
v3.8.0
4 changes: 4 additions & 0 deletions src/main/java/console/client/ConsoleClientFace.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface ConsoleClientFace {

void getBlockByNumber(String[] params) throws IOException;

void getLatestBlock(String[] params) throws IOException;

void getBlockHeaderByHash(String[] params) throws IOException;

void getBlockHashByNumber(String[] params) throws IOException;
Expand All @@ -50,6 +52,8 @@ public interface ConsoleClientFace {

void getSystemConfigByKey(String[] params) throws Exception;

void listConfigs(String[] params) throws Exception;

void newAccount(String[] params);

void listAccount(String[] params);
Expand Down
64 changes: 60 additions & 4 deletions src/main/java/console/client/ConsoleClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.client.exceptions.ClientException;
import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse;
Expand Down Expand Up @@ -148,10 +152,29 @@ public void getBlockByNumber(String[] params) throws IOException {
if (blockByNumber.getBlock() == null) {
System.out.println("Block not found, please check number: " + blockNumber);
} else {
ConsoleUtils.printJson(
client.getBlockByNumber(BigInteger.valueOf(blockNumber), false, flag)
.getBlock()
.toString());
ConsoleUtils.printJson(blockByNumber.getBlock().toString());
}
}

@Override
public void getLatestBlock(String[] params) throws IOException {
boolean flag = false;
if (params.length == 2) {
if ("true".equals(params[1])) {
flag = true;
} else if ("false".equals(params[1])) {
flag = false;
} else {
System.out.println("Please provide true or false for the second parameter.");
return;
}
}
BigInteger blockNumber = client.getBlockNumber().getBlockNumber();
BcosBlock block = client.getBlockByNumber(blockNumber, false, flag);
if (block.getBlock() == null) {
System.out.println("Block not found, please check number: " + blockNumber);
} else {
ConsoleUtils.printJson(block.getBlock().toString());
}
}

Expand Down Expand Up @@ -326,6 +349,39 @@ public void getSystemConfigByKey(String[] params) throws Exception {
}
}

@Override
public void listConfigs(String[] params) throws Exception {
Map<String, Optional<SystemConfig>> systemConfigList = client.getSystemConfigList();
int longestKeySize = 0;
for (String key : systemConfigList.keySet()) {
if (key.length() > longestKeySize) {
longestKeySize = key.length();
}
}
String leftAlignFormat = "| %-" + longestKeySize + "s | %-14s | %-12s |%n";
String separatorLine =
Stream.generate(() -> "-").limit(longestKeySize + 2).collect(Collectors.joining());
String adaptableTitle =
"| Config"
+ Stream.generate(() -> " ")
.limit(longestKeySize - "Config".length())
.collect(Collectors.joining());
System.out.println("+" + separatorLine + "+----------------+--------------+");
System.out.println(adaptableTitle + " | Value | Enable Block |");
System.out.println("+" + separatorLine + "+----------------+--------------+");
systemConfigList.forEach(
(key, value) -> {
String configValue = "null";
long blockNumber = 0;
if (value.isPresent()) {
configValue = value.get().getSystemConfig().getValue();
blockNumber = value.get().getSystemConfig().getBlockNumber();
}
System.out.format(leftAlignFormat, key, configValue, blockNumber);
});
System.out.println("+" + separatorLine + "+----------------+--------------+");
}

@Override
public void newAccount(String[] params) {
String accountFormat = "pem";
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/console/command/category/StatusQueryCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ public Map<String, CommandInfo> getAllCommandInfo(boolean isWasm) {
(consoleInitializer, params, pwd) ->
consoleInitializer.getConsoleClientFace().getBlockNumber(params));

public static final CommandInfo GET_LATEST_BLOCK =
new CommandInfo(
"getLatestBlock",
"Query the latest block",
HelpInfo::getLatestBlockHelp,
(consoleInitializer, params, pwd) ->
consoleInitializer.getConsoleClientFace().getLatestBlock(params),
0,
1);

public static final CommandInfo GET_BLOCK_HASH_BY_NUMBER =
new CommandInfo(
"getBlockHashByNumber",
Expand Down Expand Up @@ -203,6 +213,16 @@ public Map<String, CommandInfo> getAllCommandInfo(boolean isWasm) {
1,
1);

public static final CommandInfo LIST_CONFIGS =
new CommandInfo(
"listSystemConfigs",
"List all support system configs",
HelpInfo::listSystemConfigsHelp,
(consoleInitializer, params, pwd) ->
consoleInitializer.getConsoleClientFace().listConfigs(params),
0,
0);

static {
Field[] fields = StatusQueryCommand.class.getDeclaredFields();
for (Field field : fields) {
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/console/command/model/HelpInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ public static void getBlockByNumberHelp() {
"* boolean -- (optional) If true it returns only the hashes of the transactions, if false then return the full transaction objects.");
}

public static void getLatestBlockHelp() {
System.out.println("Query the latest block.");
System.out.println("Usage: \ngetLatestBlock [boolean]");
System.out.println(
"* boolean -- (optional) If true it returns only the hashes of the transactions, if false then return the full transaction objects.");
}

public static void getBlockHeaderByHashHelp() {
System.out.println("Query information about a block header by hash.");
System.out.println("Usage: \ngetBlockHeaderByHash blockHash [boolean]");
Expand Down Expand Up @@ -227,7 +234,7 @@ public static void deployHelp(boolean isWasm) {
System.out.println(
"Deploy a " + "\033[32m" + "Solidity" + "\033[m" + " contract on blockchain.");
System.out.println(
"Usage: \ndeploy contractNameOrPath parameters... [--parallel-analysis/-p]");
"Usage: \ndeploy contractNameOrPath parameters... [--parallel-analysis/-p --sol-version/-v 0.8.11]");
System.out.println(
"* contractNameOrPath -- The name of a contract or the path of a contract (Default load contract from the \"contracts/solidity\" path when using contractName).");
System.out.println(
Expand All @@ -237,6 +244,8 @@ public static void deployHelp(boolean isWasm) {
+ " link must locate under '/apps', and be composed of contract name and version ");
System.out.println(
"* --parallel-analysis/-p[Optional] -- parallel conflict analysis with the contract, default: no.");
System.out.println(
"* --sol-version/-v[Optional] -- The version of solidity compiler supported 0.4.25, 0.5.2, 0.6.10, 0.8.11, default is 0.8.11.");
} else {
System.out.println(
"Deploy a " + "\033[32m" + "Liquid" + "\033[m" + " contract on blockchain.");
Expand Down Expand Up @@ -417,6 +426,11 @@ public static void getSystemConfigByKeyHelp() {
" -- supported keys: " + String.join(",", Common.SUPPORTED_SYSTEM_KEYS));
}

public static void listSystemConfigsHelp() {
System.out.println("List all support system configs.");
System.out.println("Usage: \nlistSystemConfigs ");
}

public static void operateGroupHelp(String command, String operator) {
System.out.println("Usage: \n" + command + " endPoint groupId");
System.out.println(
Expand Down
Loading

0 comments on commit ca6e7f4

Please sign in to comment.