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

Refactor common forc crate structure #6774

Open
kayagokalp opened this issue Dec 5, 2024 · 0 comments
Open

Refactor common forc crate structure #6774

kayagokalp opened this issue Dec 5, 2024 · 0 comments

Comments

@kayagokalp
Copy link
Member

We currently have two crates that are generally shared between forc tools and crates we have, those are:

  1. forc-util
  2. forc-tracing

Use of the word util is hinting an anti-pattern has emerged in our code base and close examination of the contents after years of active development on these repos confirmed this suggestion. Currently forc-util contains:

  1. Common error handling (ForcError)
  2. cli_examples macro for easily writing cli tests
  3. bytecode identifier logic
  4. restricted checks that prevents some keywords to be used in project creation etc
  5. Exports of common paths forc uses like user_forc_dir, git_checkouts_dir etc
  6. Print helpers
  7. Compiler diagnostic formatting

As it can be seen we have a wide array of things that is hosted in that repo. We should aim to distribute this and ideally eliminate calling something util to prevent this ever happening again in the future as well, as calling something util crates the unwanted piling of everything in single place.

Solution

We discussed the following:

  1. 6 and 7 can be moved to forc-tracing and that can be renamed to forc-dignostic to be a little bit more generic.
  2. 1 and 2 can go to a new crate, which will potentially call forc-types
  3. 3 should be moved to the crate it is actually called from
  4. 4 can be moved to forc-pkg as all package name etc verification stuff happens in forc-pkg
  5. 5 is undecided, either leave it as forc-util, potentially change the name of the crate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant