necessist icon indicating copy to clipboard operation
necessist copied to clipboard

Reduce removal of nonbuildable statements

Open 0xPhaze opened this issue 1 year ago • 2 comments

I see a few examples of where the exception list could be refined, however some might require some static analysis. We could include exceptions for .function in vm.function and abi.function. With further analysis .Struct for Interface.Struct shouldn't be removed as well as .function in contract.function.

test/Test.t.sol:4457:11-4457:45: `.assume(_relayer > address(0x09));` nonbuildable
test/Test.t.sol:4458:9-4458:40: `vm.assume(_oracle != _relayer);` passed
test/Test.t.sol:4458:11-4458:40: `.assume(_oracle != _relayer);` nonbuildable
test/Test.t.sol:4461:9-4461:32: `vm.roll(startingBlock);` failed
test/Test.t.sol:4461:11-4461:32: `.roll(startingBlock);` nonbuildable
test/Test.t.sol:4466:35-4466:105: `.ProtocolFeeSettings(false, payable(address(0)), true, address(0), 0);` nonbuildable
test/Test.t.sol:4467:13-4467:91: `endpoint.updateProtocolFeeSettings("TestLibrary", 1, abi.encode(feeSettings));` passed
test/Test.t.sol:4467:21-4467:91: `.updateProtocolFeeSettings("TestLibrary", 1, abi.encode(feeSettings));` nonbuildable
test/Test.t.sol:4467:69-4467:89: `.encode(feeSettings)` nonbuildable
test/Test.t.sol:4470:46-4470:98: `.encode(false, address(_oracle), address(_relayer));` nonbuildable
test/Test.t.sol:4472:20-4472:121: `.encode(10, 10, 10, 10, _oracle, _relayer, address(this), address(0), address(0), true, true, false);` nonbuildable
test/Test.t.sol:4482:38-4482:49: `.encode(i);` nonbuildable
test/Test.t.sol:4483:45-4483:56: `.encode(i);` nonbuildable
test/Test.t.sol:4484:54-4484:71: `.encode(_relayer)` nonbuildable

0xPhaze avatar Aug 10 '23 10:08 0xPhaze

Looking at your output, I think I see a bug:

test/Test.t.sol:4457:11-4457:45: `.assume(_relayer > address(0x09));` nonbuildable

Removing a method call is not supposed to remove a trailing semicolon.

Fixing that bug should eliminate at least some nonbuildable outcomes. 😬

smoelius avatar Aug 10 '23 13:08 smoelius

Version 0.2.1 should address some of these problems.

smoelius avatar Aug 11 '23 17:08 smoelius