【发布时间】:2021-10-15 00:08:56
【问题描述】:
我正在 Hyperledger Fabric v2.3.3 上设置基于密钥的背书策略。
我的链码背书政策是"OR('org1.peer','org2.peer','org3.peer','org4.peer')",对于一个非常具体的密钥,背书政策是"AND('org1.peer','org2.peer')"。第一次提交事务时,它可以正常工作,因为那时链码背书策略有效,但是当我尝试更新相同的密钥时,它不起作用。节点fabric-sdk仅将背书请求发送到1个组织,即org1(调用者),对等方拒绝该块并抛出“背书策略失败”。
当我验证区块时,我看到该交易仅由org1 认可,而不是由org1 和org2 认可。似乎 fabric-sdk 没有将交易发送到其他组织。
但是,如果我将我的链码背书策略更改为 "AND('org1.peer','org2.peer','org3.peer','org4.peer')",一切都会正常工作,因为 fabric-sdk 会将交易发送给每个组织的对等方进行背书。
官方文档说
In practice, this means that the key-level endorsement policy can be either less restrictive or more restrictive than the chaincode-level or collection-level endorsement policies.
但从上述情况来看,它似乎只能减少限制。 对等日志:
2021-10-14 11:05:24.443 UTC [gossip.privdata] StoreBlock -> INFO 36d Received block [207] from buffer channel=assetschannel
2021-10-14 11:05:24.450 UTC [vscc] Validate -> ERRO 36e VSCC error: stateBasedValidator.Validate failed, err validation of key PUB-TEST-6 (coll'':ns'assets') in tx 207:0 failed: signature set did not satisfy policy
2021-10-14 11:05:24.454 UTC [committer.txvalidator] validateTx -> ERRO 36f Dispatch for transaction txId = b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e returned error: validation of key PUB-TEST-6 (coll'':ns'assets') in tx 207:0 failed: signature set did not satisfy policy
2021-10-14 11:05:24.454 UTC [committer.txvalidator] Validate -> INFO 370 [assetschannel] Validated block [207] in 5ms
2021-10-14 11:05:24.459 UTC [validation] preprocessProtoBlock -> WARN 371 Channel [assetschannel]: Block [207] Transaction index [0] TxId [b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
2021-10-14 11:05:24.495 UTC [kvledger] commit -> INFO 372 [assetschannel] Committed block [207] with 1 transaction(s) in 36ms (state_validation=0ms block_and_pvtdata_commit=6ms state_commit=29ms) commitHash=[35570558fc04d3dfa400f053f2a0f9bed92ea227c894ae4536990627a5a19036]
fabric-sdk 日志:
2021-10-14T11:05:24.491Z - warn: [TransactionEventHandler]: strategyFail: commit failure for transaction "b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e": TransactionError: Commit of transaction b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e failed on peer peer1.org1.com:7051 with status ENDORSEMENT_POLICY_FAILURE
2021-10-14T11:05:24.491Z - warn: [TransactionEventHandler]: strategyFail: commit failure for transaction "b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e": TransactionError: Commit of transaction b13b21ddd0cb351b93b47ccc556ea4b62bf41abd3a23a3734d56304c91e6066e failed on peer peer1.org1.com:7051 with status ENDORSEMENT_POLICY_FAILURE
【问题讨论】:
标签: hyperledger-fabric hyperledger hyperledger-chaincode hyperledger-fabric-peer