@@ -58,24 +58,34 @@ library SystemContractHelper {
58
58
}
59
59
}
60
60
61
- // Call precompile with given parameters.
62
- // The list of currently available precompiles sha256, keccak256, ecrecover, deployer.
63
- // NOTE: The precompile type depends on `this` which calls precompile, which means that only
64
- // system contracts corresponding to the list of precompiles above can do `precompileCall`.
65
- function precompileCall (PrecompileCall memory _params , uint32 _ergsToBurn ) internal view {
66
- address callAddr = PRECOMPILE_CALL_ADDRESS;
67
- uint256 rawParams = _params.inputMemoryOffset;
68
- rawParams |= uint256 (_params.inputMemoryLength) << 32 ;
69
- rawParams |= uint256 (_params.outputMemoryOffset) << 64 ;
70
- rawParams |= uint256 (_params.outputMemoryLength) << 96 ;
71
-
72
- // After `precompileCall` ergs will be burned down to 0 if there are not enough of them,
73
- // thats why it should be checked before the call.
74
- require (gasleft () >= _ergsToBurn);
75
- assembly {
76
- let success := staticcall (rawParams, callAddr, _ergsToBurn, 0 , 0 , 0 )
77
- }
78
- }
61
+ function packPrecompileParams (
62
+ uint32 inputMemoryOffset ,
63
+ uint32 inputMemoryLength ,
64
+ uint32 outputMemoryOffset ,
65
+ uint32 outputMemoryLength ,
66
+ uint64 perPrecompileInterpreted
67
+ ) external pure returns (uint256 rawParams ) {
68
+ rawParams = inputMemoryOffset;
69
+ rawParams |= uint256 (inputMemoryLength) << 32 ;
70
+ rawParams |= uint256 (outputMemoryOffset) << 64 ;
71
+ rawParams |= uint256 (outputMemoryLength) << 96 ;
72
+ rawParams |= uint256 (perPrecompileInterpreted) << 192 ;
73
+ }
74
+
75
+ // Call precompile with given parameters.
76
+ // The list of currently available precompiles sha256, keccak256, ecrecover, deployer.
77
+ // NOTE: The precompile type depends on `this` which calls precompile, which means that only
78
+ // system contracts corresponding to the list of precompiles above can do `precompileCall`.
79
+ function precompileCall (uint256 _rawParams , uint32 _ergsToBurn ) internal view returns (bool success ) {
80
+ address callAddr = PRECOMPILE_CALL_ADDRESS;
81
+
82
+ // After `precompileCall` ergs will be burned down to 0 if there are not enough of them,
83
+ // thats why it should be checked before the call.
84
+ require (gasleft () >= _ergsToBurn);
85
+ assembly {
86
+ success := staticcall (_rawParams, callAddr, _ergsToBurn, 0 , 0 , 0 )
87
+ }
88
+ }
79
89
80
90
// Allows to perform a call with a custom `msg.sender`.
81
91
function mimicCall (
0 commit comments