Skip to content

Commit ca6e7f4

Browse files
authored
Merge pull request #857 from kyonRay/master
<sync>(code): sync code from release-3.8.0
2 parents 5e0f36d + 69c107d commit ca6e7f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1397
-181
lines changed

.circleci/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ jobs:
1010
- run:
1111
name: Setup dependencies
1212
command: |
13-
yum install -y epel-release centos-release-scl which python python-devel
13+
cd /etc/yum.repos.d/
14+
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
15+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
16+
yum update -y
1417
yum install -y git openssl-devel openssl java java-devel
1518
- checkout
1619
- run:

.github/workflows/workflow.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ jobs:
4444
strategy:
4545
fail-fast: false
4646
matrix:
47-
os: [ubuntu-20.04]
48-
container: docker.io/centos:7
47+
os: [ ubuntu-20.04 ]
48+
container: docker.io/centos:latest
4949
steps:
5050
- uses: actions/checkout@v2
5151
with:
5252
fetch-depth: 5
5353
- name: install CentOS dependencies
54-
run: yum install -y epel-release centos-release-scl which git openssl-devel openssl wget
54+
run: |
55+
cd /etc/yum.repos.d/
56+
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
57+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
58+
yum update -y
59+
yum install -y which git openssl-devel openssl wget
5560
- name: Set up JDK 1.8
5661
uses: actions/setup-java@v3
5762
with:
@@ -60,4 +65,4 @@ jobs:
6065
- name: run integration testing
6166
run: /bin/bash -x .ci/ci_check.sh
6267
- name: upload coverage
63-
run: curl -LO https://codecov.io/bash && /bin/bash ./bash
68+
run: curl -LO https://codecov.io/bash && /bin/bash ./bash

Changelog.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1+
## v3.8.0
2+
3+
(2024-08-20)
4+
5+
请阅读控制台 v3.x+文档:
6+
7+
- [中文用户手册](https://fisco-bcos-doc.readthedocs.io/zh-cn/latest/docs/operation_and_maintenance/console/index.html)
8+
9+
### 新增
10+
11+
- 在编译合约时支持解析所有依赖合约,并合并成同一份合约文件。详情见:[#853](https://github.com/FISCO-BCOS/console/pull/853)
12+
- 新增在部署合约时指定编译器版本的功能,支持 `deploy` 命令后使用 `-v` 或者 `--sol-version` 参数指定编译器版本编译合约。详情见:[#846](https://github.com/FISCO-BCOS/console/pull/846)
13+
- 新增 `listSystemConfigs` 命令,可以查看链上所有系统配置项。详情见:[#848](https://github.com/FISCO-BCOS/console/pull/848)
14+
- 新增 `getLatestBlock` 命令,可以查看链上最新的区块信息。详情见:[#848](https://github.com/FISCO-BCOS/console/pull/848)
15+
- 新增Solidity `0.8.26` 版本的支持,提供示例合约。详情见:[#851](https://github.com/FISCO-BCOS/console/pull/851)
16+
17+
### 更新
18+
19+
- 更新 `code-generator``1.6.0` 版本,以支持根据Solidity合约中devdoc和userdoc生成Java接口注释,解决合约接口返回struct类型时生成Java接口文件的问题。
20+
121
## v3.7.0
222

323
(2024-03-25)
424

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

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

929
### 新增
1030

@@ -38,7 +58,7 @@
3858

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

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

4363
### 新增
4464

@@ -74,7 +94,7 @@
7494

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

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

7999
### 新增
80100

@@ -107,7 +127,7 @@
107127

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

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

112132
### 更新
113133

@@ -129,7 +149,7 @@
129149

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

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

134154
### 新增
135155

@@ -165,7 +185,7 @@
165185

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

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

170190
### 新增
171191

@@ -194,7 +214,7 @@
194214

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

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

199219
### 新增
200220

@@ -210,7 +230,7 @@
210230

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

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

215235
### 新增
216236

@@ -239,7 +259,7 @@
239259

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

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

244264
### 新增
245265

@@ -267,7 +287,7 @@
267287

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

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

272292
### 新增
273293

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ dependencies {
4040
//implementation 'org.fisco-bcos:solcJ:0.4.25.1'
4141
//implementation 'org.fisco-bcos:solcJ:0.6.10.1'
4242
//implementation 'org.fisco-bcos:solcJ:0.5.2.1'
43-
implementation 'org.fisco-bcos:solcJ:0.8.11.1'
43+
implementation 'org.fisco-bcos:solcJ:1.0.0-SNAPSHOT'
4444

45-
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.7.0') {
45+
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.8.0-SNAPSHOT') {
4646
exclude group: "org.slf4j"
4747
}
4848

@@ -53,7 +53,7 @@ dependencies {
5353
implementation('org.jline:jline:3.21.0')
5454
implementation('io.bretty:console-table-builder:1.2')
5555
implementation('com.github.jsqlparser:jsqlparser:2.0')
56-
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.5.0') {
56+
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.6.0-SNAPSHOT') {
5757
exclude group: "org.fisco-bcos.java-sdk"
5858
exclude group: "org.slf4j"
5959
}

release_note.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.7.0
1+
v3.8.0

src/main/java/console/client/ConsoleClientFace.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public interface ConsoleClientFace {
2828

2929
void getBlockByNumber(String[] params) throws IOException;
3030

31+
void getLatestBlock(String[] params) throws IOException;
32+
3133
void getBlockHeaderByHash(String[] params) throws IOException;
3234

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

5153
void getSystemConfigByKey(String[] params) throws Exception;
5254

55+
void listConfigs(String[] params) throws Exception;
56+
5357
void newAccount(String[] params);
5458

5559
void listAccount(String[] params);

src/main/java/console/client/ConsoleClientImpl.java

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
import java.math.BigInteger;
1212
import java.util.ArrayList;
1313
import java.util.List;
14+
import java.util.Map;
1415
import java.util.Objects;
16+
import java.util.Optional;
1517
import java.util.concurrent.atomic.AtomicBoolean;
18+
import java.util.stream.Collectors;
19+
import java.util.stream.Stream;
1620
import org.fisco.bcos.sdk.v3.client.Client;
1721
import org.fisco.bcos.sdk.v3.client.exceptions.ClientException;
1822
import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse;
@@ -148,10 +152,29 @@ public void getBlockByNumber(String[] params) throws IOException {
148152
if (blockByNumber.getBlock() == null) {
149153
System.out.println("Block not found, please check number: " + blockNumber);
150154
} else {
151-
ConsoleUtils.printJson(
152-
client.getBlockByNumber(BigInteger.valueOf(blockNumber), false, flag)
153-
.getBlock()
154-
.toString());
155+
ConsoleUtils.printJson(blockByNumber.getBlock().toString());
156+
}
157+
}
158+
159+
@Override
160+
public void getLatestBlock(String[] params) throws IOException {
161+
boolean flag = false;
162+
if (params.length == 2) {
163+
if ("true".equals(params[1])) {
164+
flag = true;
165+
} else if ("false".equals(params[1])) {
166+
flag = false;
167+
} else {
168+
System.out.println("Please provide true or false for the second parameter.");
169+
return;
170+
}
171+
}
172+
BigInteger blockNumber = client.getBlockNumber().getBlockNumber();
173+
BcosBlock block = client.getBlockByNumber(blockNumber, false, flag);
174+
if (block.getBlock() == null) {
175+
System.out.println("Block not found, please check number: " + blockNumber);
176+
} else {
177+
ConsoleUtils.printJson(block.getBlock().toString());
155178
}
156179
}
157180

@@ -326,6 +349,39 @@ public void getSystemConfigByKey(String[] params) throws Exception {
326349
}
327350
}
328351

352+
@Override
353+
public void listConfigs(String[] params) throws Exception {
354+
Map<String, Optional<SystemConfig>> systemConfigList = client.getSystemConfigList();
355+
int longestKeySize = 0;
356+
for (String key : systemConfigList.keySet()) {
357+
if (key.length() > longestKeySize) {
358+
longestKeySize = key.length();
359+
}
360+
}
361+
String leftAlignFormat = "| %-" + longestKeySize + "s | %-14s | %-12s |%n";
362+
String separatorLine =
363+
Stream.generate(() -> "-").limit(longestKeySize + 2).collect(Collectors.joining());
364+
String adaptableTitle =
365+
"| Config"
366+
+ Stream.generate(() -> " ")
367+
.limit(longestKeySize - "Config".length())
368+
.collect(Collectors.joining());
369+
System.out.println("+" + separatorLine + "+----------------+--------------+");
370+
System.out.println(adaptableTitle + " | Value | Enable Block |");
371+
System.out.println("+" + separatorLine + "+----------------+--------------+");
372+
systemConfigList.forEach(
373+
(key, value) -> {
374+
String configValue = "null";
375+
long blockNumber = 0;
376+
if (value.isPresent()) {
377+
configValue = value.get().getSystemConfig().getValue();
378+
blockNumber = value.get().getSystemConfig().getBlockNumber();
379+
}
380+
System.out.format(leftAlignFormat, key, configValue, blockNumber);
381+
});
382+
System.out.println("+" + separatorLine + "+----------------+--------------+");
383+
}
384+
329385
@Override
330386
public void newAccount(String[] params) {
331387
String accountFormat = "pem";

src/main/java/console/command/category/StatusQueryCommand.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ public Map<String, CommandInfo> getAllCommandInfo(boolean isWasm) {
6767
(consoleInitializer, params, pwd) ->
6868
consoleInitializer.getConsoleClientFace().getBlockNumber(params));
6969

70+
public static final CommandInfo GET_LATEST_BLOCK =
71+
new CommandInfo(
72+
"getLatestBlock",
73+
"Query the latest block",
74+
HelpInfo::getLatestBlockHelp,
75+
(consoleInitializer, params, pwd) ->
76+
consoleInitializer.getConsoleClientFace().getLatestBlock(params),
77+
0,
78+
1);
79+
7080
public static final CommandInfo GET_BLOCK_HASH_BY_NUMBER =
7181
new CommandInfo(
7282
"getBlockHashByNumber",
@@ -203,6 +213,16 @@ public Map<String, CommandInfo> getAllCommandInfo(boolean isWasm) {
203213
1,
204214
1);
205215

216+
public static final CommandInfo LIST_CONFIGS =
217+
new CommandInfo(
218+
"listSystemConfigs",
219+
"List all support system configs",
220+
HelpInfo::listSystemConfigsHelp,
221+
(consoleInitializer, params, pwd) ->
222+
consoleInitializer.getConsoleClientFace().listConfigs(params),
223+
0,
224+
0);
225+
206226
static {
207227
Field[] fields = StatusQueryCommand.class.getDeclaredFields();
208228
for (Field field : fields) {

src/main/java/console/command/model/HelpInfo.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ public static void getBlockByNumberHelp() {
156156
"* boolean -- (optional) If true it returns only the hashes of the transactions, if false then return the full transaction objects.");
157157
}
158158

159+
public static void getLatestBlockHelp() {
160+
System.out.println("Query the latest block.");
161+
System.out.println("Usage: \ngetLatestBlock [boolean]");
162+
System.out.println(
163+
"* boolean -- (optional) If true it returns only the hashes of the transactions, if false then return the full transaction objects.");
164+
}
165+
159166
public static void getBlockHeaderByHashHelp() {
160167
System.out.println("Query information about a block header by hash.");
161168
System.out.println("Usage: \ngetBlockHeaderByHash blockHash [boolean]");
@@ -227,7 +234,7 @@ public static void deployHelp(boolean isWasm) {
227234
System.out.println(
228235
"Deploy a " + "\033[32m" + "Solidity" + "\033[m" + " contract on blockchain.");
229236
System.out.println(
230-
"Usage: \ndeploy contractNameOrPath parameters... [--parallel-analysis/-p]");
237+
"Usage: \ndeploy contractNameOrPath parameters... [--parallel-analysis/-p --sol-version/-v 0.8.11]");
231238
System.out.println(
232239
"* contractNameOrPath -- The name of a contract or the path of a contract (Default load contract from the \"contracts/solidity\" path when using contractName).");
233240
System.out.println(
@@ -237,6 +244,8 @@ public static void deployHelp(boolean isWasm) {
237244
+ " link must locate under '/apps', and be composed of contract name and version ");
238245
System.out.println(
239246
"* --parallel-analysis/-p[Optional] -- parallel conflict analysis with the contract, default: no.");
247+
System.out.println(
248+
"* --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.");
240249
} else {
241250
System.out.println(
242251
"Deploy a " + "\033[32m" + "Liquid" + "\033[m" + " contract on blockchain.");
@@ -417,6 +426,11 @@ public static void getSystemConfigByKeyHelp() {
417426
" -- supported keys: " + String.join(",", Common.SUPPORTED_SYSTEM_KEYS));
418427
}
419428

429+
public static void listSystemConfigsHelp() {
430+
System.out.println("List all support system configs.");
431+
System.out.println("Usage: \nlistSystemConfigs ");
432+
}
433+
420434
public static void operateGroupHelp(String command, String operator) {
421435
System.out.println("Usage: \n" + command + " endPoint groupId");
422436
System.out.println(

0 commit comments

Comments
 (0)