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

Support all runtimes in perf-tests #940

Merged
merged 11 commits into from
Nov 15, 2021
Merged

Conversation

notlesh
Copy link
Contributor

@notlesh notlesh commented Oct 29, 2021

What does it do?

Supports all runtimes in perf-tests.

TODO:

  • Remove the load_spec() hack
  • Properly support chain_spec in CLI params

Comment on lines 127 to 143
pub enum RuntimeVariant {
Moonbeam,
Moonriver,
Moonbase,
Unrecognized,
}

impl RuntimeVariant {
pub fn from_chain_spec(chain_spec: &Box<dyn ChainSpec>) -> Self {
match chain_spec {
spec if spec.is_moonbeam() => Self::Moonbeam,
spec if spec.is_moonriver() => Self::Moonriver,
spec if spec.is_moonbase() => Self::Moonbase,
_ => Self::Unrecognized,
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This mostly exists because just about everything else related to the runtime variants and chain specs are not Copy, Clone, etc. I'm open to other suggestions (esp. @librelois)

Comment on lines 444 to 451
pub fn for_chain_spec(chain_spec: &Box<dyn ChainSpec>) -> Self {
match chain_spec {
spec if spec.is_moonbeam() => Self::moonbeam(),
spec if spec.is_moonriver() => Self::moonriver(),
spec if spec.is_moonbase() => Self::moonbase(),
_ => panic!("invalid chain spec"),
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not using this in the PR, but I found it very useful when I first wrote it (it helps avoid big #[cfg...] blocks of code). OTOH, I'm not a fan of dead code...

Copy link
Collaborator

Choose a reason for hiding this comment

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

So, please remove this unused code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a35f70

@notlesh notlesh changed the title It compiles... Support all runtimes in perf-tests Oct 29, 2021
@notlesh notlesh added A0-pleasereview Pull request needs code review. B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes labels Nov 3, 2021
node/service/src/lib.rs Show resolved Hide resolved
long = "tests",
help = "Comma-separated list of tests to run (if omitted, runs all tests)"
)]
pub tests: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub tests: Option<String>,
pub tests: Vec<String>,

This will allow you to do --tests test1 --tests test2 --tests test3 which is not so bad if you give it a short option like -t. I don't know how to get the syntax you described though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why this showed up in this PR, it was introduced in a different one.

Anyway, the Vector<...> trick sounds useful, but I added code to parse a comma-separated list (in that other PR) as the TODO suggested -- so I removed the TODO comment.

Comment on lines 444 to 451
pub fn for_chain_spec(chain_spec: &Box<dyn ChainSpec>) -> Self {
match chain_spec {
spec if spec.is_moonbeam() => Self::moonbeam(),
spec if spec.is_moonriver() => Self::moonriver(),
spec if spec.is_moonbase() => Self::moonbase(),
_ => panic!("invalid chain spec"),
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, please remove this unused code

@notlesh notlesh merged commit 57fdb3f into master Nov 15, 2021
@notlesh notlesh deleted the notlesh-perf-tests-chain-id-support branch November 15, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview Pull request needs code review. B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants