ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
22.64k stars 5.61k forks source link

ICE in `Z3Interface::fromZ3Expr()` when running tests on Arch Linux #15196

Open MariusVanDerWijden opened 2 weeks ago

MariusVanDerWijden commented 2 weeks ago

Trying to compile solidity from source I run into this:

******************************************/solidity/test/soltest.cpp(120): error: in "smtCheckerTests/try_catch/try_5": Exception during extracted test: /solidity/libsmtutil/Z3Interface.cpp(398): Throw in function solidity::smtutil::Expression solidity::smtutil::Z3Interface::fromZ3Expr(const z3::expr&)
Dynamic exception type: boost::wrapexcept<solidity::smtutil::SMTLogicError>
std::exception::what: SMT assertion failed
[solidity::util::tag_comment*] = SMT assertion failed

I think I'm building solidity_0.8.26

Steps to repro:

yay -S solidity
Renato03110 commented 2 weeks ago

Try Disabling the SMT Checker: As mentioned in my previous response, you can try compiling Solidity with the SMT checker disabled by using the --no-auto-solve or --no-smt compiler options. This may allow the compilation to succeed, but you'll lose the benefits of the formal verification provided by the SMT checker.

MariusVanDerWijden commented 2 weeks ago

This is compilation straight from the arch user repositories https://aur.archlinux.org/packages/solidity I think @spixmaster maintains it, maybe he could disable the SMT checker on the package

Spixmaster commented 2 weeks ago

I will take a look at it.

cameel commented 2 weeks ago

This is definitely a bug that we should fix. These assertions do not fail in our CI so I suspect this has something to do with the difference in Z3 versions. We're still running our tests on 4.12 and it's possible that 4.13 has introduced something new that the current code assumes won't happen.

@blishko @pgebal maybe you could take a look? We should also finally update to 4.13 (#15198).

@Spixmaster Yeah, if this is failing then disabling the SMT checker is probably the best course of action until we release 0.8.27 with a fix. Another workaround might be to use older Z3 (if that's indeed the issue), but that does not seem to be possible on Arch Linux since it ships the latest one.

Spixmaster commented 2 weeks ago

I am done with my testing. I did not experience the issues before because I did not have z3 or cvc4 installed. With it, the compilation succeeds but the tests did not finish. After 90 minutes instead of the normal 70 minutes I stopped. The progress bar was stuck somewhat over 80% at the same spot for like 30 minutes.

I am not sure whether this is an issue or expected behaviour and the process would have finished.

cameel commented 2 weeks ago

It's likely they'd finish if you gave them more time. IIRC the last time I checked (which was quite a while ago) they were taking ~30% of the time needed to run the whole suite. And the suite is quite extensive so it takes a lot of time to run it all. In CI we heavily rely on parallelization to make that manageable.

blishko commented 2 weeks ago

I will start investigating on Monday. I remember that some time ago I tried using Z3 4.13 and ran into an issue with SMTChecker tests. It seemed like Z3 ignored our resource limit and continued running for a long time on one test.

Spixmaster commented 2 weeks ago

That would conform to my observation.