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

Clean up unused dependencies from Entropy node #459

Merged
merged 18 commits into from
Oct 30, 2023
Merged

Conversation

HCastano
Copy link
Collaborator

@HCastano HCastano commented Oct 27, 2023

My initial goal with this PR was to remove the kitchensink-runtime
from the node. As I went through this I was also able to remove two unused components:
the statement store, and the substrate-test-runtime.

For a bit of background:

The kitchensink-runtime is something provided by Substrate as a sort of demo of using
all the available pallets, runtime APIs, etc. We were pulling it in directly and
through the node-executor crate. However We don't need to be pulling in all this code
wasting compilation cycles on this. Instead we should be able to running benchmarks and
tests against our own runtime.

The Statement store is a way to
store data off-chain. This is also something that we don't use, but since it was included
in the Substrate kitchensink node which is why we've pulled it in.

The substrate-test-runtime is used by the service itself to test some networking
functionality. We pulled these tests in, but don't really have a need for them. In fact,
we were even #[ignore]-ing the only test that actually used the runtime. Despite that
we were pulling this into our normal builds and our test builds.

Overall this PR reduces the number of crates we pull in by ~70 and removes two runtimes
from the compilation process (and since each runtime is compiled in a single threaded way
we save a bit of time with this).

P.S. There's a lot more unused code we can remove from the node, but I'll open up a separate
issue in the future to track this.

@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
entropy-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 30, 2023 4:29pm

@HCastano
Copy link
Collaborator Author

Just quickly checked, this removes removes ~50 crates from the compilation process. Note that the most significant savings come from not having to build the extra runtime (which happens in a single thread, so it's slow).

We don't actually use this RPC and it's adding extra dependencies.
We don't make use of this and it's only pulling in more dependencies into the build.
This also pulls in another runtime which we don't use and just slows down the
compilaton process.
@HCastano HCastano changed the title Remove kitchen-sink runtime dependency Clean up unused dependencies from Entropy node Oct 30, 2023
@HCastano HCastano marked this pull request as ready for review October 30, 2023 15:54
}

fn copyright_start_year() -> i32 {
2017
2022
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made this date up, not sure what we should actually be using here. Can somebody tell me? lol

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like this doesn't matter yet, so we'll leave it as 2022 for now

Copy link
Contributor

@ameba23 ameba23 left a comment

Choose a reason for hiding this comment

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

I'm not well placed to review this, but i'm very thankful for improved build times!

@HCastano
Copy link
Collaborator Author

@ameba23 I'd appreciate if your "review" were asking a bunch of clarifying questions.

This can help both of us:

  • There might be things that I might have missed or gotten wrong that would only be realized through the process of answering questions
  • You get to learn more about a subject area you're not familiar with

use super::*;
use crate::service::{new_full_base, NewFullBase};

fn local_testnet_genesis_instant_single() -> RuntimeGenesisConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we need these tests anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From what I can tell these were more intended for Substrate core to ensure that everything was working correctly. I don't think it's important for us to check that a genesis config is valid through unit tests

/// Create a transaction using the given `call`.
///
/// Note: Should only be used for benchmarking.
pub fn create_benchmark_extrinsic(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does removing these dependencies mean we need this function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you look at some of the helpers for running benchmarks you'll see that we need to call into the runtime to perform some actions.

Previously the create_extrinsic function was being used, and it was calling into the kitchensink-runtime. I've swapped this out for create_benchmark_extrinsic which a) is better named and b) uses the entropy-runtime under the hood

@HCastano HCastano merged commit ef32f3d into master Oct 30, 2023
10 checks passed
@HCastano HCastano deleted the hc-clean-up-node branch October 30, 2023 21:36
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