solidity/test/libsolidity/smtCheckerTests/special/block_vars_chc_internal.sol
Rodrigo Q. Saramago feba4de509
Add paris constraints to SMTChecker
Co-authored-by: Daniel <daniel@ekpyron.org>
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
Co-authored-by: Leo <leo@ethereum.org>
2023-01-31 11:03:04 +01:00

43 lines
1.4 KiB
Solidity

contract C {
address coin;
uint dif;
uint prevrandao;
uint gas;
uint number;
uint timestamp;
function f() public {
coin = block.coinbase;
dif = block.difficulty;
prevrandao = block.prevrandao;
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
assert(prevrandao > 2**64); // should hold
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
assert(prevrandao == block.prevrandao); // should hold with CHC
assert(gas == block.gaslimit); // should hold with CHC
assert(number == block.number); // should hold with CHC
assert(timestamp == block.timestamp); // should hold with CHC
assert(coin == address(this)); // should fail
}
}
// ====
// SMTEngine: chc
// SMTIgnoreOS: macos
// ----
// 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.