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

MultiHashWrapper and Spawner are more appropriate to be libraries #281

Closed
fulldecent opened this issue Nov 18, 2019 · 3 comments
Closed

Comments

@fulldecent
Copy link
Contributor

Currently contract MultiHashWrapper is implemented as a contract. Because this module has no storage and no external functions, it is appropriate to implement this as a library.
Similarly for Spawner.

Recommendation: switch these to libraries
References:

@thegostep
Copy link
Contributor

@fulldecent Using a library for Spawner would add gas overhead of a delegate call for every clone produced. I don't see a benefit for it?

@thegostep thegostep mentioned this issue Nov 21, 2019
21 tasks
@fulldecent
Copy link
Contributor Author

fulldecent commented Nov 21, 2019

A "library" contract with no external functions is implemented a little differently.

... code of internal library functions and all functions called from therein will at compile time be pulled into the calling contract, and a regular JUMP call will be used instead of a DELEGATECALL.

https://solidity.readthedocs.io/en/v0.5.13/contracts.html#libraries

So basically contract and library are equivalent here and the choice can be made based on whichever is semantically preferred or easier to reason about.

@thegostep
Copy link
Contributor

Ah, I see. Will keep as is for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants