I was wondering if anyone knows a way of how to prove that a certain function of a solidity smart contract was executable (i.e. not reverting) after the fact without calling the function itself, e.g. by proving that a past state would have resulted in the function to execute successfully.
EDIT:
Complexity arises due to the fact that the proof should be done on-chain, after the function was executable in the past. I.e. one would require some sort of proof that can be verified on-chain that the EVMs state in the past would have allowed a particular function to return a certain value, without sending a tx to the function at the time it should become available.
Example:
contract Test
{
uint256 public testNum;
address public owner;
constructor () public
{
owner = msg.sender;
testNum = 1;
}
function returnTrueIfGreaterThanTen()
public view returns(bool)
{
require(testNum > 10);
return true;
}
// WE DONT KNOW AT WHAT BLOCK THIS FUNCTION WILL BE CALLED and CANNOT CHANGE ITS CONTENT
function setTestNum(uint256 _newNum)
onlyOwner
{
testNum = _newNum;
}
}
In this case, is there a way to prove on-chain at block height 100 that returnTrueIfGreaterThanTen() was returning true at block height 90 in the past, without actually calling the function at the time it becomes executable (at block height 90)?
In other words, can I check whether someone should call a function without calling it myself and punish this person for not calling the function retrospectively by proving that the person could have indeed successfully called that function in the past?
An idea would be for example implementing a view function that, given the correct state of the EVM at block 90, returns a value that proves when submitted at block 100, that the function was indeed executable and returning true.