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

config: Add Debug Clone for common configs #1542

Merged
merged 3 commits into from
Apr 24, 2024
Merged

config: Add Debug Clone for common configs #1542

merged 3 commits into from
Apr 24, 2024

Conversation

lexnv
Copy link
Collaborator

@lexnv lexnv commented Apr 19, 2024

This tiny PR implements Debug, Clone for SubstrateConfig and PolkadotConfig.

This might be useful for developers that have wrappers over these types, or that store these types in other structs.

cc @AndreiEres let me know if this solves the issue with debugging types from polkadot-interceptor 🙏

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv self-assigned this Apr 19, 2024
@lexnv lexnv requested a review from a team as a code owner April 19, 2024 10:52
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I do believe they should never be necessary, I'm happy adding these on the concrete types just to make life easier :)

(We used to have such bounds on the trait itself iirc and that I'd object to)

@@ -11,6 +11,7 @@ pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
pub use primitive_types::{H256, U256};

/// Default set of commonly used types by Polkadot nodes.
#[derive(Debug, Clone)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could probably add Copy as well?

Copy link
Collaborator

@jsdw jsdw Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we hsould just add all of the "standard" traits? eg perhaps:

Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default

and maybe also a quick dev note that the traits exist just to make life easier but shouldn't strictly be necessary since you can't instantiate this type

lexnv added 2 commits April 19, 2024 15:36
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@niklasad1 niklasad1 merged commit 7f2b34b into master Apr 24, 2024
12 checks passed
@niklasad1 niklasad1 deleted the lexnv/debug-ty branch April 24, 2024 10:08
@jsdw jsdw mentioned this pull request May 16, 2024
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

Successfully merging this pull request may close these issues.

3 participants