From dafb9d102485ceedf3480c5557c449623c652d53 Mon Sep 17 00:00:00 2001 From: kyonRay Date: Wed, 27 Dec 2023 18:02:04 +0800 Subject: [PATCH] (auth,precompiled): add tree and getProposalList range limit logic, update version. --- release_note.txt | 2 +- src/main/java/console/ConsoleInitializer.java | 4 ++-- src/main/java/console/auth/AuthImpl.java | 8 ++++++++ .../java/console/common/ConsoleVersion.java | 2 +- .../console/precompiled/PrecompiledImpl.java | 20 +++++++++++++++++-- tools/download_console.sh | 2 +- 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/release_note.txt b/release_note.txt index c0c4025d..130165bc 100644 --- a/release_note.txt +++ b/release_note.txt @@ -1 +1 @@ -v3.5.0 +v3.6.0 diff --git a/src/main/java/console/ConsoleInitializer.java b/src/main/java/console/ConsoleInitializer.java index c3a9c97e..3155df63 100644 --- a/src/main/java/console/ConsoleInitializer.java +++ b/src/main/java/console/ConsoleInitializer.java @@ -237,12 +237,12 @@ private AccountInfo loadAccount(BcosSDK bcosSDK, String[] params) { System.out.println("Invalid param " + params[1] + ", must be -pem or -p12"); System.exit(0); } - if (params[1].compareToIgnoreCase("-pem") == 0 && params.length != 3) { + if (params[1].compareToIgnoreCase("-pem") == 0 && params.length < 3) { System.out.println( "Load account from the pem file failed! Please specified the pem file path"); System.exit(0); } - if (params[1].compareToIgnoreCase("-p12") == 0 && params.length != 3) { + if (params[1].compareToIgnoreCase("-p12") == 0 && params.length < 3) { System.out.println( "Load account from the p12 file failed! Please specified the p12 file path"); System.exit(0); diff --git a/src/main/java/console/auth/AuthImpl.java b/src/main/java/console/auth/AuthImpl.java index 0ee66f14..57384150 100644 --- a/src/main/java/console/auth/AuthImpl.java +++ b/src/main/java/console/auth/AuthImpl.java @@ -312,6 +312,14 @@ public void getProposalInfoList(String[] params) throws Exception { params[2], BigInteger.ONE, BigInteger.valueOf(Integer.MAX_VALUE)); + if (from.compareTo(to) > 0) { + System.out.println("Query From should be less than To."); + return; + } + if (to.subtract(from).compareTo(BigInteger.valueOf(100)) > 0) { + System.out.println("Query range should be less than 100."); + return; + } List proposalInfoList = authManager.getProposalInfoList(from, to); int showFrom = from.intValue(); for (ProposalInfo proposalInfo : proposalInfoList) { diff --git a/src/main/java/console/common/ConsoleVersion.java b/src/main/java/console/common/ConsoleVersion.java index d373e0d3..c1adf690 100644 --- a/src/main/java/console/common/ConsoleVersion.java +++ b/src/main/java/console/common/ConsoleVersion.java @@ -2,7 +2,7 @@ public class ConsoleVersion { - public static final String Version = "3.5.0"; + public static final String Version = "3.6.0"; public static void main(String[] args) { System.out.println("console version: " + Version); diff --git a/src/main/java/console/precompiled/PrecompiledImpl.java b/src/main/java/console/precompiled/PrecompiledImpl.java index 7fff90f2..df6ae22a 100644 --- a/src/main/java/console/precompiled/PrecompiledImpl.java +++ b/src/main/java/console/precompiled/PrecompiledImpl.java @@ -853,7 +853,16 @@ private Tuple2 travelBfs( if (deep >= limit) return new Tuple2<>(0, 0); int dirCount = 0; int contractCount = 0; - List children = bfsService.list(absolutePath); + BigInteger offset = BigInteger.ZERO; + EnumNodeVersion.Version supportedVersion = bfsService.getCurrentVersion(); + Tuple2> fileInfoList; + if (supportedVersion.compareTo(EnumNodeVersion.BCOS_3_1_0.toVersionObj()) >= 0) { + fileInfoList = bfsService.list(absolutePath, offset, Common.LS_DEFAULT_COUNT); + } else { + fileInfoList = new Tuple2<>(BigInteger.ZERO, bfsService.list(absolutePath)); + } + BigInteger fileLeft = fileInfoList.getValue1(); + List children = fileInfoList.getValue2(); for (int i = 0; i < children.size(); i++) { String thisPrefix = ""; String nextPrefix = ""; @@ -863,7 +872,11 @@ private Tuple2 travelBfs( thisPrefix = prefix + "├─"; } else { nextPrefix = prefix + " "; - thisPrefix = prefix + "└─"; + if (fileLeft.compareTo(BigInteger.ZERO) > 0) { + thisPrefix = prefix + "├─"; + } else { + thisPrefix = prefix + "└─"; + } } System.out.println(thisPrefix + children.get(i).getFileName()); if (children.get(i).getFileType().equals(Common.BFS_TYPE_DIR)) { @@ -881,6 +894,9 @@ private Tuple2 travelBfs( } else { contractCount++; } + if (fileLeft.compareTo(BigInteger.ZERO) > 0 && i == children.size() - 1) { + System.out.println(prefix + "└─" + "... " + fileLeft + " left files..."); + } } } return new Tuple2<>(dirCount, contractCount); diff --git a/tools/download_console.sh b/tools/download_console.sh index 72c81ea5..39155a14 100755 --- a/tools/download_console.sh +++ b/tools/download_console.sh @@ -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.5.0" +default_version="3.6.0" download_version="${default_version}" solc_download_version="3.0.0" specify_console=0