[英]Hyperledger Fabric/Hyperledger Caliper Benchmarking
Been learning a bit about both Hyperledger Fabric and Hyperledger Caliper recently.最近一直在学习一些关于 Hyperledger Fabric 和 Hyperledger Caliper 的知识。
Recently have been following the Hyperledger Caliper Fabric benchmarking tutorial here to learn a bit more about it.最近一直在关注 Hyperledger Caliper Fabric 基准测试教程,以了解更多关于它的信息。
It uses the Fabric Samples network as an example with the sample chaincode used being the asset-transfer-basic javascript.它使用 Fabric Samples 网络作为示例,使用的示例链代码是资产转移基本 javascript。
When running caliper for creating 1000 assets for example.例如,在运行 caliper 以创建 1000 个资产时。
I get an occasional error initializing the test during the asset creation operation, like this:在资产创建操作期间初始化测试时偶尔会出现错误,如下所示:
2021-05-05T21:28:58.344Z - error: [DiscoveryHandler]: compareProposalResponseResults[undefined] - read/writes result sets do not match index=1
2021-05-05T21:28:58.344Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
peer=undefined, status=grpc, message=Peer endorsements do not match
2021.05.05-22:28:58.344 error [caliper] [connectors/v2/FabricGateway] Failed to perform submit transaction [CreateAsset] using arguments [0_231,blue,20,penguin,500], with error: Error: No valid responses from any peers. Errors:
peer=undefined, status=grpc, message=Peer endorsements do not match
The sample chaincode operation is pretty simple:示例链码操作非常简单:
// CreateAsset issues a new asset to the world state with given details.
async CreateAsset(ctx, id, color, size, owner, appraisedValue) {
const asset = {
ID: id,
Color: color,
Size: size,
Owner: owner,
AppraisedValue: appraisedValue,
};
ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));
return JSON.stringify(asset);
}
Is there any particular reason errors like this happen?发生这种错误是否有任何特殊原因? Even if occasionally.
即使偶尔。
The tutorial in caliper explicitly checks out a specific tag in the fabric-samples. caliper 中的教程明确检查了织物样本中的特定标签。 This is because there is a bug in the chaincode examples in the
main
branch which isn't present in the specific git commit.这是因为
main
分支中的链代码示例中有一个错误,该错误在特定的 git 提交中不存在。 That bug causes the problem you are seeing You have actually included that bug in the snippet you posted.该错误导致您看到的问题您实际上已将该错误包含在您发布的代码段中。 In the chaincode it's the line
在链码中它是行
ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));
which is incorrect.这是不正确的。 It should be
它应该是
await ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.