@@ -87,6 +87,31 @@ struct ModelCheckerEngine
8787 bool operator ==(ModelCheckerEngine const & _other) const noexcept { return bmc == _other.bmc && chc == _other.chc ; }
8888};
8989
90+ enum class InvariantType { Contract, Reentrancy };
91+
92+ struct ModelCheckerInvariants
93+ {
94+ // / Adds the default targets, that is, all except underflow and overflow.
95+ static ModelCheckerInvariants Default () { return *fromString (" default" ); }
96+ // / Adds all targets, including underflow and overflow.
97+ static ModelCheckerInvariants All () { return *fromString (" all" ); }
98+
99+ static std::optional<ModelCheckerInvariants> fromString (std::string const & _invs);
100+
101+ bool has (InvariantType _inv) const { return invariants.count (_inv); }
102+
103+ // / @returns true if the @p _target is valid,
104+ // / and false otherwise.
105+ bool setFromString (std::string const & _target);
106+
107+ static std::map<std::string, InvariantType> const validInvariants;
108+
109+ bool operator !=(ModelCheckerInvariants const & _other) const noexcept { return !(*this == _other); }
110+ bool operator ==(ModelCheckerInvariants const & _other) const noexcept { return invariants == _other.invariants ; }
111+
112+ std::set<InvariantType> invariants;
113+ };
114+
90115enum class VerificationTargetType { ConstantCondition, Underflow, Overflow, UnderOverflow, DivByZero, Balance, Assert, PopEmptyArray, OutOfBounds };
91116
92117struct ModelCheckerTargets
@@ -123,7 +148,7 @@ struct ModelCheckerSettings
123148 // / might prefer the precise encoding.
124149 bool divModNoSlacks = false ;
125150 ModelCheckerEngine engine = ModelCheckerEngine::None();
126- bool invariants = false ;
151+ ModelCheckerInvariants invariants = ModelCheckerInvariants::Default() ;
127152 bool showUnproved = false ;
128153 smtutil::SMTSolverChoice solvers = smtutil::SMTSolverChoice::All();
129154 ModelCheckerTargets targets = ModelCheckerTargets::Default();
0 commit comments