Better handling of concrete keccaks
karmacoma-eth opened this issue · comments
karmacoma commented
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "forge-std/Test.sol";
contract Test49 is Test {
function test_concreteKeccak_up() external {
bytes32 hash = keccak256(abi.encodePacked(uint256(3)));
uint256 bit = uint256(hash) & 1;
if (uint256(hash) & 1 == 0) {
console2.log("even");
} else {
console2.log("odd");
}
}
function test_concreteKeccak_lookup() external {
bytes32 hash = keccak256(abi.encodePacked(uint256(3)));
uint256 bit = uint256(hash) & 1;
string[] memory x = new string[](2);
x[0] = "even";
x[1] = "odd";
console2.log(x[bit]);
}
}
Running 2 tests for test/49_concreteKeccak.t.sol:Test49
[FAIL] test_concreteKeccak_lookup() (paths: 0/1, time: 0.02s, bounds: [])
WARNING:Halmos:Encountered symbolic memory offset: 224 + 32*Concat(0, Extract(0, 0, sha3_256(3)))
(see https://github.com/a16z/halmos/wiki/warnings#internal-error)
[console.log] even
[console.log] odd
[PASS] test_concreteKeccak_up() (paths: 2/2, time: 0.03s, bounds: [])
Symbolic test result: 1 passed; 1 failed; time: 0.06s
ideally we don't want the symbolic memory offset error and only a single console.log