Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Compiler Features:

Bugfixes:
* SMTChecker: Fix incorrect analysis when only a subset of contracts is selected with `--model-checker-contracts`.
* SMTChecker: Fix internal compiler error when string literal is used to initialize user-defined type based on fixed bytes.


### 0.8.29 (2025-03-12)
Expand Down
6 changes: 4 additions & 2 deletions libsolidity/formal/SMTEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,10 @@ void SMTEncoder::visitAddMulMod(FunctionCall const& _funCall)
void SMTEncoder::visitWrapUnwrap(FunctionCall const& _funCall)
{
auto const& args = _funCall.arguments();
solAssert(args.size() == 1, "");
defineExpr(_funCall, expr(*args.front()));
smtAssert(args.size() == 1, "Expected exactly one argument to wrap/unwrap");
auto const& funType = dynamic_cast<FunctionType const&>(*_funCall.expression().annotation().type);
auto const* argType = funType.parameterTypes().front();
defineExpr(_funCall, expr(*args.front(), argType));
}

void SMTEncoder::visitObjectCreation(FunctionCall const& _funCall)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type MyBytes is bytes2;

contract C {
MyBytes b = MyBytes.wrap("ab");

function check() view public {
assert(MyBytes.unwrap(b) == 0); // should fail
assert(MyBytes.unwrap(b) == 0x6162); // should hold
}
}
// ====
// SMTEngine: chc
// ----
// Warning 6328: (118-148): CHC: Assertion violation happens here.\nCounterexample:\n\n\nTransaction trace:\nC.constructor()\nC.check()
// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.