Giter Club home page Giter Club logo

console's Issues

ubuntu 20.04 fisco-bcos 3.0-rc4 Max在使用tars基于host网络模式部署成功之后,tars控制台显示rpc,gateway,node服务均是active,但是v3.0.0-rc4版console在参照向导配置之后,启动报错。

以下是执行bash start.sh之后的日志输出,提示Get ca basic failed和The websocket connection handshake timeout,具体日志信息如下:

  1. cpp_sdk_log_2022072223.13.log

info|2022-07-22 23:13:49.804602|[SDK][WS][SERVICE],[NEWOBJ][WsService]=0x7f37a46c9c20
info|2022-07-22 23:13:49.804646|[RPCWS][SERVICE]init the local protocol,minVersion=1,maxVersion=1,module=2
info|2022-07-22 23:13:49.807798|[DEFAULT][WS][INITIALIZER][initWsService]start websocket service as client,connected size=1
info|2022-07-22 23:13:49.807831|[DEFAULT][WS][INITIALIZER][initWsService]initializer for websocket service,listenIP=,listenPort=0,disableSsl=false,server=false,client=true,threadPoolSize=4,maxMsgSize=33554432,msgTimeOut=10000,connected peers=1
info|2022-07-22 23:13:49.807869|[bcos_sdk_create][NEWOBJ],sdk=0x7f37a46c3da0
info|2022-07-22 23:13:50.008430|[DEFAULT][WS][CONNECTOR][connectToWsServer]async_connect success,endpoint=127.0.0.1:20200
info|2022-07-22 23:13:50.008698|[DEFAULT][WS][STREAM],[NEWOBJ][WsStream]=0x7f372c003f50
info|2022-07-22 23:13:50.013044|[DEFAULT][BOOSTSSL][NODEINFO][NEW]SSLContext pubHex: 3082010a0282010100b41cec3648b93cc7a67cbde69439076d1d947dea85169937c1ab23553de84e565bfbdaad764f22664950d19c65a2f1ddee17a62e6580cd83cde10641ee03734999a5271996cce3a5fc48e5529b71736cc38045f53decd18b4c5cda3dfaa406c33650bf17c1cb0d29e95227298b4d6aad6c0c787a261a8ba9ff20792c8154c64d6e76d882ecc879cf3fafb4ec86b06e7da17d5978cd231f93fae26006a85a8cf852fde90e874691d9cd3e8439b349aa0909f9233d5dbb1a2786d0d6d8375c1880e9aa1e8195bf721f1c9a3d1a2e409fe14b051e4dde6906a3ba819309fc99fe117eee5d59887d21942030d956db448f0824d266ee6466843824c9feb6b5285c1d0203010001
warning|2022-07-22 23:13:50.013131|[DEFAULT][BOOSTSSL][NODEINFO]Get ca basic failed
info|2022-07-22 23:13:50.013604|[DEFAULT][BOOSTSSL][NODEINFO][NEW]SSLContext pubHex: 3082010a0282010100b753586713cba8114c17071cd3e9dadacbfec278cf27386cec0a3358641b99a255f6ab8fe4709cae373a2a0710214741728cfce4d06a81c6737354a56c4c1c0c610ed46858da56b0c15cf2677dbc32565a2142e1e4560e9a307051a1109af95b18ccecf5bcd7edcf4a1b0ba2ca75a0a9189c665b2bb86b044cd0eafbb91754dd785d70c0f4d7dc1b724abefdf0a6707711aaf6bfc55dcbbc604ed249968a6f1b3ad4ff884cd1be4af85b3ff965ed8e4c04be2ee87210681ba1652ec1ac1cbc73acc41b768c21c771a7a0ae322b19863ac714e44348e000aa13dfdeeed80e8793c9e0e46704c76b9a19b96873e2b86407311e2571282dfbebf06d34188dfa71510203010001
info|2022-07-22 23:13:50.022553|[DEFAULT][WS][CONNECTOR][connectToWsServer]ssl async_handshake success,host=127.0.0.1,port=20200
info|2022-07-22 23:13:50.023681|[DEFAULT][WS][CONNECTOR][connectToWsServer]websocket handshake successfully,host=127.0.0.1,port=20200
info|2022-07-22 23:13:50.023741|[SDK][WS][SESSION],[NEWOBJ][WSSESSION]=0x7f372c0269d0
info|2022-07-22 23:13:50.023827|[SDK][WS][SERVICE]connected nodes,count=0
info|2022-07-22 23:13:50.023850|[SDK][WS][SERVICE][newSession]start the session,endPoint=127.0.0.1:20200
info|2022-07-22 23:13:50.023872|[SDK][WS][SERVICE][addSession]add session to mapping,connectedEndPoint=127.0.0.1:20200,endPoint=127.0.0.1:20200,result=true
info|2022-07-22 23:13:50.023880|[SDK][WS][SERVICE][start]start websocket service successfully,model=1,max msg size=33554432
info|2022-07-22 23:13:50.023900|[SDK][WS][SERVICE][onConnect],endpoint=127.0.0.1:20200,connectedEndPoint=127.0.0.1:20200,refCount=6
info|2022-07-22 23:13:50.024061|[RPCWS][SERVICE][startHandshake],endpoint=127.0.0.1:20200
info|2022-07-22 23:13:50.024590|[SDK][WS][SESSION][startAsClient]websocket handshake successfully,endPoint=127.0.0.1:20200,session=0x7f372c0269d0
warning|2022-07-22 23:14:00.024505|[SDK][WS][SESSION][onRespTimeout],seq=e38ed56b0b1642a9bc88ca6820c72dca
info|2022-07-22 23:14:00.024579|[SDK][WS][SESSION]127.0.0.1:20200 queueSize: 0
warning|2022-07-22 23:14:00.024720|[RPCWS][SERVICE][startHandshake]callback response error,endpoint=127.0.0.1:20200,errorCode=-4008,errorMessage=waiting for message response timed out
info|2022-07-22 23:14:00.024750|[SDK][WS][SESSION][drop],reason=4294963289,endpoint=127.0.0.1:20200,session=0x7f372c0269d0
info|2022-07-22 23:14:00.024760|[SDK][WS][SESSION][drop],reason=4294963289,endpoint=127.0.0.1:20200,cb size=0,session=0x7f372c0269d0
info|2022-07-22 23:14:00.024915|[DEFAULT][WS][STREAM]the real action to close the stream,this=0x7f372c003f50
warning|2022-07-22 23:14:00.024959|[SDK][WS][SESSION][asyncRead],error=Operation canceled,endpoint=127.0.0.1:20200,session=0x7f372c0269d0
info|2022-07-22 23:14:00.025012|[SDK][WS][SESSION][drop]the session has already been dropped,endpoint=127.0.0.1:20200,session=0x7f372c0269d0
info|2022-07-22 23:14:00.025168|[SDK][WS][SERVICE][removeSession],endpoint=127.0.0.1:20200
info|2022-07-22 23:14:00.025192|[EVENT][SUB][suspendTasks]suspend event sub tasks for disconnection,endPoint=127.0.0.1:20200,count=0
info|2022-07-22 23:14:00.025202|[SDK][WS][SERVICE][onDisconnect],endpoint=127.0.0.1:20200,connectedEndPoint=127.0.0.1:20200,refCount=4
info|2022-07-22 23:14:00.025212|[RPCWS][SERVICE][clearGroupInfoByEp],endPoint=127.0.0.1:20200
info|2022-07-22 23:14:00.025228|[RPCWS][SERVICE][printGroupInfo],total count=0
info|2022-07-22 23:14:00.025238|[SDK][WS][SESSION],[DELOBJ][WSSESSION]=0x7f372c0269d0
info|2022-07-22 23:14:00.025419|[DEFAULT][WS][STREAM],[DELOBJ][WsStream]=0x7f372c003f50
info|2022-07-22 23:14:10.023960|[SDK][WS][SERVICE]reconnect,peer=127.0.0.1:20200
info|2022-07-22 23:14:10.024197|[SDK][WS][SERVICE]connected nodes,count=0
info|2022-07-22 23:14:10.024764|[DEFAULT][WS][CONNECTOR][connectToWsServer]async_connect success,endpoint=127.0.0.1:20200
info|2022-07-22 23:14:10.024915|[DEFAULT][WS][STREAM],[NEWOBJ][WsStream]=0x7f372c01f380
info|2022-07-22 23:14:10.029842|[DEFAULT][BOOSTSSL][NODEINFO][NEW]SSLContext pubHex: 3082010a0282010100b41cec3648b93cc7a67cbde69439076d1d947dea85169937c1ab23553de84e565bfbdaad764f22664950d19c65a2f1ddee17a62e6580cd83cde10641ee03734999a5271996cce3a5fc48e5529b71736cc38045f53decd18b4c5cda3dfaa406c33650bf17c1cb0d29e95227298b4d6aad6c0c787a261a8ba9ff20792c8154c64d6e76d882ecc879cf3fafb4ec86b06e7da17d5978cd231f93fae26006a85a8cf852fde90e874691d9cd3e8439b349aa0909f9233d5dbb1a2786d0d6d8375c1880e9aa1e8195bf721f1c9a3d1a2e409fe14b051e4dde6906a3ba819309fc99fe117eee5d59887d21942030d956db448f0824d266ee6466843824c9feb6b5285c1d0203010001
warning|2022-07-22 23:14:10.029902|[DEFAULT][BOOSTSSL][NODEINFO]Get ca basic failed
info|2022-07-22 23:14:10.030087|[DEFAULT][BOOSTSSL][NODEINFO][NEW]SSLContext pubHex: 3082010a0282010100b753586713cba8114c17071cd3e9dadacbfec278cf27386cec0a3358641b99a255f6ab8fe4709cae373a2a0710214741728cfce4d06a81c6737354a56c4c1c0c610ed46858da56b0c15cf2677dbc32565a2142e1e4560e9a307051a1109af95b18ccecf5bcd7edcf4a1b0ba2ca75a0a9189c665b2bb86b044cd0eafbb91754dd785d70c0f4d7dc1b724abefdf0a6707711aaf6bfc55dcbbc604ed249968a6f1b3ad4ff884cd1be4af85b3ff965ed8e4c04be2ee87210681ba1652ec1ac1cbc73acc41b768c21c771a7a0ae322b19863ac714e44348e000aa13dfdeeed80e8793c9e0e46704c76b9a19b96873e2b86407311e2571282dfbebf06d34188dfa71510203010001
info|2022-07-22 23:14:10.036239|[DEFAULT][WS][CONNECTOR][connectToWsServer]ssl async_handshake success,host=127.0.0.1,port=20200
info|2022-07-22 23:14:10.036760|[DEFAULT][WS][CONNECTOR][connectToWsServer]websocket handshake successfully,host=127.0.0.1,port=20200
info|2022-07-22 23:14:10.036806|[SDK][WS][SESSION],[NEWOBJ][WSSESSION]=0x7f372c0233f0
info|2022-07-22 23:14:10.036820|[SDK][WS][SERVICE][newSession]start the session,endPoint=127.0.0.1:20200
info|2022-07-22 23:14:10.036831|[SDK][WS][SERVICE][addSession]add session to mapping,connectedEndPoint=127.0.0.1:20200,endPoint=127.0.0.1:20200,result=true
info|2022-07-22 23:14:10.036839|[SDK][WS][SERVICE][onConnect],endpoint=127.0.0.1:20200,connectedEndPoint=127.0.0.1:20200,refCount=6
info|2022-07-22 23:14:10.036951|[RPCWS][SERVICE][startHandshake],endpoint=127.0.0.1:20200
info|2022-07-22 23:14:10.037152|[SDK][WS][SESSION][startAsClient]websocket handshake successfully,endPoint=127.0.0.1:20200,session=0x7f372c0233f0
warning|2022-07-22 23:14:20.037108|[SDK][WS][SESSION][onRespTimeout],seq=f31bea216fb546eba0243f7977bf6314
info|2022-07-22 23:14:20.037207|[SDK][WS][SESSION]127.0.0.1:20200 queueSize: 0
warning|2022-07-22 23:14:20.037247|[RPCWS][SERVICE][startHandshake]callback response error,endpoint=127.0.0.1:20200,errorCode=-4008,errorMessage=waiting for message response timed out
info|2022-07-22 23:14:20.037300|[SDK][WS][SESSION][drop],reason=4294963289,endpoint=127.0.0.1:20200,session=0x7f372c0233f0
info|2022-07-22 23:14:20.037312|[SDK][WS][SESSION][drop],reason=4294963289,endpoint=127.0.0.1:20200,cb size=0,session=0x7f372c0233f0
info|2022-07-22 23:14:20.037436|[DEFAULT][WS][STREAM]the real action to close the stream,this=0x7f372c01f380
info|2022-07-22 23:14:20.037471|[SDK][WS][SERVICE][removeSession],endpoint=127.0.0.1:20200
info|2022-07-22 23:14:20.037482|[EVENT][SUB][suspendTasks]suspend event sub tasks for disconnection,endPoint=127.0.0.1:20200,count=0
info|2022-07-22 23:14:20.037490|[SDK][WS][SERVICE][onDisconnect],endpoint=127.0.0.1:20200,connectedEndPoint=127.0.0.1:20200,refCount=5
info|2022-07-22 23:14:20.037498|[RPCWS][SERVICE][clearGroupInfoByEp],endPoint=127.0.0.1:20200
info|2022-07-22 23:14:20.037506|[RPCWS][SERVICE][printGroupInfo],total count=0
warning|2022-07-22 23:14:20.037556|[SDK][WS][SESSION][asyncRead],error=Operation canceled,endpoint=127.0.0.1:20200,session=0x7f372c0233f0
info|2022-07-22 23:14:20.037584|[SDK][WS][SESSION][drop]the session has already been dropped,endpoint=127.0.0.1:20200,session=0x7f372c0233f0
info|2022-07-22 23:14:20.037594|[SDK][WS][SESSION],[DELOBJ][WSSESSION]=0x7f372c0233f0
info|2022-07-22 23:14:20.037740|[DEFAULT][WS][STREAM],[DELOBJ][WsStream]=0x7f372c01f380
info|2022-07-22 23:14:20.056984|[SDK][WS][SERVICE][stop]stop websocket service successfully
warning|2022-07-22 23:14:20.057017|[RPCWS][SERVICE][waitForConnectionEstablish]wait for websocket connection handshake timeout,timeout=30000
error|2022-07-22 23:14:20.057150|[bcos_sdk_start],sdk=0x7f37a46c3da0,errorMsg=/github/home/.hunter/_Base/0ba8099/8cf628f/6cc1dfe/Build/bcos-cpp-sdk/Source/bcos-cpp-sdk/ws/Service.cpp(96): Throw in function void bcos::cppsdk::service::Service::waitForConnectionEstablish()
Dynamic exception type: boost::wrapexceptstd::runtime_error
std::exception::what: The websocket connection handshake timeout
info|2022-07-22 23:14:20.057177|[bcos_sdk_start],sdk=0x7f37a46c3da0

  1. console.log

2022-07-22 23:01:45.819 INFO console.ConsoleInitializer 50 init -- Did not set group, use default group in config.
2022-07-22 23:01:45.923 DEBUG org.fisco.bcos.sdk.v3.config.model.CryptoMaterialConfig 111 -- Load cryptoMaterial, useSmCrypto: false, caCertPath: null, sdkCertPath: null, sdkPrivateKeyPath:null, enSSLCertPath: null, enSSLPrivateKeyPath:null
2022-07-22 23:01:45.927 INFO org.fisco.bcos.sdk.v3.config.model.NetworkConfig 44 -- network config items, timeout: 10000, peers: [127.0.0.1:20200]
2022-07-22 23:01:45.928 DEBUG org.fisco.bcos.sdk.v3.config.model.ThreadPoolConfig 44 -- Init ThreadPoolConfig, threadPoolSize: 4
2022-07-22 23:01:45.929 INFO org.fisco.bcos.sdk.v3.BcosSDK 47 build -- create BcosSDK, configPath: /root/fisco/console/conf/config.toml
2022-07-22 23:01:45.931 INFO org.fisco.bcos.sdk.jni.common.JniLibLoader 72 -- initialize workdir, -Djava.io.tmpdirs: /tmp
2022-07-22 23:01:45.931 INFO org.fisco.bcos.sdk.jni.common.JniLibLoader 143 loadJniLibrary -- try to load library from jar
2022-07-22 23:01:45.931 DEBUG org.fisco.bcos.sdk.jni.common.JniLibLoader 89 getLibName -- osName: linux, archName:
2022-07-22 23:01:45.932 INFO org.fisco.bcos.sdk.jni.common.JniLibLoader 192 loadLibraryFromJar -- tempDir: /tmp/104868143810118, tempFile: /tmp/104868143810118/libbcos-sdk-jni.so
2022-07-22 23:01:46.143 DEBUG org.fisco.bcos.sdk.jni.common.JniLibLoader 218 loadLibraryFromJar -- remove temp dir and temp file, /tmp/104868143810118
2022-07-22 23:01:46.148 INFO org.fisco.bcos.sdk.jni.BcosSDKJniObj 40 build -- newNativePointer, nativePointer: 140134522504768, jniConfig: JniConfig{threadPoolSize=4, reconnectPeriodMs=20000, heartbeatPeriodMs=20000, messageTimeoutMs=10000, disableSsl=false, sslType='ssl', peers='[127.0.0.1:20200]'}
2022-07-22 23:01:46.149 INFO org.fisco.bcos.sdk.v3.client.Client 91 build -- build, groupID: group0, configOption: org.fisco.bcos.sdk.v3.config.ConfigOption@441772e, nativePointer: 140134522504768
2022-07-22 23:01:46.351 INFO org.fisco.bcos.sdk.jni.rpc.RpcJniObj 27 build -- nativePointer: 140134522504768
2022-07-22 23:02:16.397 WARN org.fisco.bcos.sdk.v3.BcosSDK 109 getClient -- create client for failed, error: org.fisco.bcos.sdk.jni.common.JniException: /github/home/.hunter/_Base/0ba8099/8cf628f/6cc1dfe/Build/bcos-cpp-sdk/Source/bcos-cpp-sdk/ws/Service.cpp(96): Throw in function void bcos::cppsdk::service::Service::waitForConnectionEstablish()
Dynamic exception type: boost::wrapexceptstd::runtime_error
std::exception::what: The websocket connection handshake timeout

    at org.fisco.bcos.sdk.jni.rpc.RpcJniObj.start(Native Method) ~[bcos-sdk-jni-3.0.0-rc4.jar:?]
    at org.fisco.bcos.sdk.v3.client.ClientImpl.start(ClientImpl.java:1064) ~[fisco-bcos-java-sdk-3.0.0-rc4.jar:?]
    at org.fisco.bcos.sdk.v3.client.ClientImpl.<init>(ClientImpl.java:136) ~[fisco-bcos-java-sdk-3.0.0-rc4.jar:?]
    at org.fisco.bcos.sdk.v3.client.Client.build(Client.java:96) ~[fisco-bcos-java-sdk-3.0.0-rc4.jar:?]
    at org.fisco.bcos.sdk.v3.BcosSDK.getClient(BcosSDK.java:104) [fisco-bcos-java-sdk-3.0.0-rc4.jar:?]
    at console.ConsoleInitializer.loadAccountInfo(ConsoleInitializer.java:141) [console.jar:?]
    at console.ConsoleInitializer.init(ConsoleInitializer.java:60) [console.jar:?]
    at console.Console.main(Console.java:49) [console.jar:?]

2022-07-22 23:02:16.404 ERROR console.ConsoleInitializer 176 loadAccountInfo -- message: get Client failed, e: /github/home/.hunter/_Base/0ba8099/8cf628f/6cc1dfe/Build/bcos-cpp-sdk/Source/bcos-cpp-sdk/ws/Service.cpp(96): Throw in function void bcos::cppsdk::service::Service::waitForConnectionEstablish()
Dynamic exception type: boost::wrapexceptstd::runtime_error
std::exception::what: The websocket connection handshake timeout
, e: org.fisco.bcos.sdk.v3.BcosSDKException: get Client failed, e: /github/home/.hunter/_Base/0ba8099/8cf628f/6cc1dfe/Build/bcos-cpp-sdk/Source/bcos-cpp-sdk/ws/Service.cpp(96): Throw in function void bcos::cppsdk::service::Service::waitForConnectionEstablish()
Dynamic exception type: boost::wrapexceptstd::runtime_error
std::exception::what: The websocket connection handshake timeout

控制台解析参数失败问题

在使用中发现当合约的入参有字符串数组和字符串一起作为入参时候,如果字符串有空格,参数解析会失败如下图:
image

而如果是整形数组和字符串作为入参的时候,就没这个问题,如图:
image

控制台版本1.0.9,希望能及时修复

sol2java.sh 生成java代码编译报错

原始合约:

pragma solidity ^0.4.25;

contract OneToOne  {
    function updateInfo(uint256 assetId, string memory info) public{
    }
}

使用sol2java.sh工具:

bash sol2java.sh

最终生成的代码:

package com;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class OneToOne extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405234801561001057600080fd5b5060e48061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806350c00197146044575b600080fd5b348015604f57600080fd5b5060b260048036038101908080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505060b4565b005b50505600a165627a7a72305820e8891134ccea817cb561032019a44ab13ec3f8e69e001ab6d8859c4771d455fa0029"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"608060405234801561001057600080fd5b5060e48061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635549e5a6146044575b600080fd5b348015604f57600080fd5b5060b260048036038101908080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505060b4565b005b50505600a165627a7a72305820d16533d3155da9786804cc043dffad773fce02adf9ca96e6ff720f91e7d41efb0029"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":false,\"inputs\":[{\"name\":\"assetId\",\"type\":\"uint256\"},{\"name\":\"info\",\"type\":\"string\"}],\"name\":\"updateInfo\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_UPDATEINFO = "updateInfo";

    protected OneToOne(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public TransactionReceipt updateInfo(BigInteger assetId, BigInteger info) {
        final Function function = new Function(
                FUNC_UPDATEINFO, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(assetId), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(info)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public byte[] updateInfo(BigInteger assetId, BigInteger info, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATEINFO, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(assetId), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(info)), 
                Collections.<TypeReference<?>>emptyList());
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateInfo(BigInteger assetId, BigInteger info) {
        final Function function = new Function(
                FUNC_UPDATEINFO, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(assetId), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(info)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<BigInteger, String> getUpdateInfoInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATEINFO, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<BigInteger, String>(

                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue()
                );
    }

    public static OneToOne load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new OneToOne(contractAddress, client, credential);
    }

    public static OneToOne deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(OneToOne.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }
}

image

生成的updateInfo接口数据类型不一致,经测试2.8.0 console没有这个问题,是2.9.0 console新引入的问题。

部署调用library的合约成功,调用返回revert

部署solidity例子合约,能成功部署,但调用revert。原因是合约bin中的库的地址没有被替换。

参考这里

如果您的合约使用 libraries ,您会注意到在编译后的十六进制字节码中会包含形如 LibraryName__ 的字符串。当您将 solc 作为链接器使用时,它会在下列情况中为你插入库的地址:要么在命令行中添加 --libraries "Math:0x12345678901234567890 Heap:0xabcdef0123456" 来为每个库提供地址,或者将这些字符串保存到一个文件中(每行一个库),并使用 --libraries fileName 参数。

library Set {
  // 我们定义了一个新的结构体数据类型,用于在调用合约中保存数据。
  struct Data { mapping(uint => bool) flags; }

  // 注意第一个参数是“storage reference”类型,因此在调用中参数传递的只是它的存储地址而不是内容。
  // 这是库函数的一个特性。如果该函数可以被视为对象的方法,则习惯称第一个参数为 `self` 。
  function insert(Data storage self, uint value)
      public
      returns (bool)
  {
      if (self.flags[value])
          return false; // 已经存在
      self.flags[value] = true;
      return true;
  }

  function remove(Data storage self, uint value)
      public
      returns (bool)
  {
      if (!self.flags[value])
          return false; // 不存在
      self.flags[value] = false;
      return true;
  }

  function contains(Data storage self, uint value)
      public
      view
      returns (bool)
  {
      return self.flags[value];
  }
}

contract C {
    Set.Data knownValues;

    function register(uint value) public {
        // 不需要库的特定实例就可以调用库函数,
        // 因为当前合约就是“instance”。
        require(Set.insert(knownValues, value));
    }
    // 如果我们愿意,我们也可以在这个合约中直接访问 knownValues.flags。
}

将库中的函数声明为internal能够解决这个问题,但希望支持solidity例子中的操作。

库可以看作是使用他们的合约的隐式的基类合约。虽然它们在继承关系中不会显式可见,但调用库函数与调用显式的基类合约十分类似 (如果 L 是库的话,可以使用 L.f() 调用库函数)。此外,就像库是基类合约一样,对所有使用库的合约,库的 internal 函数都是可见的。 当然,需要使用内部调用约定来调用内部函数,这意味着所有内部类型,内存类型都是通过引用而不是复制来传递。 为了在 EVM 中实现这些,内部库函数的代码和从其中调用的所有函数都在编译阶段被拉取到调用合约中,然后使用一个 JUMP 调用来代替 DELEGATECALL。

FISCO-BCOS 新增节点 连接问题

我的环境是

18496ad2d35d2cc5aeb04698237ece3
我新增了一个节点启动成功了 但是日志文件里报错 与其他的节点连接失败

6ff3427e2e2f3976efeb78617e04d30

我想要的是 这个新增的节点与其他的节点连接成功 我该如何修改?

按照官方文档启动报错,得指定版本下载2.8.0就可以启动,不然一直报错

cd ~/fisco && curl -LO https://github.com/FISCO-BCOS/console/releases/download/v2.8.0/download_console.sh && bash download_console.sh 下载的默认是最新的3.0.0-rc1,导致启动报错;
[root@YL-Docker-202 fisco]# cd ~/fisco/console && bash start.sh Failed to create BcosSDK failed! Please check the node status and the console configuration, error info: get Client failed, e: /root/.hunter/_Base/19eeb6d/8cf628f/0e34ca0/Build/bcos-boostssl/Source/bcos-boostssl/websocket/WsService.cpp(81): Throw in function void bcos::boostssl::ws::WsService::waitForConnectionEstablish() Dynamic exception type: boost::wrapexcept<std::runtime_error> std::exception::what: The connection to the server timed out
最后手动下载2.8.0版本的就启动成功了。

控制台无法自动识别国密版jar包和非国密版jar包

当我在配置国密版控制台的时候,忘记替换成国密版jar包后,我发现居然可以成功部署智能合约,但是执行智能合约的函数的时候,总是提示The execution of the contract rolled back.这个bug还蛮深的,找了好久才找到。

所以我觉得应该让控制台拥有这个功能。根据配置文件识别自己的版本(国密,非国密)然后能自动识别lib文件夹下的jar包是国密还是非国密的,jar包版本不对应该要提示使用者使用正确版本的jar包,否则后面可能会有其他莫名其妙的问题。

控制台调用预编译合约报错cannot decode in in decodeMethodToObject with appropriate interface ABI

使用的console版本是2.8,fisco-bcos的版本也是2.8,自己编写了一个预编译合约,编译通过,然后在控制台调用报错cannot decode in in decodeMethodToObject with appropriate interface ABI,复现步骤如下:

[group:1]> call InferencePrecompiled.sol 0x5002 inference "test" "test"
 cannot decode in decodeMethodToObject with appropriate interface ABI

预编译合约接口如下:

pragma solidity ^0.4.24;

contract InferencePrecompiled {
    function inference(string exec, string resPath) public view returns(string){}
}

控制台的log信息如下:

[DEBUG] [2022-04-01 18:44:50] ConsoleContractImpl.callContract(441) | sendCall request, params: [test, test], contractAddress: 0x0000000000000000000000000000000000005002, contractName: InferencePrecompiled, functionName:inference, paramSize: 2
[INFO] [2022-04-01 18:44:50] ContractABIDefinition.addFunction(84) |  name: inference, methodId: 0x1d240d39, methodSignature: inference(string,string), abi: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(42) |  abiDefinition: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(49) |  contractABIDefinition org.fisco.bcos.sdk.abi.wrapper.ContractABIDefinition@2c6ee758 
[INFO] [2022-04-01 18:44:50] ABIObjectFactory.createObject(32) |  name: inference
[DEBUG] [2022-04-01 18:44:50] ChannelMsgHandler.onMessage(123) | onMessage in ChannelMsgHandler called, host : 127.0.0.1:20200, seq : ebbda4bbfb3540b28a58e7c5c50324db, msgType : 18
[INFO] [2022-04-01 18:44:50] ContractABIDefinition.addFunction(84) |  name: inference, methodId: 0x1d240d39, methodSignature: inference(string,string), abi: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(42) |  abiDefinition: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(49) |  contractABIDefinition org.fisco.bcos.sdk.abi.wrapper.ContractABIDefinition@640dc4c6 
[INFO] [2022-04-01 18:44:50] ABIObjectFactory.createObject(32) |  name: inference
[ERROR] [2022-04-01 18:44:50] ABICodec.decodeMethodAndGetOutputObject(288) |  exception in decodeMethodToObject : arraycopy: last source index 32 out of bounds for byte[0]
[ERROR] [2022-04-01 18:44:50] ABICodec.decodeMethodAndGetOutputObject(293) |  cannot decode in decodeMethodToObject with appropriate interface ABI
[ERROR] [2022-04-01 18:44:50] Console.main(177) |  message:  cannot decode in decodeMethodToObject with appropriate interface ABI, e: {}
org.fisco.bcos.sdk.abi.ABICodecException:  cannot decode in decodeMethodToObject with appropriate interface ABI
	at org.fisco.bcos.sdk.abi.ABICodec.decodeMethodAndGetOutputObject(ABICodec.java:294)
	at org.fisco.bcos.sdk.transaction.manager.AssembleTransactionProcessor.callAndGetResponse(AssembleTransactionProcessor.java:319)
	at org.fisco.bcos.sdk.transaction.manager.AssembleTransactionProcessor.sendCallWithStringParams(AssembleTransactionProcessor.java:310)
	at console.contract.ConsoleContractImpl.callContract(ConsoleContractImpl.java:450)
	at console.contract.ConsoleContractImpl.call(ConsoleContractImpl.java:402)
	at console.command.SupportedCommand$72.call(SupportedCommand.java:728)
	at console.command.model.CommandInfo.callCommand(CommandInfo.java:270)
	at console.Console.main(Console.java:105)

不知道为什么报exception in decodeMethodToObject : arraycopy: last source index 32 out of bounds for byte[0],看起来参数的长度并没有超过32字节,另外我还想问一下solidity对于string传参的长度有限制吗?

感谢解答!

solidity合约参数如果是bytes,console解析16进制字符串有误

在类ContractClassFactory解析参数byte[]时,是直接获取字符串的bytes,如下

else if (type[i] == byte[].class) {
    if (params[i].startsWith("\"") && params[i].endsWith("\"")) {
         byte[] bytes = params[i].substring(1, params[i].length() - 1)..getBytes();
         obj[i] = bytes;
    } else {
          System.out.println("Please provide double quote for byte String.");
          System.out.println();
          return null;
    }
}

16进制字符串应该需要特殊转化
byte[] bytes = Numeric.hexStringToByteArray(params[i].substring(1, params[i].length() - 1));

所以byte[]String也不能直接new String(bytes),应该是Numeric.toHexString(bytes);

最新版fisco bcos v2.6.0的console安装不成功,Unknown named curve: 1.3.132.0.10

按照https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/enterprise_tools/tutorial_detail_operation.html文档安装一个节点的generator,generator是成功的。但是安装console后启动console失败。

console日志如下:

[INFO] [2020-09-15 18:48:47] AbstractApplicationContext.prepareRefresh(583) | Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2437c6dc: startup date [Tue Sep 15 18:48:47 CST 2020]; root of context hierarchy
[INFO] [2020-09-15 18:48:47] XmlBeanDefinitionReader.loadBeanDefinitions(317) | Loading XML bean definitions from class path resource [applicationContext.xml]
[INFO] [2020-09-15 18:48:49] Service.initJavaOpt(296) | set jdk.tls.namedGroups opt, value : secp256k1
[INFO] [2020-09-15 18:48:49] ChannelConnections.init(318) | all connections: [ConnectionInfo{host='127.0.0.1', port=20200}, ConnectionInfo{host='127.0.0.1', port=20201}]
[INFO] [2020-09-15 18:48:49] ChannelConnections.initSslContext(546) | ca certificate: ca.crt, sdk certificate: sdk.crt, sdk key: sdk.key
[ERROR] [2020-09-15 18:48:49] ChannelConnections.initSslContext(561) | Failed to initialize the SSLContext, e: {}
java.security.cert.CertificateParsingException: java.io.IOException: Unknown named curve: 1.3.132.0.10
at sun.security.x509.X509CertInfo.(X509CertInfo.java:169)
at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1804)
at sun.security.x509.X509CertImpl.(X509CertImpl.java:195)
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:102)
at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)
at io.netty.handler.ssl.SslContext.getCertificatesFromBuffers(SslContext.java:1200)
at io.netty.handler.ssl.SslContext.toX509Certificates(SslContext.java:1189)
at io.netty.handler.ssl.SslContextBuilder.trustManager(SslContextBuilder.java:242)
at org.fisco.bcos.channel.handler.ChannelConnections.initSslContext(ChannelConnections.java:554)
at org.fisco.bcos.channel.handler.ChannelConnections.startConnect(ChannelConnections.java:344)
at org.fisco.bcos.channel.client.Service.run(Service.java:332)
at console.ConsoleInitializer.init(ConsoleInitializer.java:121)
at console.ConsoleClient.main(ConsoleClient.java:45)
Caused by: java.io.IOException: Unknown named curve: 1.3.132.0.10
at sun.security.ec.ECParameters.engineInit(ECParameters.java:143)
at java.security.AlgorithmParameters.init(AlgorithmParameters.java:293)
at sun.security.x509.AlgorithmId.decodeParams(AlgorithmId.java:132)
at sun.security.x509.AlgorithmId.(AlgorithmId.java:114)
at sun.security.x509.AlgorithmId.parse(AlgorithmId.java:372)
at sun.security.x509.X509Key.parse(X509Key.java:168)
at sun.security.x509.CertificateX509Key.(CertificateX509Key.java:75)
at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:667)
at sun.security.x509.X509CertInfo.(X509CertInfo.java:167)
... 12 more
[ERROR] [2020-09-15 18:48:49] Service.run(386) | service init failed, error message: Failed to initialize the SSLContext: Input stream does not contain valid certificates., error:
javax.net.ssl.SSLException: Failed to initialize the SSLContext: Input stream does not contain valid certificates.
at org.fisco.bcos.channel.handler.ChannelConnections.initSslContext(ChannelConnections.java:562)
at org.fisco.bcos.channel.handler.ChannelConnections.startConnect(ChannelConnections.java:344)
at org.fisco.bcos.channel.client.Service.run(Service.java:332)
at console.ConsoleInitializer.init(ConsoleInitializer.java:121)
at console.ConsoleClient.main(ConsoleClient.java:45)
[ERROR] [2020-09-15 18:48:49] ConsoleInitializer.init(123) | message: Failed to initialize the SSLContext: Input stream does not contain valid certificates., e: {}
javax.net.ssl.SSLException: Failed to initialize the SSLContext: Input stream does not contain valid certificates.
at org.fisco.bcos.channel.handler.ChannelConnections.initSslContext(ChannelConnections.java:562)
at org.fisco.bcos.channel.handler.ChannelConnections.startConnect(ChannelConnections.java:344)
at org.fisco.bcos.channel.client.Service.run(Service.java:332)
at console.ConsoleInitializer.init(ConsoleInitializer.java:121)
at console.ConsoleClient.main(ConsoleClient.java:45)

请问这个问题如何解?谢谢!

console调用addSealer后,返回Transaction receipt timeout问题

搭建了bcos 2.4的一条链,4个节点分别在A和B两台机器上,启动链后,查看节点日志共识正常,使用console连接链,查看getPeers,getSealerList和getConsensusStatus都均正常,但是使用deploy HelloWorld 部署合约的时候报Transaction receipt timeout。
这个怎么排查原因呢?

手动生成的agency.crt解析有误

用openssl 手动生成csr文件后:

openssl req -new -sha256 -key agency.key -out req.csr -config cert.cnf

Subject信息如下:

 Subject: C = CN, ST = suibe, L = Shanghai, OU = suibe, CN = suibe

在控制台里getPeers得到的结果是agency=CN,应该是agency=suibe

python部署智能合约报错:TypeError: isinstance() arg 2 must be a type or tuple of types

(python-sdk) [root@slave03 python-sdk]# ./console.py call HelloWorld 0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c set "Hello" "FISCO"

INFO >> user input : ['call', 'HelloWorld', '0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c', 'set', 'Hello', 'FISCO']

INFO>> client info: channel 192.168.107.214:20200,groupid :1
INFO >> call HelloWorld , address: 0x9e028f06d7cd46d5d8651f2606bcd4dbf404150c, func: set, args:['Hello', 'FISCO']
exception happened!
Traceback (most recent call last):
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit
return method(node, [self.visit(n) for n in node])
File "/data/pythoncode/python-sdk/eth_abi/grammar.py", line 99, in generic_visit
if isinstance(node.expr, expressions.Optional):
TypeError: isinstance() arg 2 must be a type or tuple of types

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "./console.py", line 601, in main
result = tx_client.call_and_decode(fn_name, fn_args)
File "/data/pythoncode/python-sdk/client/common/transaction_common.py", line 202, in call_and_decode
result = super().call(self.contract_addr, contract_abi, fn_name, args)
File "/data/pythoncode/python-sdk/client/bcosclient.py", line 442, in call
functiondata = encode_transaction_data(fn_name, contract_abi, None, args)
File "/data/pythoncode/python-sdk/utils/contracts.py", line 209, in encode_transaction_data
fn_identifier, contract_abi, fn_abi, args, kwargs,
File "/data/pythoncode/python-sdk/utils/contracts.py", line 242, in get_function_info
fn_abi = find_matching_fn_abi(contract_abi, fn_name, args, kwargs)
File "/data/pythoncode/python-sdk/utils/contracts.py", line 89, in find_matching_fn_abi
function_candidates = pipe(abi, name_filter, arg_count_filter, encoding_filter)
File "cytoolz/functoolz.pyx", line 680, in cytoolz.functoolz.pipe
File "cytoolz/functoolz.pyx", line 655, in cytoolz.functoolz.c_pipe
File "/data/pythoncode/python-sdk/utils/abi.py", line 254, in filter_by_encodability
in contract_abi
File "/data/pythoncode/python-sdk/utils/abi.py", line 255, in
if check_if_arguments_can_be_encoded(function_abi, args, kwargs)
File "/data/pythoncode/python-sdk/utils/abi.py", line 275, in check_if_arguments_can_be_encoded
for _type, arg in zip(types, aligned_args)
File "/data/pythoncode/python-sdk/utils/abi.py", line 275, in
for _type, arg in zip(types, aligned_args)
File "/data/pythoncode/python-sdk/eth_abi/codec.py", line 104, in is_encodable
encoder = self._registry.get_encoder(typ)
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 453, in get_encoder
return self._get_registration(self._encoders, type_str)
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 355, in _get_registration
coder = super()._get_registration(mapping, type_str)
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 337, in _get_registration
value = mapping.find(type_str)
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 85, in find
(predicate, value) for predicate, value in self._values.items()
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 86, in
if predicate(type_str)
File "/data/pythoncode/python-sdk/eth_abi/registry.py", line 230, in call
abi_type = grammar.parse(type_str)
File "/data/pythoncode/python-sdk/eth_abi/grammar.py", line 123, in parse
return super().parse(type_str)
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 252, in parse
return self._parse_or_match(text, pos, 'parse')
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 287, in _parse_or_match
return self.visit(getattr(self.grammar, method_name)(text, pos=pos))
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit
return method(node, [self.visit(n) for n in node])
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in
return method(node, [self.visit(n) for n in node])
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in visit
return method(node, [self.visit(n) for n in node])
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 213, in
return method(node, [self.visit(n) for n in node])
File "/root/.pyenv/versions/python-sdk/lib/python3.7/site-packages/parsimonious/nodes.py", line 225, in visit
raise VisitationError(exc, exc_class, node) from exc
parsimonious.exceptions.VisitationError: TypeError: isinstance() arg 2 must be a type or tuple of types

Parse tree:
<Node matching ""> <-- *** We were here. ***

bash contract2java.sh solidity -p org.fisco.bcos.asset.contract 报错,fisco 和console都是3.0.0-rc4

[root@orderer1 console]# bash contract2java.sh solidity -p org.fisco.bcos.asset.contract
*** Compile solidity Asset.sol***
ERROR:convert solidity to java for Asset.sol failed, error info: *** Analysis evm bytecode Asset.sol failed ***
error: tar (child): bzip2:无法 exec: 没有那个文件或目录
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
chmod: 无法访问"/root/.fisco/static_analysis_tools//main_compiled": 没有那个文件或目录
chmod: 无法访问"/root/.fisco/static_analysis_tools//function_inliner_compiled": 没有那个文件或目录
chmod: 无法访问"/root/.fisco/static_analysis_tools//simple_conflict_analysis_compiled": 没有那个文件或目录
chmod: 无法访问"/root/.fisco/static_analysis_tools//generatefacts/generatefacts": 没有那个文件或目录
chmod: 无法访问"/root/.fisco/static_analysis_tools//conflicts_info_parse": 没有那个文件或目录

ERROR stack:
console.contract.exceptions.CompileContractException: *** Analysis evm bytecode Asset.sol failed ***

console v3.0调用预编译合约bug

无法自动在contracts/.compiled/group0文件夹下生成对应的abi和bin文件(这个可以在v2.8中实现),因此会报错abi is empty...的错误,暂时修复方式可以通过deploy命令获得bin和abi文件,然后手动在group0文件夹下创建预编译合约的地址目录,例如预编译合约地址为0000000000000000000000000000000000005001,则需要在console文件夹下创建的目录结构为

contracts/.compiled/group0/0x0000000000000000000000000000000000005001/

在这个目录下放进bin和abi文件即可成功调用预编译合约。

另一个问题是无法通过0x5001这样简短的地址调用,必须要写全,但是这个特性在v2.8是支持的,希望在v3.0中也可以支持

控制台不支持uint256?

合约有参数为uint256时,控制台无法为这个参数输入太大的数,提示:
The 1th parameter of setCount needs integer(-2147483648 ~ 2147483647) value in the console.

控制台启动速度慢

控制台启动速度慢,但并不总是如此。有时候很慢,慢到十秒以上才成功启动,我用控制台连接的都是本机的节点,按照道理来说不应该这么慢才对。不知道是什么环节导致启动这么慢。

执行 start.sh 遇到的问题

Failed to init the console! Failed to initialize the SSLContext: class path resource [sdk.key] cannot be opened because it does not exist
sdk.key 存在,但仍报出该错。如果删除sdk.key会报出node.key不存在,实际也是存在的

使用错误的合约地址调用,产生新块,是否可以在调用之前做一下校验,直接不让他提交交易?

2.3fisco-bcos版本使用mysql做分布式存储,当我使用错误的合约地址调用合约方法的时候,fisco-bcso把它作为了一个错误的交易并且出块。
当前console是对交易回执获取交易状态,然后返回结果到控制台。但是这笔交易已经写在了区块链上。可不可以区块链在加载这个合约地址的时候,是否可以先判断是否存在这个合约,在convertAddress里面加个查询判断?
image
image
因为使用Mysql存储,里面会有合约的表,是否可以区块链给一个查询的接口帮忙做校验,自己直接去数据库查询感觉不科学,理论上账本数据应该有权限控制不应该给外面的人随便调用。
image
不知道是否有必要加这种功能,不加感觉程序员注意一点,也不会出现大问题

多群组部署网络节点,控制台/webase-front无法切换群组的问题

``环境:ubuntu18.04
节点版本:2.9.1
fisco-bcos版本:2.7.2

ipconf内容如下:

127.0.0.1:2 agencyProduce 1
127.0.0.1:2 agencyCustom 1,2,3
127.0.0.1:2 agencyTransit 2
127.0.0.1:2 agencySealer 3

暂时先这么配置,初学区块链,尝试自己用fisco-bcos写一个溯源类的项目,暂时还没有服务器资源,就干自己的CPU吧😄😄

通过tail -f node3/log/*|grep "g:3.*++"查看节点3与群组3之间的共识,结果如图:
image

通过tail -f nodex/log/*lgrep "connected count"查看节点连接数,结果如图:
image

打开控制台,通过switch 2切换,出现:
1689814315786
日志:
1689814366698
webase-front的切换群组也是一样,日志:
1689814444826
之前使用webase-depoly一键部署是可以的,可以在控制台/webase-front切换群组。
恳请哥哥姐姐们,在百忙之中给予指正😊😊😊😊😊

cpp sdk部署hello_world合约示例后无法使用控制台调用合约接口

当前的cpp sdk sample/deploy_hello代码中没有设置abi字段,使用该实例代码部署交易后调用合约接口时可能存在找不到abi的情况

deploy_hello.cpp中设置abi字段为空字符串

微信图片_20231130150700

在控制台查看区块内容,abi为空

微信图片_20231130151310

调用合约接口时报错 Abi is empty, please check contract abi exists.

微信图片_20231130150739

自己手动添加abi字段后,查看区块中已包含abi字段,但仍然无法调用abi接口,添加方式如下

微信图片_20231130151639
微信图片_20231130151713

建议在示例代码中添加abi字段,便于开发者学习如何使用cpp sdk部署合约后调用合约接口

console is terribly slow!

Reference: https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/installation.html

after install console, I'm trying to compile or start console, but it takes 140 minutes to compile HelloWorld examples.

Environment:

# FISCO Version
# 2.8.0

# Java version
/fisco/console$ java -version
openjdk version "11.0.14" 2022-01-18 LTS
OpenJDK Runtime Environment Zulu11.54+23-CA (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.54+23-CA (build 11.0.14+9-LTS, mixed mode)

# OS
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

# hardware8C8G
vendor_id	: AuthenticAMD
cpu family	: 6
model		: 6
model name	: QEMU Virtual CPU version 2.5+
stepping	: 3
cpu MHz		: 2904.026
cache size	: 512 KB
physical id	: 7
siblings	: 1
core id		: 0
cpu cores	: 1
apicid		: 7
initial apicid	: 7
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl cpuid pni cx16 hypervisor lahf_lm svm 3dnowprefetch vmmcall
bugs		: fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 5806.73
TLB size	: 1024 4K pages
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual

部署合约空指针异常

image

检查lib目录下的solc-xxx.jar文件,该文件为solidityjava版本的编译工具,检查该文件是否完整,可以使用unzip solc-xxx.jar,文件能正常解压缩,说明文件完整,否则unzip命令会提示文件不完整。

解决方案:

  1. 建议升级控制台,将控制台升级至1.1.0+的版本,用户不用再手动替换该文件。控制台下载参考链接:
    https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/tutorial/download_console.html

  2. 下载对应的Jar包放入lib目录,下载链接参考:
    https://fisco-bcos-documentation.readthedocs.io/zh_CN/v2.3.0/docs/manual/console.html#jar

【BUG】控制台版本3.4.0使用getGroupNodeInfo 查询某个节点信息 报错

[root@bogon console]# ./start.sh --version
console version: 3.4.0
[group0]: /apps> getGroupPeers
peer0: 63261e5abcba2bfbc03624db41e38192298ef605b67640f3d0c745c3d1c01d155bbe94d1ae33c18083fa4d88447a9bc44324174ae57fc3286b97d0fb007eaece
peer1: f1684ec3fae49f3b291762b06c9742013d61c7f7a6bbccfb10cc45e5753f49b37ab4adf4b1f979ee9c394bba62e9c4f904f05d860370ce55b0395978731c2069
# 使用getGroupNodeInfo  查询某个节点信息 报错:节点不存在
[group0]: /apps> getGroupNodeInfo 63261e5abcba2bfbc03624db41e38192298ef605b67640f3d0c745c3d1c01d155bbe94d1ae33c18083fa4d88447a9bc44324174ae57fc3286b97d0fb007eaece
{
    "code":-4010,
    "msg":"there has no connection available for the node of the group,maybe all connections disconnected or the node does not exist,group: group0 ,node: 63261e5abcba2bfbc03624db41e38192298ef605b67640f3d0c745c3d1c01d155bbe94d1ae33c18083fa4d88447a9bc44324174ae57fc3286b97d0fb007eaece"
}

控制台国密版本 国密版本编译器不完整导致无法发布合约

控制台 的国密版本编译器使用官方文档提供的下载命令,cd console && curl -LO https://www.fisco.com.cn/cdn/deps/tools/solcj/solcJ-all-0.4.25-gm.jar && bash replace_solc_jar.sh solcJ-all-0.4.25-gm.jar

命令正常执行后,也没有报错异常,正常控制台合约无法部署,一直未能发现是jar 包的问题,后续是通过控制台日志,预判可能是jar 不完整导致,经过查验,jar 只有20kb,与完整的jar 7mb差距大,这个问题是一个隐形大坑,往填补。

sol2java指定包名无效

console2.8.0

执行以下命令,指定包名无效,生成的的java类所在包名固定为com

编译合约,后面指定一个Java的包名参数,可以根据实际项目路径指定包名

./sol2java.sh org.fisco.bcos.asset.contract

|-- java
| | com
| | |-- Asset.java
| | |-- Crypto.java
| | |-- HelloWorld.java
| | |-- KVTableTest.java
| | |-- ShaTest.java
| | |-- Table.java
| | `-- TableTest.java

solidity 转 java 失败 : not a valid name

合约在webase上编写完成,但是用sol2java脚本转换时失败,日志输出只有not a valid name,其他啥都没有。

图1:在webase中编译通过,可部署调用。
image

图2:sol2java转换失败。
image

mysql数据不同步?

基于mysql搭建节点,控制台增加数据后mysql可查,但是控制台删除数据后mysql还是不变?

[group:1]> select * from t_demo where name = fruit
{name=fruit, item_id=4, item_name=apple}
1 row in set.
mysql> select * from u_t_demo;
+--------+-------+----------+-------+------------------+----------------------+
| _id_   | _num_ | _status_ | name  | item_id          | item_name            |
+--------+-------+----------+-------+------------------+----------------------+
| 100049 |     6 |        1 | fruit | 0x31             | 0x6170706C6531       |
| 100055 |     6 |        1 | fruit | 0x31             | 0x6F72616E676532     |
| 100066 |     8 |        1 | fruit | 0x33             | 0x62616E616E6133     |
| 100077 |     9 |        0 | fruit | 0x34             | 0x6170706C65         |
+--------+-------+----------+-------+------------------+----------------------+
4 rows in set (0.00 sec)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.