not sure if this is possible, but I was wondering if one function can calculate the gas cost of another function?
Also can a function run a series of computations to match the gas cost of the function?
function checkGasCostToRunFunctionX() public view returns(uint) {
return uint(gasCostOfRunningFunctionX())
}
function functionX() public {
10000000000000000000000 + 10000000000000000000000;
}
function cloneFunctionXGasCost() public {
// small computation
1 + 1;
someKindOfPaddingComputationToMakeThisFunctionCostTheSameAsFunctionX;
}
function checkCloneFunctionCostsSameAsFunctionX() public view returns(uint) {
if (gasCostOfFunctionX == gasCostOfCloneFunction) {
return = true;
}