@@ -93,18 +93,23 @@ contract TestSuite {
9393 uint256 value = precompile.Payable {value: 42 }();
9494 assert (value == 42 );
9595
96- callNonPayable (0 , "" );
97- callNonPayable (1 , abi.encodePacked (_expectedNonPayableErrorMsg));
96+ bytes4 nonPayable = IPrecompile.NonPayable.selector ;
97+ callNonPayable (nonPayable, 0 , "" );
98+
99+ bytes memory err = abi.encodePacked (_expectedNonPayableErrorMsg);
100+ callNonPayable (nonPayable, 1 , err);
101+ callNonPayable (IPrecompile.View.selector , 1 , err);
102+ callNonPayable (IPrecompile.Pure.selector , 1 , err);
98103
99104 emit Called ("Transfer() " );
100105 }
101106
102- function callNonPayable (uint256 value , bytes memory expectRevertWith ) internal {
107+ function callNonPayable (bytes4 selector , uint256 value , bytes memory expectRevertWith ) internal {
103108 // We can't use just call `precompile.NonPayable()` directly because
104109 // (a) it's a precompile and (b) it doesn't return values, which means
105110 // that Solidity will perform an EXTCODESIZE check first and revert.
106- bytes memory selector = abi.encodeWithSelector (IPrecompile.NonPayable. selector );
107- (bool ok , bytes memory ret ) = address (precompile).call {value: value}(selector );
111+ bytes memory data = abi.encodeWithSelector (selector);
112+ (bool ok , bytes memory ret ) = address (precompile).call {value: value}(data );
108113
109114 if (expectRevertWith.length == 0 ) {
110115 assert (ok);
0 commit comments