Contracts are not supposed to be use for error checking / input validation. Quoting docs for enforce: "Also, do not use enforce inside of contracts (i.e. inside of in and out blocks and invariants), because they will be compiled out when compiling with -release. Use assert in contracts. "

Contracts are supposed to verify that there are no fundamental flaws in internal logic of the program which will immediately pop up in test / debug runs. This may imply very expensive sanity checks that are not welcome in release builds for performance reasons.

In your case you should simply move `enforce` to the function body and remove contract.

Reply via email to