crytic / crytic/crytic-compile

Allow to fail compilation if some libraries are unlinked

Open
#109 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
197
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Using crytic-compile with of contract that requires to link libraries, like this one:

```solidity
library Test {
struct Storage{
bool flag;
}

function set(Storage storage st) public{
st.flag = true;
}

}

contract Contract {
using Test for Test.Storage;
Test.Storage st;

function set() public{
st.set();
}
}
```

could produce a .json file with an invalid `bin` field if the libraries are not provided. For instance:

608060405234801561001057600080fd5b5060cb8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063b8e010de14602d575b600080fd5b60336035565b005b600073`__$71b117f040f276ba3c25e131c37e06e6a0$__`63cb7913b890916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015608657600080fd5b505af41580156099573d6000803e3d6000fd5b5050505056fea165627a7a72305820972574bd81452308fbcf0d1580c1f7dde707b2a5c3024bc32843e80ad812a9be0029

In this case, Echidna will read this field incorrectly because it uses hevm code, that assumes that all the libraries already linked. Please considering allow to crytic-compile to fail this compilation, perhaps by default of adding a flag `--fail-if-unlinked` or something like that, if unlinked libraries are detected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.