Consensys/scribble

Scribble doesnt work for instrumenting libraries

cd1m0 opened this issue · 1 comments

cd1m0 commented

Given the following sample:

library Foo {
        /// #if_succeeds $result == 1;
        function foo() internal returns (uint) {
                return 1;
        }
}

Scribble will produce code that looks like this:

...
library Foo is __scribble_ReentrancyUtils {
function foo() internal returns (uint RET_0) {
        RET_0 = _original_Foo_foo();
        unchecked {
            if (!(RET_0 == 1)) {
                emit AssertionFailed("0: ");
                assert(false);
            }
        }
    }
...

This doesn't compile as libraries can't inherit from other contracts. The only reason that inheritance is there is to provide the AssertionFailed event. We should special-case this and add that event directly to libraries when they need instrumentation.

Note that we also need to introduce an error message whenever a user tries to define a constant on a library - as that also is currently stored in the utils contract.

cd1m0 commented

Fixed by #189