基于区块链的毕业设计eth2-comply – eth2符合

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计eth2-comply – eth2符合 是一篇很好的国外资料

eth2-comply

eth2-comply is a no-code platform for Ethereum 2.0 API conformance testing. It provides blackbox conformance testing facilities and a simple syntax for specifying test cases.

Install

Check the release page for the latest eth2-comply binaries and test files.

Usage

eth2-comply --target http://localhost:5051 

CLI arguments:

  • --testsRoot Path to a directory tree on the filesystem containing JSON test cases.
  • --testsRemote URL to a zip file containing a valid tests directory tree. --testsRemote takes precedence over --testsRoot if both are specidied.
  • --outDir Location on the filesystem to download and unpack a zip file specified in --testsRemote. Has no meaning if --testsRemote is not specified.
  • --target URL of any appliance serving the Ethereum 2.0 API.
  • --timeout Time after which to abandon waiting tests. Defaults to 10 minutes. Uses Go duration syntax.
  • --subset The subset of paths to run tests for. For example, set this to “/v1/node” to only run tests for routes in that path. Defaults to “/” (all paths).
  • --failSilent When true, return a 0 code even when tests fail. Defaults to false.

Syntax of test cases

Tests are specified as normal JSON objects. Only one test should be specified per file. Test files should be placed in the appropriate directory according to the API route they activate. Files should be named <expected-status-code>_<seq_num>.json where seq_num is just a unique number to prevent the file name from colliding with any other test case in that directory testing for the same expected status code in that route. The names and filepaths of test files have no bearing on how eth2-comply processes them, this topology is just an organizational methodology.

The following JSON fields have meaning in eth2-comply test case syntax. Any fields not listed have no meaning to eth2-comply and are ignored.

field required value type example
method yes string “GET”
route yes string “/beacon/committees”
reqBody no object {"epoch": "0", "pubkeys": ["0xdeadbeef"]}
queryParams no object {"epoch": "0"}
awaitSlot no int 2666
expectedRespStatus no int 200
expectedRespBody no object [{"slot": "0", "index": "0", "committee": []}]

Most of the fields meaning should be self-explanatory. awaitSlot can be used to make eth2-comply wait until the target node has synced the specified slot before executing the test.

When specifying expected response bodies, know that received and expected responses are canonicalized before being compared. This means that whitespace and key order do not matter in general. Remember that list order does matter; the way a list is specified literally is its canonical form, though nested objects are themselves canonicalized.

Build and run while developing

Build:

make build 

Run:

bazel run -- cmd/eth2-comply:eth2-comply --target http://localhost:5051 --testsRoot $(PWD)/tests 

eth2-compliance

eth2compliance是一个用于以太坊eth2.0api一致性测试的无代码平台。它提供了blackbox一致性测试工具和用于指定测试用例的简单语法。

安装

查看发布页面以获取符合eth2的最新二进制文件和测试文件。

用法

eth2-comply --target http://localhost:5051 

CLI参数:

  • ——包含JSON测试用例的文件系统上目录树的testsRoot路径。
  • –testsRemote URL到包含有效测试目录树的zip文件。–testsRemote优先于–testsRoot(如果两者都指定)。
  • –文件系统上的outDir位置,用于下载和解压缩–testsRemote中指定的zip文件。如果未指定–testsRemote,则没有意义。
  • –为以太坊eth2.0API提供服务的任何设备的目标URL。
  • ——在超时时间之后放弃等待的测试。默认为10分钟。使用Go duration语法。
  • –为其运行测试的路径子集。例如,将其设置为“/v1/node”以仅对该路径中的路由运行测试。默认为“/”(所有路径)。
  • –failSilent为true时,即使测试失败也返回0代码。默认为false。

在开发时生成并运行

测试被指定为普通JSON对象。每个文件只能指定一个测试。测试文件应该根据它们激活的API路由放在适当的目录中。文件应命名为&lt;expected status code&gt;&lt;seq_num&gt;.json,其中seq_num只是一个唯一的数字,以防止文件名与该目录中测试相同预期状态代码的任何其他测试用例发生冲突。测试文件的名称和文件路径与eth2 compliance如何处理它们没有关系,这种拓扑只是一种组织方法。

以下JSON字段在eth2 compliance测试用例语法中有意义。未列出的任何字段对eth2 compliance没有意义,将被忽略。

field required value type example
方法 字符串,“主键”:“0xdead牛肉”]} 查询参数的查询参数
查询参数 没有 对象对象 “/beacon/committees”
reqBody {“eph”的“eph”:“0”} 等待时段 等待时段
queryParams no 2666 {"epoch": "0"}
awaitSlot no int 2666
expectedRespStatus no int 200
expectedRespBody 没有 >不, >不,

大多数字段的含义应该是不言自明的。awaitSlot可用于使eth2符合性在执行测试之前等待目标节点同步了指定的插槽。

在指定预期的响应体时,在进行比较之前,要知道接收到的和预期的响应是规范化的。这意味着空格和键顺序一般不重要。请记住,列表顺序是很重要的;虽然嵌套对象本身是规范化的,但列表的实际指定方式是其规范形式。

Build and run while developing

构建:

make build 

运行:

bazel run -- cmd/eth2-comply:eth2-comply --target http://localhost:5051 --testsRoot $(PWD)/tests 

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/17397.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计eth2-comply – eth2符合

提供最优质的资源集合

立即查看 了解详情