-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lithium: a Rust-native back end #1321
base: master
Are you sure you want to change the base?
Conversation
Wow, thanks! I'm not sure why the CI is not running. Even if it's a draft, I was wondering if you considered moving |
I think the CI doesn't run because of the merge conflicts. I'll move the code to a separate create as soon as I figure out how to avoid circular dependencies. |
The PR looks like a good start. I think that once it is cleaned up, we should merge it in with a stub native verifier so that we do not need to worry about getting large conflicts. |
We'll probably soon get some merge conflicts in |
@JakuJ In our meeting, we discussed what would be the best way to proceed and agreed that the work should be split into two PRs:
The clean-up PR should add
Notice that the |
Is there a clear advantage in splitting |
A test or two are still failing, but I'm going to switch from draft mode now. I suppose some quality-of-life improvements are necessary for the general public to find this usable, in particular:
I'll be chipping away at these improvements when I have the time, and in the meantime I would appreciate a code review. |
I notice that the PR runs |
To be removed when we want to merge this into Prusti. Committing for now since it's relevant to my thesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this script into the scripts
folder?
// 0. Apply Lithium overrides if necessary | ||
if let Ok(true) = env::var("PRUSTI_NATIVE_VERIFIER").map(|s| s.parse::<bool>().unwrap_or(false)) { | ||
settings.set_default("viper_backend", "Lithium").unwrap(); | ||
settings.set_default("verify_specifications_backend", "Lithium").unwrap(); | ||
settings.set_default("encode_bitvectors", true).unwrap(); | ||
settings.set_default("enable_purification_optimization", true).unwrap(); | ||
settings.set_default("unsafe_core_proof", true).unwrap(); | ||
settings.set_default("verify_core_proof", false).unwrap(); | ||
settings.set_default("inline_caller_for", true).unwrap(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case of this new PRUSTI_NATIVE_VERIFIER
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouping all required flags into one, to facilitate switching between the backends. Alternatively I could check if viper_backend == "Lithium"
.
Why an environment variable? For some reason if I do
if settings.get_bool("native_verifier").unwrap_or(false) {
...
}
at the end (after the -P
arguments) and provide it via cargo-prusti -- -Pnative_verifier=true
it breaks everything, including the building of prusti-contracts
🤨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are various reasons why I'd suggest to undo this change and look for another solution:
- The
native_verifier
andviper_backend
flags are partially overlapping. - The code checks the environment variable
PRUSTI_NATIVE_VERIFIER
, but does not work if the same flag is set via-P
. This goes against the current design of the configuration flags. - Changing the default of some flags depending on the value of some flags looks like the kind of thing that easily leads to surprises and hard-to-debug issues. We were forced to do it in one case (
DEFAULT_PRUSTI_*
) because of the way cargo works, but in this PR I think that we have more freedom to choose a better solution.
If Lithium requires a specific set of flags, what about just implementing runtime checks like we do here? Moreover, if a set of tests require a long combination of flags, what about adding one entry here, with a new test folder such as prusti-tests/tests/verify_lithium
?
This is a draft PR outlining the work on a new Rust-native back end for Prusti, developed in connection to my Master's thesis. The aim is to, among others, evaluate the performance benefits of going straight from CFG to SMT-LIB and decoupling from Viper.
The project is in its initial stages and so the code is highly volatile. Everything is subject to change. The purpose of this PR is to give Prusti developers an overview of the work being done in order to avoid double work, conflicts etc.