转载请注明出处:https://www.cnblogs.com/zhizaixingzou/p/10122209.html
https://solidity-cn.readthedocs.io/zh/develop/control-structures.html?highlight=revert%20
经过实际程序来看下:
pragma solidity ^0.4.12;
contract DataStore {
constructor () public {
require(80==11, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
}
}
部署的时候就会返回为revert,此时的校验不过说明字符串在程序结果的hReturn中保存:
08c379a0
0000000000000000000000000000000000000000000000000000000000000020
000000000000000000000000000000000000000000000000000000000000002e
6161616161616161616161616161616161616161616161616161616161616161
6161616161616161616161616161000000000000000000000000000000000000
解析这个结果时需要先去掉函数签名的4个字节。
结果输出如下: