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

wip: forge script warns when calling eoa #5036

Conversation

markus0x1
Copy link

@markus0x1 markus0x1 commented May 24, 2023

Motivation

Deployment scripts do not verify the existence of a contract before invoking its functions.
This can lead to challenges in determining the success or failure of a deployment script, as every call to an call to an externally owned accounts (EOAs) return a success flag,

For example, the script below will not issue an error when getting deployed and decodes the setNum calls as if they were regular function calls.

contract C {
   function setNum(uint256 _num) public returns (uint256){
       num = _num;
   }
}
contract Deploy is Script {
   function run() external {
       C c = new C(); // contract is not deployed!
       vm.startBroadcast( );
       require(c.setNum(1) == 1, "setNum failed");
   }
}

Solution

Issue a warning when calling a address with available abi and no code deployed.

@markus0x1 markus0x1 changed the title feat: forge script warns when calling eoa wip: forge script warns when calling eoa May 24, 2023
@markus0x1 markus0x1 closed this May 30, 2023
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 this pull request may close these issues.

1 participant