solidity/test/libsolidity/smtCheckerTests/abi/abi_encode_with_sig_simple.sol

33 lines
1.4 KiB
Solidity
Raw Normal View History

2020-12-10 13:06:34 +00:00
contract C {
function abiEncodeSimple(string memory sig, bool t, uint x, uint y, uint z, uint[] memory a, uint[] memory b) public pure {
require(x == y);
bytes memory b1 = abi.encodeWithSignature(sig, x, z, a);
bytes memory b2 = abi.encodeWithSignature(sig, y, z, a);
assert(b1.length == b2.length);
2020-12-18 18:10:32 +00:00
// Disabled because of nondeterminism in Spacer Z3 4.8.9
//bytes memory b3 = abi.encodeWithSignature(sig, y, z, b);
//assert(b1.length == b3.length); // should fail
2020-12-10 13:06:34 +00:00
bytes memory b4 = abi.encodeWithSignature(sig, t, z, a);
assert(b1.length == b4.length); // should fail
bytes memory b5 = abi.encodeWithSignature(sig, y, y, y, y, a, a, a);
assert(b1.length != b5.length); // should fail
assert(b1.length == b5.length); // should fail
bytes memory b6 = abi.encodeWithSignature("f()", x, z, a);
assert(b1.length == b6.length); // should fail
}
}
2021-03-31 15:11:54 +00:00
// ====
// SMTEngine: all
2022-11-23 18:53:21 +00:00
// SMTIgnoreOS: macos
2020-12-10 13:06:34 +00:00
// ----
2021-03-31 15:11:54 +00:00
// Warning 5667: (107-122): Unused function parameter. Remove or comment out the variable name to silence this warning.
2023-02-09 16:07:13 +00:00
// Warning 6328: (543-573): CHC: Assertion violation happens here.
// Warning 6328: (664-694): CHC: Assertion violation happens here.
// Warning 6328: (713-743): CHC: Assertion violation happens here.
2022-11-23 15:51:06 +00:00
// Warning 6328: (824-854): CHC: Assertion violation happens here.
2023-02-09 16:07:13 +00:00
// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.