2021-09-06 22:14:28 +00:00
contract C {
address coin ;
uint dif ;
2023-01-19 13:06:23 +00:00
uint prevrandao ;
2021-09-06 22:14:28 +00:00
uint gas ;
uint number ;
uint timestamp ;
function f ( ) public {
coin = block . coinbase ;
dif = block . difficulty ;
2023-01-19 13:06:23 +00:00
prevrandao = block . prevrandao ;
2021-09-06 22:14:28 +00:00
gas = block . gaslimit ;
number = block . number ;
timestamp = block . timestamp ;
g ( ) ;
}
function g ( ) internal view {
assert ( uint160 ( coin ) >= 0 ) ; // should hold
assert ( dif >= 0 ) ; // should hold
2023-01-19 13:06:23 +00:00
assert ( prevrandao > 2 ** 64 ) ; // should hold
2021-09-06 22:14:28 +00:00
assert ( gas >= 0 ) ; // should hold
assert ( number >= 0 ) ; // should hold
assert ( timestamp >= 0 ) ; // should hold
assert ( coin == block . coinbase ) ; // should hold with CHC
assert ( dif == block . difficulty ) ; // should hold with CHC
2023-01-19 13:06:23 +00:00
assert ( prevrandao == block . prevrandao ) ; // should hold with CHC
2021-09-06 22:14:28 +00:00
assert ( gas == block . gaslimit ) ; // should hold with CHC
assert ( number == block . number ) ; // should hold with CHC
assert ( timestamp == block . timestamp ) ; // should hold with CHC
2021-09-16 17:18:26 +00:00
assert ( coin == address ( this ) ) ; // should fail
2021-09-06 22:14:28 +00:00
}
}
// ====
// SMTEngine: chc
2022-08-26 12:33:59 +00:00
// SMTIgnoreOS: macos
2021-09-06 22:14:28 +00:00
// ----
2023-01-19 13:06:23 +00:00
// Warning 8417: (155-171): Since the VM version paris, "difficulty" was replaced by "prevrandao", which now returns a random number based on the beacon chain.
// Warning 8417: (641-657): Since the VM version paris, "difficulty" was replaced by "prevrandao", which now returns a random number based on the beacon chain.
// Warning 6328: (932-961): CHC: Assertion violation happens here.
2023-02-09 16:07:13 +00:00
// Info 1391: CHC: 12 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.