Closed lethalgem closed 1 month ago
And emit a huge warning to the user saying 'this predicate cannot be satisfied' or something..? With the constraint in question ideally. Removing all the other constraints is probably overkill.
Removing all the other constraints is probably overkill.
Why is that? I realize that no one should deploy a contract that contains predicates that always fail so it really doesn't matter. However, and at the risk of being pedantic here, there is not sense in generating unnecessary bytecode for any successful compile.
OK, sure, since this is an optimisation then if it's on it should minimise the contract. Fair enough. So as per the other optimisation discussion if we have a (hidden or not) flag to disable optimisations then everything should remain.
It just felt a bit weird to 'punish' the good constraints for being associated with a bad one, but I guess it really is just DCE. It's like having a return
at the start of main()
-- there's no point in emitting any other functions in the program. :slightly_smiling_face:
If any
constraints
evaluate tofalse
just remove every constraint there is and add aconstraint false
. You know the program is going to fail every single time and every otherconstraint
is useless. Effectively this is just merging all theconstraints
into the simplest form.