【问题标题】:Hyperledger Fabric/Hyperledger Caliper BenchmarkingHyperledger Fabric/Hyperledger Caliper 基准测试
【发布时间】:2021-05-05 22:05:44
【问题描述】:

最近学习了一些有关 Hyperledger Fabric 和 Hyperledger Caliper 的知识。

最近一直在关注 Hyperledger Caliper Fabric 基准测试教程here 以了解更多信息。

它使用 Fabric Samples 网络作为示例,使用的示例链代码是资产转移基本 javascript。

例如在运行 caliper 以创建 1000 个资产时。

在资产创建操作期间初始化测试时偶尔出现错误,如下所示:

    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

示例链码操作非常简单:

// 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);
    }

发生此类错误是否有任何特殊原因?即使偶尔。

【问题讨论】:

    标签: hyperledger-fabric hyperledger caliper hyperledger-caliper


    【解决方案1】:

    caliper 中的教程明确检查了 fabric-samples 中的特定标签。这是因为 main 分支中的链代码示例中有一个错误,该错误在特定的 git 提交中不存在。该错误导致您看到的问题 您实际上已将该错误包含在您发布的 sn-p 中。在链码中是一行

    ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));
    

    这是不正确的。应该是

    await ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));
    

    【讨论】:

    • 就是这样!奇怪的是我没有想到失踪的等待。谢谢!
    • 我也遇到了同样的问题。现在解决了!谢谢@david_k
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    • 2017-12-24
    • 1970-01-01
    相关资源
    最近更新 更多