链版本升级,由2.2.1升级至2.3.0版本后,升级合约失败
【问题分类】
- bug
- P2P网络相关(包含libp2p,liquid)
- 链账户身份与权限相关(证书问题、public、多签投票问题)
- 核心交易引擎相关(交易池、DAG)
- 共识相关
- 智能合约相关
- 存储相关
- SDK相关
- 长安链CMC工具
- 长安链管理台
- 长安链浏览器
- 长安链合约IDE
- 长安链web签名插件
- 跨链相关
- 轻节点相关
- 隐私计算相关
- 密码学相关
- 环境依赖
- 其他补充:
【问题描述】(请对问题进行描述,方便定位问题)
问题1
- 按照官方文档进行长安链版本升级,并升级docker-vm的镜像至chainmaker-vm-engine:v2.3.0.1版本;
- 修改合约的内容,按照新版本合约的开发规范进行修改,并修改相应的build.sh脚本,生成新的合约new_contrct.7z;
- 升级cmc工具,并使用工具将new_contrct.7z进行升级;
- 此时,cmc的sdk日志报错:
2023-01-05 18:09:03.989 [DEBUG] [SDK] v2@v2.3.1/sdk_common.go:59 [SDK] begin to QUERY system contract, [method:GET_TX_BY_TX_ID]/[txId:173761d292da115fcae6084fc0a9287bc38871dd43ae4716a6d23f4bc73b7653]
2023-01-05 18:09:04.025 [DEBUG] [SDK] v2@v2.3.1/sdk_client.go:260 [SDK] proposalRequest resp: code:CONTRACT_FAIL message:"txStatusCode:4, resultCode:1, contractName[CHAIN_QUERY] method[GET_TX_BY_TX_ID] txType[QUERY_CONTRACT], no such transaction, chainId:dev_lcago" contract_result:<code:1 message:"no such transaction, chainId:dev_lcago" > tx_id:"173761d2a87d0792cae7bced200cf234263c4eb3e428460bb24a9b5f8beae4b2"
- 查看节点日志报错:
2023-01-05 18:09:13.546 [ERROR] [Vm] @dev_lcago v2@v2.3.1/runtime.go:221 handle tx [173761d292da115fcae6084fc0a9287bc38871dd43ae4716a6d23f4bc73b7653] failed, fail to receive response in 9 secs and return timeout response, <step: "RUNTIME_PREPARE_TX_REQUEST", start time: 2023-01-05 18:09:04.545803744 +0800 CST, step cost: 0.040363ms, until cost: 0.039597ms, msg: pos:0> <step: "RUNTIME_GRPC_SEND_TX_REQUEST", start time: 2023-01-05 18:09:04.545844242 +0800 CST, step cost: 0ms, until cost: 0ms, msg: msgSize:738>
2023-01-05 18:09:13.565 [ERROR] [Core] @dev_lcago scheduler/scheduler.go:583 failed to run vm for tx id:173761d292da115fcae6084fc0a9287bc38871dd43ae4716a6d23f4bc73b7653,contractName:CONTRACT_MANAGE, tx result:code:CONTRACT_FAIL contract_result:<code:1 message:"contract upgrade fail, tx timeout" > , error:contract upgrade fail, tx timeout
2023-01-05 18:14:27.018 [ERROR] [Vm] @dev_lcago v2@v2.3.1/runtime.go:221 handle tx [173762195d18f1dbca853fe169de1628eae8d3e85f10497b8f79098529bced6a] failed, fail to receive response in 9 secs and return timeout response, <step: "RUNTIME_PREPARE_TX_REQUEST", start time: 2023-01-05 18:14:18.017927841 +0800 CST, step cost: 0.031972ms, until cost: 0.031484ms, msg: pos:0> <step: "RUNTIME_GRPC_SEND_TX_REQUEST", start time: 2023-01-05 18:14:18.017959947 +0800 CST, step cost: 0ms, until cost: 0ms, msg: msgSize:598>
2023-01-05 18:14:27.018 [ERROR] [Core] @dev_lcago scheduler/scheduler.go:583 failed to run vm for tx id:173762195d18f1dbca853fe169de1628eae8d3e85f10497b8f79098529bced6a,contractName:CONTRACT_MANAGE, tx result:code:CONTRACT_FAIL contract_result:<code:1 message:"contract initial fail, tx timeout" > , error:contract initial fail, tx timeout
2023-01-05 18:21:23.577 [ERROR] [Vm] @dev_lcago v2@v2.3.1/runtime.go:221 handle tx [1737627a669086c5ca330ef50c4df4bdf22fd18fba544e4faa3f56c0d2281de6] failed, fail to receive response in 9 secs and return timeout response, <step: "RUNTIME_PREPARE_TX_REQUEST", start time: 2023-01-05 18:21:14.576164536 +0800 CST, step cost: 0.035934ms, until cost: 0.035482ms, msg: pos:0> <step: "RUNTIME_GRPC_SEND_TX_REQUEST", start time: 2023-01-05 18:21:14.576200588 +0800 CST, step cost: 0ms, until cost: 0ms, msg: msgSize:598>
2023-01-05 18:21:23.578 [ERROR] [Core] @dev_lcago scheduler/scheduler.go:583 failed to run vm for tx id:1737627a669086c5ca330ef50c4df4bdf22fd18fba544e4faa3f56c0d2281de6,contractName:CONTRACT_MANAGE, tx result:code:CONTRACT_FAIL contract_result:<code:1 message:"contract initial fail, tx timeout" > , error:contract initial fail, tx timeout
问题2
- 为了进一步确认问题,又做了如下操作,通过cmc工具进行了链配置的升级,升级成功;
cmc client chainconfig block updateblockinterval --sdk-conf-path=./lcago.yml --admin-key-file-paths=./dev.lcago.cer.org/user/admin1/admin1.tls.key,./dev.hello-bike.cer.org/user/admin1/admin1.tls.key,./dev.qdmetro.cer.org/user/admin1/admin1.tls.key,./dev.gov1.cer.org/user/admin1/admin1.tls.key --admin-crt-file-paths=./dev.lcago.cer.org/user/admin1/admin1.tls.crt,./dev.hello-bike.cer.org/user/admin1/admin1.tls.crt,./dev.qdmetro.cer.org/user/admin1/admin1.tls.crt,./dev.gov1.cer.org/user/admin1/admin1.tls.crt --block-interval 300
- 通过cmc工具查看此时的链配置,发现block-interval已经是升级的后配置,但是block verison还是显示v2.2.1,这是正常的吗?截图如下:
cmc client chainconfig query --sdk-conf-path=./lcago.yml
说明
- chainmaker和chainmaker-vm-engine都是通过docker的版本运行,并且在chainmaker的容器中能够访问通vm的rpc端口,链和vm版本如下;
- contract的go.mod中的sdk引用版本如下;
- 节点中有关于contract版本的警告日志如下;
2023-01-05 19:00:20.075 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:00:20.095 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:00:50.069 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:01:20.037 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:01:20.056 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:01:50.043 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:02:20.068 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:02:20.081 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
2023-01-05 19:02:50.070 [WARN] [Rpc] rpcserver/api_service.go:295 txStatusCode:16, resultCode:1, contractName[cc4] method[invoke_contract] txType[QUERY_CONTRACT], incorrect vm go runtime version, you only have go part configured in chainmaker.yml's vm module, but your contract sdk version < v2.3.0, it needs docker_go part
具体的现象,操作步骤,前置条件等,尽可能描述清楚,有截图说明更佳
【相关日志文件】(如果有报错日志请贴图,或者上传附件)
chainmaker-go 的 log/system.log & bin/panic.log file *
SDK 的 sdk.log file
【系统信息】(请填写系统信息,方便定位问题)
- chainmaker-go version * : [v2.3.0]
- OS & version * :
- docker镜像 version:
-
管理台 version:
- 如果是管理台的相关问题,请附带管理台版本,如果不是可忽略。
-
区块浏览器 version:
- 如果是浏览器的相关问题,请附带浏览器版本,如果不是可忽略。
-
合约IDE version:
- 如果是合约IDE的相关问题,请附带合约IDE版本,如果不是可忽略。
-
web签名插件 version:
- 如果是web签名插件的相关问题,请附带web签名插件版本,如果不是可忽略。
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information