Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion Cargo.lock

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

97 changes: 61 additions & 36 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,14 @@ rayon = "1.10"

[workspace]
members = [
"node",
"pallets/commitments",
"pallets/subtensor",
"pallets/admin-utils",
"pallets/collective",
"pallets/registry",
"primitives/*",
"runtime",
"support/tools",
"support/macros",
"support/linting",
"support/procedural-fork",
"pallets/drand",
"common",
"node",
"pallets/*",
"precompiles",
"primitives/*",
"runtime",
"support/*",
]
exclude = ["support/procedural-fork"]
resolver = "2"

[workspace.lints.clippy]
Expand All @@ -46,14 +39,29 @@ arithmetic-side-effects = "deny"
type_complexity = "allow"
unwrap-used = "deny"
manual_inspect = "allow"
useless_conversion = "allow" # until polkadot is patched
useless_conversion = "allow" # until polkadot is patched

[workspace.dependencies]
pallet-admin-utils = { default-features = false, path = "pallets/admin-utils" }
pallet-collective = { default-features = false, path = "pallets/collective" }
pallet-commitments = { default-features = false, path = "pallets/commitments" }
pallet-registry = { default-features = false, path = "pallets/registry" }
pallet-subtensor = { default-features = false, path = "pallets/subtensor" }
subtensor-custom-rpc = { default-features = false, path = "pallets/subtensor/rpc" }
subtensor-custom-rpc-runtime-api = { default-features = false, path = "pallets/subtensor/runtime-api" }
subtensor-precompiles = { default-features = false, path = "precompiles" }
subtensor-runtime-common = { default-features = false, path = "common" }
node-subtensor-runtime = { default-features = false, path = "runtime" }

async-trait = "0.1"
cargo-husky = { version = "1", default-features = false }
clap = "4.5.4"
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
ed25519-dalek = { version = "2.1.0", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [
"derive",
] }
ed25519-dalek = { version = "2.1.0", default-features = false, features = [
"alloc",
] }
enumflags2 = "0.7.9"
futures = "0.3.30"
hex = { version = "0.4", default-features = false }
Expand All @@ -64,7 +72,9 @@ memmap2 = "0.9.4"
ndarray = { version = "0.15.6", default-features = false }
parity-util-mem = "0.12.0"
rand = "0.8.5"
scale-codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = ["derive"] }
scale-codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [
"derive",
] }
scale-info = { version = "2.11.2", default-features = false }
serde = { version = "1.0.214", default-features = false }
serde-tuple-vec-map = { version = "1.0.1", default-features = false }
Expand All @@ -74,11 +84,11 @@ serde_with = { version = "=2.0.0", default-features = false }
smallvec = "1.13.2"
litep2p = { git = "https://github.com/paritytech/litep2p", tag = "v0.7.0" }
syn = { version = "2.0.87", features = [
"full",
"visit-mut",
"visit",
"extra-traits",
"parsing",
"full",
"visit-mut",
"visit",
"extra-traits",
"parsing",
] }
quote = "1"
proc-macro2 = { version = "1", features = ["span-locations"] }
Expand Down Expand Up @@ -181,7 +191,9 @@ fc-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac8
fp-consensus = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fp-dynamic-fee = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-api = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false, features = ["rpc-binary-search-estimate"]}
fc-rpc = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false, features = [
"rpc-binary-search-estimate",
] }
fc-rpc-core = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
fc-mapping-sync = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
precompile-utils = { git = "https://github.com/opentensor/frontier", rev = "635bdac882", default-features = false }
Expand All @@ -199,21 +211,34 @@ pallet-hotfix-sufficients = { git = "https://github.com/opentensor/frontier", re

#DRAND
pallet-drand = { path = "pallets/drand", default-features = false }
sp-crypto-ec-utils = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", features = ["bls12-381"] }
getrandom = { version = "0.2.15", features = ["custom"], default-features = false }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-crypto-ec-utils = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", features = [
"bls12-381",
] }
getrandom = { version = "0.2.15", features = [
"custom",
], default-features = false }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
w3f-bls = { version = "=0.1.3", default-features = false }
ark-crypto-primitives = { version = "0.4.0", default-features = false, features = [ "r1cs", "snark" ] }
ark-scale = { version = "0.0.11", default-features = false, features = ["hazmat"] }
ark-crypto-primitives = { version = "0.4.0", default-features = false, features = [
"r1cs",
"snark",
] }
ark-scale = { version = "0.0.11", default-features = false, features = [
"hazmat",
] }
sp-ark-bls12-381 = { git = "https://github.com/paritytech/substrate-curves", default-features = false }
ark-bls12-381 = { version = "0.4.0", features = ["curve"], default-features = false }
ark-serialize = { version = "0.4.0", features = [ "derive" ], default-features = false }
ark-bls12-381 = { version = "0.4.0", features = [
"curve",
], default-features = false }
ark-serialize = { version = "0.4.0", features = [
"derive",
], default-features = false }
ark-ff = { version = "0.4.0", default-features = false }
ark-ec = { version = "0.4.0", default-features = false }
ark-std = { version = "0.4.0", default-features = false }
anyhow = "1.0.81"
sha2 = { version = "0.10.8", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
tle = { git = "https://github.com/ideal-lab5/timelock", rev = "5416406cfd32799e31e1795393d4916894de4468", default-features = false }

frame-metadata = "16"
Expand All @@ -232,11 +257,11 @@ codegen-units = 1
[features]
default = []
try-runtime = [
"node-subtensor/try-runtime",
"node-subtensor-runtime/try-runtime",
"node-subtensor/try-runtime",
"node-subtensor-runtime/try-runtime",
]
runtime-benchmarks = [
"node-subtensor/runtime-benchmarks",
"node-subtensor-runtime/runtime-benchmarks",
"node-subtensor/runtime-benchmarks",
"node-subtensor-runtime/runtime-benchmarks",
]
metadata-hash = ["node-subtensor-runtime/metadata-hash"]
32 changes: 32 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "subtensor-runtime-common"
version = "0.1.0"
edition = "2024"
authors = ["Opentensor Foundation <https://github.com/opentensor/>"]
homepage = "https://opentensor.ai/"
publish = false
repository = "https://github.com/opentensor/subtensor/"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { workspace = true }
frame-support = { workspace = true }
scale-info = { workspace = true }
sp-runtime = { workspace = true }
sp-core = { workspace = true }

[lints]
workspace = true

[features]
default = ["std"]
fast-blocks = []
std = [
"codec/std",
"frame-support/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
]
86 changes: 86 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{
MultiSignature,
traits::{IdentifyAccount, Verify},
};

/// Balance of an account.
pub type Balance = u64;

/// An index to a block.
pub type BlockNumber = u32;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;

/// Some way of identifying an account on the chain. We intentionally make it equivalent to the
/// public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;

/// Index of a transaction in the chain.
pub type Index = u32;

/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;

pub type Nonce = u32;

/// Transfers below SMALL_TRANSFER_LIMIT are considered small transfers
pub const SMALL_TRANSFER_LIMIT: Balance = 500_000_000; // 0.5 TAO

#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, MaxEncodedLen, TypeInfo,
)]
pub enum ProxyType {
Any,
Owner, // Subnet owner Calls
NonCritical,
NonTransfer,
Senate,
NonFungibile, // Nothing involving moving TAO
Triumvirate,
Governance, // Both above governance
Staking,
Registration,
Transfer,
SmallTransfer,
RootWeights,
ChildKeys,
SudoUncheckedSetCode,
}

impl Default for ProxyType {
// allow all Calls; required to be most permissive
fn default() -> Self {
Self::Any
}
}

pub mod time {
use super::*;

/// This determines the average expected block time that we are targeting. Blocks will be
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
/// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn
/// slot_duration()`.
///
/// Change this to adjust the block time.
#[cfg(not(feature = "fast-blocks"))]
pub const MILLISECS_PER_BLOCK: u64 = 12000;

/// Fast blocks for development
#[cfg(feature = "fast-blocks")]
pub const MILLISECS_PER_BLOCK: u64 = 250;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;

// Time is measured by number of blocks.
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
}
13 changes: 7 additions & 6 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pallet-transaction-payment = { workspace = true }
pallet-commitments = { path = "../pallets/commitments" }
pallet-drand = { workspace = true }
sp-crypto-ec-utils = { workspace = true }
sp-keystore = { workspace = true, default-features = false }
sp-keystore = { workspace = true, default-features = false }


# These dependencies are used for the subtensor's RPCs
Expand Down Expand Up @@ -105,9 +105,10 @@ thiserror = { workspace = true }
num-traits = { version = "0.2", features = ["std"] }

# 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, features = ["std"] }
subtensor-runtime-common = { workspace = true, features = ["std"] }
subtensor-custom-rpc = { workspace = true, features = ["std"] }
subtensor-custom-rpc-runtime-api = { workspace = true, features = ["std"] }

[build-dependencies]
substrate-build-script-utils = { workspace = true }
Expand All @@ -133,7 +134,7 @@ runtime-benchmarks = [
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-commitments/runtime-benchmarks",
"pallet-drand/runtime-benchmarks"
"pallet-drand/runtime-benchmarks",
]
pow-faucet = []

Expand All @@ -145,7 +146,7 @@ try-runtime = [
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime",
"pallet-commitments/try-runtime",
"pallet-drand/try-runtime"
"pallet-drand/try-runtime",
]

metadata-hash = ["node-subtensor-runtime/metadata-hash"]
Loading
Loading