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

Contract scripts: Compose with vm.etch, library, or inheritance (E.g. SetPreinstalls) #11892

Open
protolambda opened this issue Sep 12, 2024 · 0 comments
Assignees

Comments

@protolambda
Copy link
Contributor

To compose different scripts, we have different options:

  • vm.etch to temporarily bring in the script contract: works well when the thing is encapsulated, and minimizes compilation time
  • library: works well to mix-in util functions, but means that the script on its own is not calleable. For SetPreinstalls.s.sol we do want to run it on its own (to install preinstalls into the L1 dev genesis). A separate script entry-point, that uses the same library, ends up adding code, but avoids the vm.etch nicely.
  • ineheritance: i.e. mix in the contract into the script; we end up with weird temporarily contract overlap. This is better used for actual contract inheritance, rather than adding utils functions into scope that are supposed to be encapsulated.

SetPreinstalls.s.sol is the current main example, but we may want to set a standard approach, and find more occurrences where scripts can be standardized to work in a consistent way.

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