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

Improve RuntimeV2 Macro Error Detail #6997

Open
2 tasks done
AurevoirXavier opened this issue Dec 25, 2024 · 3 comments
Open
2 tasks done

Improve RuntimeV2 Macro Error Detail #6997

AurevoirXavier opened this issue Dec 25, 2024 · 3 comments
Labels
I5-enhancement An additional feature request.

Comments

@AurevoirXavier
Copy link
Contributor

AurevoirXavier commented Dec 25, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

No response

Request

#[frame_support::runtime]
mod runtime {
	#[runtime::runtime]
	#[runtime::derive(
		RuntimeCall,
		RuntimeEvent,
		RuntimeError,
		RuntimeOrigin,
		RuntimeFreezeReason,
		RuntimeHoldReason,
		RuntimeSlashReason,
		RuntimeLockId,
		RuntimeTask
	)]
	pub struct Runtime;

	#[runtime::pallet_index(0)]
	pub type System = wrong_pallet_name;
}

If I write something like this, the error log only complains about Runtime/RuntimeCall/xxx not being found, which makes debugging difficult.

We should prioritize emitting a wrong_pallet_name not found error at the top.

Solution

No response

Are you willing to help with this request?

Maybe (please elaborate above)

@AurevoirXavier AurevoirXavier added the I5-enhancement An additional feature request. label Dec 25, 2024
@bkchr
Copy link
Member

bkchr commented Dec 25, 2024

We should prioritize emitting a wrong_pallet_name not found error at the top.

The problem here is that we don't have any control over this in the macro. The macro can not find out that easily if wrong_pallet_name exists or not. Maybe with some code parsing and finding out if wrong_pallet_name is a name of a pallet in the Cargo.toml or an import to the file.

@AurevoirXavier
Copy link
Contributor Author

AurevoirXavier commented Dec 26, 2024

The problem here is that we don't have any control over this in the macro. The macro can not find out that easily if wrong_pallet_name exists or not. Maybe with some code parsing and finding out if wrong_pallet_name is a name of a pallet in the Cargo.toml or an import to the file.

Hmm, I haven’t looked into this in depth.

However, I must say that after switching to the v2 macro, the development experience has declined. Issues like this were much easier to identify in v1.

I’m familiar with Substrate, so when I encounter such errors, I can assume there’s likely an issue with the macro. However, other developers might not realize this. The errors only indicate Runtime not found, Pallet not found, or Event not found, which can be confusing.

@bkchr
Copy link
Member

bkchr commented Dec 27, 2024

I’m familiar with Substrate, so when I encounter such errors, I can assume there’s likely an issue with the macro. However, other developers might not realize this. The errors only indicate Runtime not found, Pallet not found, or Event not found, which can be confusing.

Yeah for sure! I mean I don't wanted to say that the feedback is not valid. I agree with you, but we are also not generating these errors, they are coming from the compiler. But we can improve them, if we do what I said above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

2 participants