Сбой подтверждения Hyperledger Fabric: существует txid - PullRequest
1 голос
/ 09 июля 2019

В настоящее время я пытаюсь успешно вызвать цепной код в сети Hyperledger Fabric с использованием Docker Swarm на основе в этом примере . Моя сеть следующая:

  • org1 с peer0.org1.com + 1 CA org1 + CLI org1 + orderer.example.com из ordererOrg на ПК1
  • org2 с peer0.org2.com + 1 CA org2 на ПК2

Кажется, что моя сеть работает, но как только цепной код создается на одноранговом узле, а затем вызывается, операция не распространяется. Например, я вставляю данные в бухгалтерскую книгу, журналы контейнера с цепочечным кодом показывают, что они обрабатывают данные, и одноранговый контейнер, используемый для вызова цепочечного кода, похоже, правильно подтвердил и симулировал запрос. Все это с помощью команд вручную из CLI.

контейнерные журналы peer0.org1.com

2019-07-09 08:52:08.753 UTC [endorser] EndorseWithPlugin -> DEBU 3784 Entering endorsement for {plugin: escc, channel: mychannel, tx: 50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703, chaincode: fabcar}
2019-07-09 08:52:08.753 UTC [msp.identity] Sign -> DEBU 3785 Sign: plaintext: 0A2040CDC0100B7F12FA1505C311EF86...455254494649434154452D2D2D2D2D0A 
2019-07-09 08:52:08.753 UTC [msp.identity] Sign -> DEBU 3786 Sign: digest: 5E7E6A043E851C3316B08F5CB4A05D31840D213793C55BF14EBE64213E852F84 
2019-07-09 08:52:08.756 UTC [endorser] EndorseWithPlugin -> DEBU 3787 Exiting {plugin: escc, channel: mychannel, tx: 50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703, chaincode: fabcar}
2019-07-09 08:52:08.756 UTC [endorser] endorseProposal -> DEBU 3788 [mychannel][50732326] Exit
2019-07-09 08:52:08.756 UTC [lockbasedtxmgr] Done -> DEBU 3789 Done with transaction simulation / query execution [50732326bbe19c9eb8de42fa327ee67fc2c8102337ef96cdf9ca49fb7a0b7703]
2019-07-09 08:52:08.756 UTC [endorser] func1 -> DEBU 378a Exit: request from 10.0.0.4:34978
2019-07-09 08:52:08.756 UTC [comm.grpc.server] 1 -> INFO 378b unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=10.0.0.4:34978 grpc.code=OK grpc.call_duration=8.895639ms

(успешно выполненный) запрос в бухгалтерской книге показывает, что состояние бухгалтерской книги не изменилось.

Однако, если я использую SDK для узла, предоставленный в примере fabcar из репозитория официальных образцов (invoke.js), для вызова той же операции с цепным кодом, я получаю ошибку:

ошибка узла sdk с узлом invoke.js

2019-07-09T09:22:03.277Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:1 - endorsement failed - Error: failed to execute transaction a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9: error sending: txid: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9(mychannel) exists
Failed to submit transaction: Error: Endorsement has failed

контейнер peer0.org1.com регистрируется после вызова узла

2019-07-09 09:22:03.273 UTC [endorser] callChaincode -> INFO 15480 [mychannel][a0a2570d] Entry chaincode: name:"fabcar" 
2019-07-09 09:22:03.273 UTC [chaincode] Execute -> DEBU 15481 Entry
2019-07-09 09:22:03.273 UTC [chaincode] Execute -> DEBU 15482 Exit
2019-07-09 09:22:03.273 UTC [endorser] callChaincode -> INFO 15483 [mychannel][a0a2570d] Exit chaincode: name:"fabcar"  (0ms)
2019-07-09 09:22:03.273 UTC [chaincode] handleMessage -> DEBU 15484 [a0a2570d] Fabric side handling ChaincodeMessage of type: PUT_STATE in state ready
2019-07-09 09:22:03.273 UTC [endorser] SimulateProposal -> ERRO 15485 [mychannel][a0a2570d] failed to invoke chaincode name:"fabcar" , error: txid: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9(mychannel) exists
github.com/hyperledger/fabric/core/chaincode.(*TransactionContexts).Create
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/transaction_contexts.go:59
github.com/hyperledger/fabric/core/chaincode.(*Handler).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/handler.go:1207
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:313
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Invoke
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:302
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:239
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:147
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:146
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:247
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:500
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler.func1
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:169
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:31
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor
    /opt/gopath/src/github.com/hyperledger/fabric/core/comm/throttle.go:54
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor-fm
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:224
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpclogging/server.go:91
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:30
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:39
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:171
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:982
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1208
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:686
runtime.goexit
    /opt/go/src/runtime/asm_amd64.s:1333
error sending
failed to execute transaction a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:245
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:240
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:147
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:146
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:247
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:500
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:32
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler.func1
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:169
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:31
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor
    /opt/gopath/src/github.com/hyperledger/fabric/core/comm/throttle.go:54
github.com/hyperledger/fabric/core/comm.(*Throttle).UnaryServerIntercptor-fm
    /opt/gopath/src/github.com/hyperledger/fabric/peer/node/start.go:224
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpclogging.UnaryServerInterceptor.func1
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpclogging/server.go:91
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:34
github.com/hyperledger/fabric/common/grpcmetrics.UnaryServerInterceptor.func1
    /opt/gopath/src/github.com/hyperledger/fabric/common/grpcmetrics/interceptor.go:30
github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/grpc-ecosystem/go-grpc-middleware/chain.go:39
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:171
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:982
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1208
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:686
runtime.goexit
    /opt/go/src/runtime/asm_amd64.s:1333
2019-07-09 09:22:03.273 UTC [endorser] SimulateProposal -> DEBU 15486 [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.273 UTC [lockbasedtxmgr] Done -> DEBU 15487 Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.273 UTC [endorser] func1 -> DEBU 15488 Exit: request from 172.18.0.1:51702
2019-07-09 09:22:03.273 UTC [chaincode] HandleTransaction -> DEBU 15489 [a0a2570d] handling PUT_STATE from chaincode
2019-07-09 09:22:03.273 UTC [comm.grpc.server] 1 -> INFO 1548a unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:51702 grpc.code=OK grpc.call_duration=4.573006ms
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548b [a0a2570d] Completed PUT_STATE. Sending RESPONSE
2019-07-09 09:22:03.274 UTC [chaincode] handleMessage -> DEBU 1548c [a0a2570d] Fabric side handling ChaincodeMessage of type: PUT_STATE in state ready
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548d [a0a2570d] handling PUT_STATE from chaincode
2019-07-09 09:22:03.274 UTC [chaincode] HandleTransaction -> DEBU 1548e [a0a2570d] Completed PUT_STATE. Sending RESPONSE
2019-07-09 09:22:03.275 UTC [chaincode] handleMessage -> DEBU 1548f [a0a2570d] Fabric side handling ChaincodeMessage of type: COMPLETED in state ready
2019-07-09 09:22:03.275 UTC [chaincode] Notify -> DEBU 15490 [a0a2570d] notifying Txid:a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, channelID:mychannel
2019-07-09 09:22:03.275 UTC [chaincode] Execute -> DEBU 15491 Exit
2019-07-09 09:22:03.275 UTC [endorser] callChaincode -> INFO 15492 [mychannel][a0a2570d] Exit chaincode: name:"fabcar"  (3ms)
2019-07-09 09:22:03.275 UTC [lockbasedtxmgr] GetTxSimulationResults -> DEBU 15493 Simulation completed, getting simulation results
2019-07-09 09:22:03.275 UTC [lockbasedtxmgr] Done -> DEBU 15494 Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.275 UTC [endorser] SimulateProposal -> DEBU 15495 [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.275 UTC [endorser] endorseProposal -> DEBU 15496 [mychannel][a0a2570d] Entry chaincode: name:"fabcar" 
2019-07-09 09:22:03.275 UTC [endorser] endorseProposal -> DEBU 15497 [mychannel][a0a2570d] escc for chaincode name:"fabcar"  is escc
2019-07-09 09:22:03.275 UTC [endorser] EndorseWithPlugin -> DEBU 15498 Entering endorsement for {plugin: escc, channel: mychannel, tx: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, chaincode: fabcar}
2019-07-09 09:22:03.275 UTC [msp.identity] Sign -> DEBU 15499 Sign: plaintext: 0A20828C242C3048295EE0453AD5EA85...455254494649434154452D2D2D2D2D0A 
2019-07-09 09:22:03.275 UTC [msp.identity] Sign -> DEBU 1549a Sign: digest: F3BEDFED5C78408FD01F0A41C0714245508FD2F5AEF8A34F33E7F3C61DEFF987 
2019-07-09 09:22:03.275 UTC [endorser] EndorseWithPlugin -> DEBU 1549b Exiting {plugin: escc, channel: mychannel, tx: a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9, chaincode: fabcar}
2019-07-09 09:22:03.276 UTC [endorser] endorseProposal -> DEBU 1549c [mychannel][a0a2570d] Exit
2019-07-09 09:22:03.276 UTC [lockbasedtxmgr] Done -> DEBU 1549d Done with transaction simulation / query execution [a0a2570dd9a4ce0c696ab08263320927382c6f3db046843dca70a96b63a97da9]
2019-07-09 09:22:03.276 UTC [endorser] func1 -> DEBU 1549e Exit: request from 172.18.0.1:51702
2019-07-09 09:22:03.276 UTC [comm.grpc.server] 1 -> INFO 1549f unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.18.0.1:51702 grpc.code=OK grpc.call_duration=6.750666ms

Я попробовал некоторые решения, найденные на SO, такие как:

  • установление якорных пиров для каждой организации: уже сделано
  • setting CORE_PEER_LISTENADDRESS=org1.example.com:7051 -> сбой одноранговых контейнеров. Если я установлю адрес 0.0.0.0:7051, контейнеры начнутся снова, но ошибка останется прежней
  • перезапуск Docker / удаление томов / повторная загрузка изображений: ничего не изменилось

Дополнительные баллы:

Заказчик, похоже, не уведомлен, как мы видим в его журналах .

Когда я использую node invoke.js, я иногда получаю эту ошибку, которая исчезает, когда я снова запускаю команду. Одноранговые журналы не показывают ошибку.

узел invoke.js несогласованная ошибка

2019-07-09T14:13:21.232Z - error: [AbstractStrategy]: constructor: No event hubs for strategy
Failed to submit transaction: Error: No event hubs for strategy

Когда я делаю запрос с использованием узла, иногда я получаю следующую ошибку:

несоответствующая ошибка узла query.js

2019-07-09T13:23:13.602Z - error: [SingleQueryHandler]: evaluate: message=No peers available to query. Errors: [], stack=FabricError: No peers available to query. Errors: []
at SingleQueryHandler.evaluate (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:39:17)
at Transaction.evaluate (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/transaction.js:246:29)
at Contract.evaluateTransaction (/home/path_to_dir/app/javascript/node_modules/fabric-network/lib/contract.js:172:39)
at main (/home/path_to_dir/app/javascript/query.js:47:39)
at <anonymous>, name=FabricError
Failed to evaluate transaction: FabricError: No peers available to query. Errors: []

Эта ошибка обычно исчезает, когда я снова запускаю запрос, но время от времени выскакивает. Когда запрос поступает из CLIorg1, он никогда не выполняется.

Некоторые, вероятно, полезные файлы: configtx.yaml

крипто-config.yaml

докер-Compose-org1.yaml

докер-Compose-org2.yaml

РЕДАКТИРОВАТЬ: добавлен файл insert.js и журналы после попытки узла insert.js (см. Комментарии)

Информация о конфигурации HLF 1.4.1; Докер 18.09.7; docker-compose 1.23.2; узел v8.16.0; нпм 6.4.1; Ubuntu 18.04.2 LTS

Извините за множество ошибок, которые делают вопрос широким, но я предполагаю, что они каким-то образом связаны с проблемой одобрения. Если нет, не стесняйтесь редактировать / пинговать меня, чтобы сузить его.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...