Skip to content

Commit

Permalink
Restructure workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-otf committed Nov 20, 2024
1 parent ba4ed6f commit aa3cf98
Show file tree
Hide file tree
Showing 21 changed files with 349 additions and 239 deletions.
31 changes: 15 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 43 additions & 57 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,30 @@
[package]
name = "subtensor"
version = "0.1.0"
description = "Implementation of the bittensor blockchain"
[workspace]
default-members = ["node"]
members = [
"node",
"pallets/admin-utils",
"pallets/collective",
"pallets/commitments",
"pallets/registry",
"pallets/subtensor",
"pallets/subtensor/rpc",
"pallets/subtensor/runtime-api",
"runtime",
"support/code-coverage",
"support/linting",
"support/macros",
"support/procedural-fork",
"support/tools",
]
resolver = "2"

[workspace.package]
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
license = "Unlicense"
publish = false
repository = "https://github.com/opentensor/subtensor"

[dependencies]
node-subtensor = { path = "node", version = "4.0.0-dev" }
node-subtensor-runtime = { path = "runtime", version = "4.0.0-dev" }

[build-dependencies]
subtensor-linting = { path = "support/linting", version = "0.1.0" }
subtensor-code-coverage = { path = "support/code-coverage", version = "0.1.0" }
build-print.workspace = true
syn.workspace = true
quote.workspace = true
proc-macro2.workspace = true
walkdir.workspace = true
rayon.workspace = true

[workspace]
members = [
"node",
"pallets/commitments",
"pallets/subtensor",
"pallets/admin-utils",
"pallets/collective",
"pallets/registry",
"runtime",
"support/tools",
"support/macros",
"support/linting",
"support/procedural-fork",
"support/code-coverage",
]
resolver = "2"

[workspace.lints.clippy]
indexing-slicing = "deny"
arithmetic-side-effects = "deny"
Expand All @@ -48,6 +33,23 @@ unwrap-used = "deny"
manual_inspect = "allow"

[workspace.dependencies]
# local crates
node-subtensor = { path = "node" }
node-subtensor-runtime = { path = "runtime" }
pallet-admin-utils = { path = "pallets/admin-utils", default-features = false }
pallet-collective = { path = "pallets/collective", default-features = false }
pallet-commitments = { path = "pallets/commitments", default-features = false }
pallet-registry = { path = "pallets/registry", default-features = false }
pallet-subtensor = { path = "pallets/subtensor", default-features = false }
procedural-fork = { path = "support/procedural-fork" }
subtensor-code-coverage = { path = "support/code-coverage" }
subtensor-custom-rpc = { path = "pallets/subtensor/rpc", default-features = false }
subtensor-custom-rpc-runtime-api = { path = "pallets/subtensor/runtime-api", default-features = false }
subtensor-linting = { path = "support/linting" }
subtensor-macros = { path = "support/macros" }
subtensor-tools = { path = "support/tools" }

# non-local
rayon = "1"
build-print = "0.1"
cargo-husky = { version = "1", default-features = false }
Expand All @@ -72,18 +74,16 @@ serde_with = { version = "=2.0.0", default-features = false }
smallvec = "1.13.2"
litep2p = { git = "https://github.com/paritytech/litep2p", branch = "master" }
syn = { version = "2", features = [
"full",
"visit-mut",
"visit",
"extra-traits",
"parsing",
"full",
"visit-mut",
"visit",
"extra-traits",
"parsing",
] }
quote = "1"
proc-macro2 = { version = "1", features = ["span-locations"] }
walkdir = "2"

subtensor-macros = { path = "support/macros" }

frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.16.0-rc1", default-features = false }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.16.0-rc1" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.16.0-rc1", default-features = false }
Expand Down Expand Up @@ -161,8 +161,6 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "v1.16.0-rc1" }
frame-metadata = "16"

procedural-fork = { version = "1.10.0-rc3", path = "support/procedural-fork" }

[profile.release]
panic = "unwind"

Expand All @@ -173,15 +171,3 @@ opt-level = 3
inherits = "release"
lto = true
codegen-units = 1

[features]
default = []
try-runtime = [
"node-subtensor/try-runtime",
"node-subtensor-runtime/try-runtime",
]
runtime-benchmarks = [
"node-subtensor/runtime-benchmarks",
"node-subtensor-runtime/runtime-benchmarks",
]
metadata-hash = ["node-subtensor-runtime/metadata-hash"]
70 changes: 0 additions & 70 deletions build.rs

This file was deleted.

9 changes: 5 additions & 4 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sp-keyring = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-commitments = { path = "../pallets/commitments" }
pallet-commitments = { workspace = true }

# These dependencies are used for the subtensor's RPCs
jsonrpsee = { workspace = true, features = ["server"] }
Expand All @@ -75,12 +75,13 @@ frame-benchmarking = { workspace = true }
frame-benchmarking-cli = { workspace = true }

# Local Dependencies
node-subtensor-runtime = { path = "../runtime" }
subtensor-custom-rpc = { path = "../pallets/subtensor/rpc" }
subtensor-custom-rpc-runtime-api = { path = "../pallets/subtensor/runtime-api" }
node-subtensor-runtime = { workspace = true }
subtensor-custom-rpc = { workspace = true }
subtensor-custom-rpc-runtime-api = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true }
subtensor-linting = {workspace = true}

[features]
default = []
Expand Down
3 changes: 2 additions & 1 deletion node/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_change

fn main() {
generate_cargo_keys();

rerun_if_git_head_changed();

subtensor_linting::walk_src();
}
9 changes: 7 additions & 2 deletions pallets/admin-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
sp-runtime = { workspace = true }
log = { workspace = true }
pallet-subtensor = { version = "4.0.0-dev", default-features = false, path = "../subtensor" }
pallet-subtensor = { workspace = true }
sp-weights = { workspace = true }
substrate-fixed = { workspace = true }

Expand All @@ -40,8 +40,13 @@ pallet-balances = { workspace = true, features = ["std"] }
pallet-scheduler = { workspace = true }
sp-std = { workspace = true }

[build-dependencies]
subtensor-code-coverage = {workspace = true }
subtensor-linting = { workspace = true }

[features]
default = ["std"]
code-coverage = []
std = [
"codec/std",
"frame-benchmarking?/std",
Expand Down Expand Up @@ -76,5 +81,5 @@ try-runtime = [
"pallet-balances/try-runtime",
"pallet-scheduler/try-runtime",
"sp-runtime/try-runtime",
"pallet-subtensor/try-runtime"
"pallet-subtensor/try-runtime",
]
15 changes: 15 additions & 0 deletions pallets/admin-utils/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fn main() {
println!("cargo:rerun-if-changed=src");
subtensor_linting::walk_src();

#[cfg(feature = "code-coverage")]
{
use std::env;
use std::path::Path;
let source_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let source_dir = Path::new(&source_dir);
let rust_files = subtensor_code_coverage::collect_rust_files(source_dir);
// Generate code coverage report
subtensor_code_coverage::analyze_files(&rust_files, source_dir);
}
}
Loading

0 comments on commit aa3cf98

Please sign in to comment.