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

Unexpected returns in pure function call with require statements #365

Open
imterryyy opened this issue Jul 14, 2023 · 1 comment
Open

Unexpected returns in pure function call with require statements #365

imterryyy opened this issue Jul 14, 2023 · 1 comment

Comments

@imterryyy
Copy link
Collaborator

imterryyy commented Jul 14, 2023

I try to test an require statements on pure function
Code below:

pragma solidity 0.8.19;

contract Test {
    function test1() public pure returns(uint256) {
        require(false, "Fail");

        return 1;
    } 
}

Result when call test1:

Screenshot 2023-07-14 at 11 05 01

Expected Result:

Screenshot 2023-07-14 at 11 04 15
@imterryyy
Copy link
Collaborator Author

Return on Tomochain Testnet:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000044661696c00000000000000000000000000000000000000000000000000000000"
}

Return on Ethereum Sepolia:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 3,
    "message": "execution reverted: Fail",
    "data": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000044661696c00000000000000000000000000000000000000000000000000000000"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant