I am currently trying to use genetic algorithms to automatically generate test cases that for ethereum smart contracts similar to https://ieeexplore.ieee.org/abstract/document/7840029>this paper. In order to do this, I need to be able to evaluate how close a particular function is to satisfying a branch predicate. Looking at the opcodes can tell me when a branch predicate occurs for example:
... SLOAD TIMESTAMP GT DUP1 ISZERO PUSH2 0x10f JUMPI #... More opcodes
In the example above, a value is retreived from storage and compared to the block timestamp. If the value is greater than the timestamp, the execution continues with #... More opcodes and otherwise it jumps to 0x10f. I would like to be able to somehow extract the value for SLOAD and TIMESTAMP at the time of execution.
More generally my question is: Is there any way to get the values that are on the stack when the "GT" opcode is executed? Ideally I would like to do this in pyevm, but another way is also fine if you know it.