-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Follow up for: Use the umbrella crate for the parachain template #5993 #7464
base: master
Are you sure you want to change the base?
Conversation
Will take another look when the PR is ready for review
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
The node crate still fails to build because an error is raised here during the compilation, when the macro is expanded: https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/tracing/proc-macro/src/lib.rs#L123. I would attempt a fix in |
Maybe I can try it out instead, we can discuss of what and how, that way, we try it out, and I learn something, 2 birds one stone ;) |
Just posting the code change and the file. It successfully builds now. let crate_name = match crate_name("sc-tracing") {
Ok(FoundCrate::Itself) => Ident::new("sc_tracing", Span::call_site()),
Ok(FoundCrate::Name(crate_name)) => Ident::new(&crate_name, Span::call_site()),
Err(_) => match crate_name("polkadot-sdk") {
Ok(FoundCrate::Itself) | Ok(FoundCrate::Name(_)) =>
Ident::new("sc_tracing", Span::call_site()),
Err(_) => return Error::new(Span::call_site(), "Neither one of `sc-tracing` or `polkadot-sdk` hasn't been found in your dependencies, or no `polkadot-sdk`'s enabled feature pulls in `sc-tracing`.").to_compile_error().into(),
},
}; |
Tagging @iulianbarbu @kianenigma @serban300 As seen above in the comment, #7464 (comment) The cargo tree suggests tracing to be under polkadot-sdk However, in the service.rs under the parachain it is not being resolved, I have also added, what my investigation involves so far, and some further experimentation in the following commits: I am not sure why it is not being resolved and could use some insights into debugging |
If you do
than I think you also need to define a But I wouldn't do this. I wouldn't guard |
Hi @serban300 I agree with sc-tracing already exists under node btw, so I am not sure why it is unabl to resolve that ahh reading it again:
Let me try this |
Summary of next round of try outs, based on feedback and suggestions
But, here is what I further tried:
Another common theme amongst these approaches is What are my options further:
that seems the most promising, although I am not sure of the outcomes against CI, I will have to try |
Ok(FoundCrate::Name(crate_name)) => Ident::new(&crate_name, Span::call_site()), | ||
Err(e) => return Error::new(Span::call_site(), e).to_compile_error().into(), | ||
let crate_name = match crate_name("polkadot-sdk") { | ||
Ok(FoundCrate::Name(sdk_name)) => Ident::new(sdk_name.as_str(), Span::call_site()), |
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 check how this is used; path sc-tracing::logging
makes sense, but polkadot-sdk::logging
does not.
It needs to be changed in this case to polkadot-sdk::sc-tracing
.
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.
Used generate_access_from_frame_or_crate
de994cf
to
b498920
Compare
b498920
to
f0128f5
Compare
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.
lgtm!
@@ -15,11 +15,11 @@ | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
|
|||
use frame_support_procedural_tools::generate_access_from_frame_or_crate; |
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.
maybe we can document this somewhere? what this is?
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.
There is a comment above the function definition:
/// Generate the crate access for the crate using 2018 syntax.
///
/// If `frame` is in scope, it will use `polkadot_sdk_frame::deps::<def_crate>`. Else, it will try
/// and find `<def_crate>` directly.
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 functionality seems to be shared between frame and substrate client. I would not pull in frame
namespaced crates as dependencies for substrate/client
crates (FYI, a quick fuzzy search for frame
in substrate/client
is not referencing any frame
dependency). I wonder if we should add this (and maybe other related logic) to an existing shared place or a new one - e.g. substrate/utils
(although, there isn't a crate for something like it, and we'd need to create one).
Also, the function docs miss to mention that it looks for polkadot-sdk
as well.
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.
Yes, also thought of that, but I don't know. I didn't completely check, but I guess frame-support-procedural-tools
should contain pretty generic methods. If it does, I think we could just use it. Maybe we should rename it or move it under primitives
. I have to check.
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'm not sure.
@ggwpez @kianenigma what do you think ?
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.
we shouldn't bring in frame_support_procedural_tools
but rather create a helper function, somewhere accessible to the tracing proc macro, that similarly resolves dependencies.
it will check if polkadot-sdk
is in scope, use that, else look for the crate name directly.
It should not care about polkadot-sdk-frame
, because this is all client side code, which is why I am saying we should not use frame_support_procedural_tools
(other than it being a weird dependency).
… as sc_tracing::logging
/cmd fmt |
All GitHub workflows were cancelled due to failure one of the required jobs. |
Resolving sc-tracing not being resolved when imported through the polkadot sdk