The main problem with the previous method was that it only worked
if the contract being validated inside the block was sharing the same
errors object as the contract calling it. The old implementation
was incapable of incorporating errors from a contract that had its
own errors object.
In my opinion it's a code smell that our contracts use the #errors
of the model they are validating as the place to store their validation
result, however I didn't dare touching this yet, because changing that
would certainly be a huge change. I can also imagine that some places rely
on it for historic reasons (because using "classic" validations also
puts the errors on the model). However, I think that no two contracts
should RELY on using the SAME errors object, just because the way we implemented
them happens to cause them to share the same object.
There were cases were the writable parameter of a parent contract would
take precedence of the child contract writable parameter when the parent
condition is a lambda: a child could say `writable: true` and it would
still be the parent `writable: -> { false }` that would "win" because
when reducing and evaluating `writable_conditions`, only lambda are
considered.
This commit fixes the issue by adding extensive tests and putting both
lambdas AND true/false values in the `writable_conditions` hash.