前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >2019-04-26 使用Testeth跑ewasm测试集

2019-04-26 使用Testeth跑ewasm测试集

作者头像
oracle3
发布2022-05-13 08:26:43
1710
发布2022-05-13 08:26:43
举报
文章被收录于专栏:oracle3技术大杂烩

准备工作比较多,以下都是在ubuntu18环境下

1、编译Testeth

最好参考2019-04-24 使用Testeth跑以太坊测试集

确保基本测试可以通过

代码语言:javascript
复制
git clone --recursive https://github.com/ethereum/aleth.git
cd aleth
mkdir build; cd build  # Create a build directory.
cmake ..               # Configure the project.
cmake --build .        # Build all default targets.

2、编译hera

可以参考2018-11-26 ewasm在以太坊私有链测试

代码语言:javascript
复制
cd ../../
git clone https://github.com/ewasm/hera --recursive
cd hera
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON
cmake --build .

然后把动态库复制到testeth的目录下

代码语言:javascript
复制
cp src/libhera.so ../../aleth/build/test/.

3、拉取ewasm测试用例

代码语言:javascript
复制
cd ../../
git clone https://github.com/ewasm/tests.git

然后复制两个目录到testeth的目录下

代码语言:javascript
复制
cp tests/GeneralStateTests/stEWASMTests/* aleth/test/jsontests/GeneralStateTests/stEWASMTests/.
cp tests/src/GeneralStateTestsFiller/stEWASMTests/* aleth/test/jsontests/src/GeneralStateTestsFiller/stEWASMTests/.

4、执行测试集

代码语言:javascript
复制
cd aleth/build/test/
./testeth -t GeneralStateTests/stEWASMTests -- --vm ./libhera.so --singlenet "Byzantium"

测试单个用例:

代码语言:javascript
复制
./testeth -t GeneralStateTests/stEWASMTests -- --vm ./libhera.so --singletest callCode --singlenet "Byzantium"

显示结果:

代码语言:javascript
复制
[2019-04-26 16:21:04.623418] [0x00007fc85b02fb00] [info]    Loaded EVMC module: hera 0.2.3-alpha.0-3+commit.6fc7cb40 (./libhera.so)
Running tests using path: "../../test/jsontests"
Running 1 test case...
Test Case "stEWASMTests": 
100%
Executing message in Hera
importGlobals
[0] callCode 186a0 0 20 20 1
Executing message in Hera
importGlobals
[1] storageStore 0 20
[0] storageStore 80 60

*** No errors detected

5、调试信息

参考# Debugging Ethereum Reference Tests

代码语言:javascript
复制
cd aleth/build
rm -rfd *
cmake .. -DVMTRACE=1
make
cd build/test
./testeth -t GeneralStateTests/stEWASMTests -- --vm ./libhera.so --singletest createCode --singlenet "Byzantium" --verbosity 3 --vmtrace --statediff

显示:

代码语言:javascript
复制
TEST createCode:
TRACE 06-04 12:16:31 testeth exec   Paying 7 Mwei from sender for gas (7000000 gas at 1 wei)
Executing message in Hera
importGlobals
[0] create 40 100 66 96
Executing message in Hera
importGlobals
[1] finish 200 2
[0] storageStore 0 80
[0] storageStore 20 60
DEBUG 06-04 12:16:31 testeth overlaydb Closing state DB
INFO  06-04 12:16:31 testeth state  trNetID: Byzantium
trDataInd: 0 tdGasInd: 0 trValInd: 0

INFO  06-04 12:16:31 testeth state  
2adc25665018aa1fe0e6bc666dac8fc2697ff9ba
'balance' : ['0x00', '+=', '0x013240']
'balance' : ['0x00', '->', '0x013240']
'newlyCreated' : ['true']

a94f5374fce5edbc8e2a8697c15331677e6ebf0b
'balance' : ['0x174876e800', '+=', '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff953040']
'balance' : ['0x17480c1840', '+=', '0x699d80']
'balance' : ['0x174876e800', '->', '0x174875b5c0']
'nonce' : ['0x04', '->', '0x05']

deadbeef00000000000000000000000000000000
'nonce' : ['0x00', '->', '0x01']
'storage' : ['0x01 : 0x00', '->', '0x01 : 0xf2048c36a5536fea3bc71d49ed59f2c65c546eea000000000000000000000000']

f2048c36a5536fea3bc71d49ed59f2c65c546eea
'code' : ['0x', '->', '0xbeef']
'newlyCreated' : ['true']
'nonce' : ['0x00', '->', '0x01']
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-05-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、编译Testeth
  • 2、编译hera
  • 3、拉取ewasm测试用例
  • 4、执行测试集
  • 5、调试信息
相关产品与服务
区块链
云链聚未来,协同无边界。腾讯云区块链作为中国领先的区块链服务平台和技术提供商,致力于构建技术、数据、价值、产业互联互通的区块链基础设施,引领区块链底层技术及行业应用创新,助力传统产业转型升级,推动实体经济与数字经济深度融合。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档