Skip to content

Error when trying to verify a contract that uses tx.origin state variable #174

@jcrreis

Description

@jcrreis

Hello again,

I'm trying to verify the following contract with solc-verify, but it is returning to me an error, that i guess is because this tool can't deal with tx.origin, can you confirm?

Code:

 /// @notice postcondition msg.sender == owner
    /*
        solc-verify can't deal with tx.origin state variable..
    */
    function transfer(address payable _to, uint _amount) public payable{
        require(tx.origin == owner, "Not owner");

        (bool sent, ) = _to.call{value: _amount}("");
        require(sent, "Failed to send Ether");
    }

Command:

solc-verify.py Phishingtxorigin.sol  --show-warnings

output:

Phishingtxorigin.sol:42:17: solc-verify error: Member without corresponding declaration: origin
Phishingtxorigin.sol:41:5: solc-verify warning: Errors while translating function body, will be skipped
Wallet::[constructor]: OK
Attack::[constructor]: OK
Attack::attack: OK
Wallet::transfer: SKIPPED
No errors found.

Also i get errors when using Selfdestruct and delegatecall solidity functions, all these functions were available in 0.7.*, so i'm confused why this tool can't deal with them..

Can you help me on this @hajduakos ? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions