Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile only what has changed #581

Closed
travs opened this issue Nov 29, 2018 · 4 comments
Closed

Compile only what has changed #581

travs opened this issue Nov 29, 2018 · 4 comments

Comments

@travs
Copy link
Contributor

travs commented Nov 29, 2018

Compiling takes around 2 mins on an i7 which limits how fast we can prototype and test the solidity code.
We could take advantage of caching to only compile the contracts that have changed and their dependants.

I know how to do this with make but it means maintaining a Makefile (not that big a deal if that's what we have to do), but maybe there is a better way that you guys know of. jake looks like it may be useful, or maybe this compiler or that one, but I haven't had time to experiment with any of this.

As a side effect, we could also cache in CI and shave a few minutes off our builds.

@schmidsi @fubhy Thoughts?

@travs travs added the feature label Nov 29, 2018
@schmidsi
Copy link
Contributor

Yes, I observed the same effect. Actually, after adding the interfaces. It seems to slow compilation down tremendously.

One big problem at the moment is that we recompile all contracts all the time. It is possible to only recompile a specific contract and its dependencies. In fact, I already started to implement this functionality here: https://github.com/melonproject/protocol/blob/a4ee46f78c8d9c803978008a6319b24c6bfb3ace/bin/compile.ts#L39:L68 but did not properly end it.

Solidity-cli looks interesting too.

I will play around a bit with these two solutions.

@travs
Copy link
Contributor Author

travs commented Nov 30, 2018

Just to clarify what I mean about the tree: if we make changes to just one contract, only that contract and its dependants (not dependencies) need to be recompiled.

Simple example:

"->" = depends on

A -> B
B -> C

If we change B here, we don't need to recompile C, but only A and B.

@travs travs reopened this Nov 30, 2018
@travs travs changed the title Compile with cache Compile only what has changed Nov 30, 2018
@schmidsi
Copy link
Contributor

Thanks for the clarification. The problem is, that I don't know yet, how to use C's already compiled bytecode from cache, during recompilation of B. That's why we just have to recompile C when B is compilling.

To actually have the changes mirrored to A, one needs to compile everything, or explicitly target A: yarn compile path/to/A.sol.

@travs
Copy link
Contributor Author

travs commented Mar 23, 2020

Compiling is sufficiently fast now that we got rid of some external contracts we were compiling with our own.

@travs travs closed this as completed Mar 23, 2020
SeanJCasey added a commit that referenced this issue Nov 1, 2021
* feat: add exit fees

* chore: update deployment

* chore: add helper utils

* test: add test suites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants