Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platon_estimateGas 返回的message信息过少 #1819

Closed
shadow-001 opened this issue Aug 3, 2021 · 4 comments
Closed

platon_estimateGas 返回的message信息过少 #1819

shadow-001 opened this issue Aug 3, 2021 · 4 comments
Assignees
Labels
bug 🐛 Something isn't working

Comments

@shadow-001
Copy link

代码中给了require,但是报错信息没有提示,对于开发定位问题非常不友好:
image

个人建议,可以参考eth,给出报错信息:
image

@benbaley benbaley assigned WeiLoy and cheng762 and unassigned cheng762 Aug 9, 2021
@WeiLoy
Copy link
Contributor

WeiLoy commented Aug 9, 2021

在EVM合约的执行中,如果抛出异常了,是会组装成 execution reverted: xxx 返回的,除非合约执行本身返回的是execution reverted错误。
请检查合约是不是按理想情况执行的,可能合约本身存在问题并没有执行到期望的步骤上,导致失败了

@shadow-001
Copy link
Author

execution reverted

用的同一个合约文件,以太坊上调用eth_estimateGas返回提示信息,而platon上没有看到。
我把合约源文件贴出来,您试一下呢。
部署完成后,执行addTime方法即可复现报错:

`pragma solidity =0.5.17;

/**
被部署的合约
*/
contract DeployedContractt{

address public creatorAddr;
uint public createTime;

constructor() public{
    creatorAddr = msg.sender;
    createTime = block.timestamp + 180000;
}

function addTime(address to) external returns(uint){
    require(createTime < now,"too early");
    creatorAddr = to;
    createTime = block.timestamp + 1000;
}

}`

@WeiLoy
Copy link
Contributor

WeiLoy commented Aug 9, 2021

出现该问题的原因是,由于历史原因有两处文件定义了errExecutionReverted错误,旧error未删除,返回的client处和evm中的不同,导致自定义错误为提示

解决:
删除instructions.go中的errExecutionReverted,所有地方改为应用errors.go中新定义的ErrExecutionReverted

@benbaley benbaley added the bug 🐛 Something isn't working label Aug 9, 2021
@benbaley
Copy link
Member

close by done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants