-
Notifications
You must be signed in to change notification settings - Fork 664
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
fix(core): remove actix dependency from near-primitives #2511
fix(core): remove actix dependency from near-primitives #2511
Conversation
3c916d3
to
130ebbc
Compare
…rotocol/nearcore into fckt/extract-actix-from-primitives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment
env/Cargo.toml
Outdated
@@ -0,0 +1,9 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crate is essentially a place where we dump stuff that we don't know where else to put. I don't think root of nearcore is a good place for it and I think it should have a more descriptive name.
In general, instead of extracting actix from the primitives crate we should be extracting stuff used by the runtime into finer grained crates, leaving everything else behind in the primitives crate. It requires revisiting every type from primitives used by the runtime and deciding which category of primitives it better represents. It is a much harder thing to do than just cutting out actix from dependencies, but it actually what we want to do -- we want to break monolithic primitives crate into smaller but meaningful crates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Max, this new crate works around the dependency issue, but it has a completely non-descriptive name. Given we cannot come up with a better name, I consider it is an indicator that we need to think more about the proper separation.
I also suggest we start working towards a better project structure and only create the new crates following some schema, e.g. there is one suggested here: #1881
I believe that the best documentation is a self-descriptive source code. I feel that there is some room for improvement in nearcore in this direction, so whatever opportunity we have with refactoring, we should take it to improve things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Max and Frol. env
is quite confusing.
Thank you for your feedback, folks.
You're right, this is hard to come up with a good name for this (but it's better the to extract this from near-primitives). The goal of this change is not bring a perfect solution. What's makes up this crate unique:
Keeping in mind these properties I don't see a category which suits all properties listed (in #1881 (comment)): Maybe the best approach would be just having in in a PS: Why just not expose these functions from |
We should never consider making library-crate dependent on neard.
I think, |
Overall, the goal is to be able to publish runtime and compile it to Wasm. We should not be extracting stuff from primitives until it becomes publishable. Our crates should be as semantic as possible, having a crate that represents "stuff that does not compile to Wasm" is not good. Instead we should be extracting crates from However, that said, this is probably a huge effort which would require too much refactoring that would delay our progress with testing harness, so let's create an issue for it right now, and link runtime against the primitives crate (with near-actix-helpers, near-tracing-helpers, near-testlib-helpers extracted).
I suggest put it in |
@nearmax In #1881, I analyzed the root folder of nearcore project. There are tons of files and folders, so I categorized the folders into:
We have a ton of other files in the root of nearcore, which we cannot move, so it makes sense to shrink the scope where we can, so I think "libraries" folder is really helpful.
Agree, it is the tradeoff we want to take now to reach the goal. I think even this straightforward refactoring of extracting obviously non-related parts into separate crates will create a precedent, and make the future development cleaner. |
IMO, on the top level, it make sense to have the complete components categorized by their role in the system, but not by the type of their interface. |
…rotocol/nearcore into fckt/extract-actix-from-primitives
4611259
to
1a0c46a
Compare
1a0c46a
to
0382fbd
Compare
Addressed concerns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments to the methods you moved from the test_utils
, so we don't use them in prod. I'd suggest rename new
in the Account
to something else, to avoid it being used in production.
I realized that having |
518f9eb
to
9309fd7
Compare
…rotocol/nearcore into fckt/extract-actix-from-primitives
The PR follows the very specific goal - to remove
actix
dependency from near-primitives.The general approach here is to move in small iterations to bring us closer to #2433