SMTChecker: Support block.slotnum - #16884
Conversation
de7e001 to
41109ad
Compare
|
The problem was in the z3 library. It segfaults when built from sources. Detailed report below: z3 4.13.3 macOS CI Segfault — Investigation ReportSymptomCircleCI macOS jobs ( Root causeThe Confirmed via lldb, the crash is a null-pointer dereference inside z3 itself: At Reproduced deterministically (5/5) with our project's exact CMake-based Hypotheses ruled outEach of the following was tested by rebuilding z3 from source with the
The official release is built on Azure DevOps ( Fix applied
Committed on Other changes kept on
|
| # NOTE: We use the official prebuilt release rather than building from source. A z3 built | ||
| # from source with this project's exact CMake config (universal x86_64;arm64 binary) was | ||
| # found to reliably segfault (null pointer read in Spacer's array model-based-projection | ||
| # code, ast_manager::are_equal at ast.cpp:1607) on at least one of our CHC queries, while | ||
| # the official prebuilt binary handles the same query without issue. z3 is only ever | ||
| # invoked here as an external CLI subprocess (never linked into solc/soltest), so the | ||
| # prebuilt binary is sufficient and matches how cvc5 is installed just above. |
There was a problem hiding this comment.
Why is this change dumped into an unrelated feature PR? Even if it was discovered during its implementation, it sounds like a the crash is not even triggered by slotnum (clanker's comment mentions external_hash_known_code_state_unsafe_trusted, aon_blog_post, abi_encode_with_selector_vs_sig). This should be a separate PR.
There was a problem hiding this comment.
This is strictly related to the slotnum change. After increasing the resource limit (required after adding block.slotnum to libsolidity/formal) for the solver this library started crashing because it’s build locally in different environment then local I used for tests. There is a bug in the implementation described here. Better solution is to update the z3 version but not sure we wanna do it. It will probably introduce more updates in test results.
There was a problem hiding this comment.
I agree with @cameel, it seems to me this PR is doing three (somewhat) unrelated things:
- Changing the Z3 binary we use for OSX on CircleCI
- Bumping resource limit for Z3
- Actually adding support for
slotnum
I did not quite get why we need to do the first two points (though at least the first one seems reasonable).
If the first two points are necessary, I also think they should be done in a separate PRs.
There was a problem hiding this comment.
This is strictly related to the
slotnumchange.
It still does not sounds to me like it is. Z3 has a bug regardless of whether we trigger it or not. slotnum is not the only possible way to trigger it, is it? Those test names I cited seem to indicate otherwise.
In any case, switching to pre-built Z3 is more like CI configuration change. It's good that you put it in a separate commit at least, but I'd go further and in general avoid quietly bundling such changes into feature PRs. It's hard to keep up with what's happening in the codebase if one can't have a good guess at what a PR does from the title.
Better solution is to update the z3 version but not sure we wanna do it.
We do. We even discussed that on the call last week. @blishko wanted to do it pretty soon. But if switching to pre-built Z3 also fixes the bug, I think it's fine to do it regardless. The update sounded like it will be complicated.
There was a problem hiding this comment.
Yes slotnum was a way to trigger it, of course not the only one probably.
Switching to prebuild is already merged with the explanation how it crashes and the repro described in the PR. I separated the Z3 query from our tests to trigger this bug without using solidity testing framework.
I would not separate the resource limit increasing change to its own PR because it’s strictly related to the change. It does not happen without block.slotnum addition to the tx type constraints.
There was a problem hiding this comment.
This is the error when run without resource increasing.
https://app.circleci.com/pipelines/github/argotorg/solidity/43635/workflows/fd8d19c3-830f-4c40-bca6-585fc731f4c8/jobs/2092528
|
|
||
| Compiler Features: | ||
| * SMTChecker: Emit a deprecation warning for the BMC engine. | ||
| * SMTChecker: Increase the default z3 resource limit (used when no explicit `--model-checker-timeout` is given) to give the solver more headroom for harder queries. |
There was a problem hiding this comment.
Why does the changelog only mention this configuration tweak and not the point of the PR, which is the fact that it adds slotnum support to SMTChecker?
There was a problem hiding this comment.
Right. This should be added too.
3430c25 to
4401ad4
Compare
c27ac60 to
23c5d83
Compare
23c5d83 to
a0c2f9a
Compare
…s instead of crashing."
…lting test regressions.
…t able to solve with extended tx type constraints.
| * General: Improve performance throughout the compiler using Boost's flat versions of unordered set and map. | ||
| * General: Remove support for the experimental Generic Solidity prototype (`pragma experimental solidity`). | ||
| * SMTChecker: Emit a deprecation warning for the BMC engine. | ||
| * SMTChecker: Support `block.slotnum` in BMC and CHC engines. |
There was a problem hiding this comment.
| * SMTChecker: Support `block.slotnum` in BMC and CHC engines. | |
| * SMTChecker: Support `block.slotnum`. |
No need to mention the engines.
block.slotnum support in SMT solver.block.slotnum
Description
This PR introduce support for
block.slotnumin the SMT solver. It’s moved to a separated PR as there is unresolved resource issue.block.slotnum.Depends on #16881
AI Disclosure
Claude Code, Anthropic's CLI for Claude (running on the Sonnet 5 model).