问题描述
关于Hyperledger Sawtooth如何处理由开发人员错误或由开发人员自愿创建的无限循环的问题,我找不到任何具体的东西(只有有关 IntKey 事务系列 Intkey工作负载命令以错误的URL无限循环运行.).
I could not find anything concrete about how Hyperledger Sawtooth handles the problem of infinite loops created by mistake or voluntarily by the developer (Only some issues regarding the IntKey transaction family Intkey workload command run in endless loop with wrong URL).
我确定在Hyperledger Fabric 上,链代码执行超时的概念可避免创建无限循环,但是Hyperledger Sawtooth 中使用哪种机制?
I am sure that on Hyperledger Fabric the concept of the timeout of chain code execution avoids the creation of infinite loops, but which mechanism is used in Hyperledger Sawtooth?
谢谢!
推荐答案
最好的方法是测试自定义事务处理器.编写事务处理器的一个常见错误是返回码. InternalError
应该是暂时性错误(某些内部错误,例如内存不足"是暂时的),并且如果重试可能会成功.验证器使用TP重试事务,并导致循环.如果事务无效,则可能要引发InvalidTransaction
错误.底线—会重试内部错误,并且不会重试无效的交易.
The best thing to do is to test your custom transaction processor. A common mistake in writing transaction processors is the return code. InternalError
is supposed to be a transient error (some internal fault like 'out of memory' that is temporary), and may succeed if retried.The validator retries the transaction with the TP and results in a loop.If the transaction is invalid, you probably want to raise an InvalidTransaction
error instead.Bottom line—internal errors are retried, and invalid transactions are not retried.
为使您的区块链更能抵抗故障交易处理器,我强烈建议以并行模式运行Validator.这样一来,如果在事务处理器中遇到一些错误,就可以处理其他事务.要以并行处理模式运行,请使用sawtooth-validator --scheduler parallel -vv
To make your blockchain more resistent to faulty transaction processors I strongly suggest running the Validator in parallel mode. That would make it possible for other transactions to be processed in case of some bug is hit in a transaction processor. To run in parallel processing mode use sawtooth-validator --scheduler parallel -vv
Sawtooth验证程序还会检查与事务处理器的连接,并删除那些没有响应(挂起或冻结)的连接.
The Sawtooth Validator also checks connections with transaction processors and those that do not respond (are hung or frozen) are removed.
关于您有关DoS缓解的后续问题,锯齿中有一个背压测试.背压是一种流量控制技术,有助于防止DoS攻击.如果验证器不堪重负,它将停止接受新批次,直到可以处理更多工作为止.验证器可以接受的批次数基于乘数QUEUE_MULTIPLIER(当前为10,以前为2)乘以已发布批次数的滚动平均值.
as for your follow-up question about DoS mitigation, there is a back pressure test in Sawtooth. Back pressure is a flow-control technique to help prevent DoS attacks. If the validator is overwhelmed it will stop accepting new batches until it can handle more work. The number of batches that validator can accept is based on a multiplier, QUEUE_MULTIPLIER (currently 10, formerly 2), times a rolling average of the number of published batches.
此外,您可以将Sawtooth网络置于VPN的后面.锯齿是一种许可的企业级区块链,并非设计用于公共Internet.
Also, one can put the Sawtooth network behind a VPN. Sawtooth is a permissioned enterprised blockchain and is not designed for use in the public Internet.
这篇关于Hyperledger Sawtooth如何处理无限/无限循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!