Skip to content
Open
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
7,617 changes: 4,184 additions & 3,433 deletions Cargo.lock

Large diffs are not rendered by default.

433 changes: 217 additions & 216 deletions Cargo.toml

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion chain-extensions/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use sp_std::{cell::RefCell, cmp::Ordering, sync::OnceLock};
use subtensor_runtime_common::{AlphaBalance, AuthorshipInfo, NetUid, Saturating, TaoBalance};

type Block = frame_system::mocking::MockBlock<Test>;
type TxExtension = frame_system::AuthorizeCall<Test>;

frame_support::construct_runtime!(
pub enum Test
Expand Down Expand Up @@ -621,7 +622,7 @@ impl frame_system::offchain::SigningTypes for Test {
type Signature = test_crypto::Signature;
}

pub type UncheckedExtrinsic = sp_runtime::testing::TestXt<RuntimeCall, ()>;
pub type UncheckedExtrinsic = sp_runtime::testing::TestXt<RuntimeCall, TxExtension>;

impl<LocalCall> frame_system::offchain::CreateTransactionBase<LocalCall> for Test
where
Expand All @@ -631,6 +632,26 @@ where
type RuntimeCall = RuntimeCall;
}

impl<LocalCall> frame_system::offchain::CreateTransaction<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
type Extension = TxExtension;

fn create_transaction(call: RuntimeCall, extension: Self::Extension) -> Self::Extrinsic {
UncheckedExtrinsic::new_transaction(call, extension)
}
}

impl<LocalCall> frame_system::offchain::CreateAuthorizedTransaction<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
fn create_extension() -> Self::Extension {
TxExtension::new()
}
}

impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
Expand Down
12 changes: 9 additions & 3 deletions clones/js-tests/tests/test-balancer-edge-emission-issuance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,22 @@ async function findEmissionSubnet() {
if ((await api.query.subtensorModule.networksAdded(netuid)).isFalse) continue;
if ((await api.query.subtensorModule.subnetEmissionEnabled(netuid)).isFalse) continue;

const [tao, alpha] = await Promise.all([
const [tao, alpha, taoInEmission] = await Promise.all([
api.query.subtensorModule.subnetTAO(netuid),
api.query.subtensorModule.subnetAlphaIn(netuid),
api.query.subtensorModule.subnetTaoInEmission(netuid),
]);
if (tao.toBigInt() > 0n && alpha.toBigInt() > 0n) {
// SubnetEmissionEnabled alone does not guarantee TAO input: a subnet with
// MinerBurned=1 receives a zero share. The edge scenarios need a subnet
// that is observably receiving TAO before their balancer state is forced.
if (tao.toBigInt() > 0n && alpha.toBigInt() > 0n && taoInEmission.toBigInt() > 0n) {
return netuid;
}
}

throw new Error("no initialized emission-enabled subnet with non-zero TAO and alpha reserves found");
throw new Error(
"no initialized emission-enabled subnet with non-zero TAO/alpha reserves and TAO input emission found"
);
}

async function runEdgeWeightScenario(netuid, quoteWeight, label) {
Expand Down
8 changes: 4 additions & 4 deletions common/src/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use sp_arithmetic::traits::{
#[cfg(feature = "std")]
use sp_rpc::number::NumberOrHex;

#[freeze_struct("fe2aa2d7fcb480e8")]
#[freeze_struct("47c5697352027374")]
#[repr(transparent)]
#[derive(
Deserialize,
Expand All @@ -45,12 +45,12 @@ use sp_rpc::number::NumberOrHex;
Ord,
PartialEq,
PartialOrd,
RuntimeDebug,
Debug,
TypeInfo,
)]
pub struct AlphaBalance(u64);

#[freeze_struct("a99f2483a97121fc")]
#[freeze_struct("8d42edeeaa467687")]
#[repr(transparent)]
#[derive(
Deserialize,
Expand All @@ -67,7 +67,7 @@ pub struct AlphaBalance(u64);
Ord,
PartialEq,
PartialOrd,
RuntimeDebug,
Debug,
TypeInfo,
)]
pub struct TaoBalance(u64);
Expand Down
12 changes: 6 additions & 6 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub type Nonce = u32;
pub const SMALL_TRANSFER_LIMIT: Balance = TaoBalance::new(500_000_000); // 0.5 TAO
pub const SMALL_ALPHA_TRANSFER_LIMIT: AlphaBalance = AlphaBalance::new(500_000_000); // 0.5 Alpha

#[freeze_struct("4184c565055c66a7")]
#[freeze_struct("c841f1c4c96864e6")]
#[repr(transparent)]
#[derive(
Deserialize,
Expand All @@ -70,7 +70,7 @@ pub const SMALL_ALPHA_TRANSFER_LIMIT: AlphaBalance = AlphaBalance::new(500_000_0
Ord,
PartialEq,
PartialOrd,
RuntimeDebug,
Debug,
TypeInfo,
)]
#[serde(transparent)]
Expand Down Expand Up @@ -192,7 +192,7 @@ pub mod time {
pub const DAYS: BlockNumber = HOURS * 24;
}

#[freeze_struct("2477c9af9b0c5c26")]
#[freeze_struct("f5aa55f5130e8701")]
#[repr(transparent)]
#[derive(
Deserialize,
Expand All @@ -209,7 +209,7 @@ pub mod time {
Ord,
PartialEq,
PartialOrd,
RuntimeDebug,
Debug,
TypeInfo,
)]
#[serde(transparent)]
Expand Down Expand Up @@ -267,7 +267,7 @@ impl From<Compact<MechId>> for MechId {
}
}

#[freeze_struct("c6bf75ee25c00b9")]
#[freeze_struct("d204418a425fc968")]
#[repr(transparent)]
#[derive(
Deserialize,
Expand All @@ -284,7 +284,7 @@ impl From<Compact<MechId>> for MechId {
Ord,
PartialEq,
PartialOrd,
RuntimeDebug,
Debug,
TypeInfo,
)]
#[serde(transparent)]
Expand Down
8 changes: 2 additions & 6 deletions common/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ use subtensor_macros::freeze_struct;
Decode,
DecodeWithMemTracking,
Debug,
Default,
MaxEncodedLen,
TypeInfo,
)]
pub enum ProxyType {
#[default]
Any,
Owner,
NonCritical,
Expand Down Expand Up @@ -106,12 +108,6 @@ impl ProxyType {
}
}

impl Default for ProxyType {
fn default() -> Self {
Self::Any
}
}

/// Extra constraint attached to an allowed call.
#[derive(Clone, PartialEq, Eq, Encode, Decode, Debug, TypeInfo)]
pub enum CallConstraint {
Expand Down
2 changes: 1 addition & 1 deletion docs/tx/announce-coldkey-swap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ pub fn announce_coldkey_swap(
}
```

Delegates to [`get_key_swap_cost`](/code/pallets/subtensor/src/utils/misc.rs#L827), [`charge_swap_cost`](/code/pallets/subtensor/src/swap/swap_coldkey.rs#L52).
Delegates to [`get_key_swap_cost`](/code/pallets/subtensor/src/utils/misc.rs#L826), [`charge_swap_cost`](/code/pallets/subtensor/src/swap/swap_coldkey.rs#L52).

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
2 changes: 1 addition & 1 deletion docs/tx/associate-evm-key.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ pub fn associate_evm_key(
}
```

Delegates to [`do_associate_evm_key`](/code/pallets/subtensor/src/utils/evm.rs#L46).
Delegates to [`do_associate_evm_key`](/code/pallets/subtensor/src/utils/evm.rs#L47).

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
2 changes: 1 addition & 1 deletion docs/tx/set-weights.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn set_mechanism_weights(
}
```

Delegates to [`get_commit_reveal_weights_enabled`](/code/pallets/subtensor/src/utils/misc.rs#L607), [`do_set_mechanism_weights`](/code/pallets/subtensor/src/subnets/weights.rs#L916).
Delegates to [`get_commit_reveal_weights_enabled`](/code/pallets/subtensor/src/utils/misc.rs#L606), [`do_set_mechanism_weights`](/code/pallets/subtensor/src/subnets/weights.rs#L916).

`SubtensorModule.commit_timelocked_mechanism_weights` — [`pallets/subtensor/src/macros/dispatches.rs#L1869`](/code/pallets/subtensor/src/macros/dispatches.rs#L1869):

Expand Down
28 changes: 14 additions & 14 deletions eco-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ unwrap-used = "deny"
useless_conversion = "allow"

[dependencies]
# Keep `time` at a floor with the stack-exhaustion fix (GHSA-r6v5-fh4h-64xc); the old
# =0.3.36 pin for the tracing-subscriber E0119 conflict is resolved by tracing-subscriber >= 0.3.20.
# Keep `time` at a floor with the stack-exhaustion fix (GHSA-r6v5-fh4h-64xc).
# stable2606's `sp-tracing` pins tracing-subscriber 0.3.19 exactly.
time = { version = "0.3.47", default-features = false }
pallet-subtensor = { path = "../pallets/subtensor", default-features = false, features = ["std"] }
pallet-alpha-assets = { path = "../pallets/alpha-assets", default-features = false, features = ["std"] }
frame-support = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
frame-system = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-core = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-io = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-runtime = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-std = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
frame-support = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
frame-system = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
sp-core = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
sp-io = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
sp-runtime = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
sp-std = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
codec = { package = "parity-scale-codec", version = "3.7.5", default-features = false, features = ["derive", "std"] }
scale-info = { version = "2.11.2", default-features = false, features = ["derive", "std"] }
pallet-balances = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
pallet-scheduler = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
pallet-preimage = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
pallet-balances = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
pallet-scheduler = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
pallet-preimage = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
pallet-drand = { path = "../pallets/drand", default-features = false, features = ["std"] }
pallet-subtensor-swap = { path = "../pallets/swap", default-features = false, features = ["std"] }
pallet-subtensor-swap-runtime-api = { path = "../pallets/swap/runtime-api", default-features = false, features = ["std"] }
subtensor-custom-rpc-runtime-api = { path = "../pallets/subtensor/runtime-api", default-features = false, features = ["std"] }
sp-api = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-api = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
pallet-crowdloan = { path = "../pallets/crowdloan", default-features = false, features = ["std"] }
pallet-subtensor-proxy = { path = "../pallets/proxy", default-features = false, features = ["std"] }
pallet-subtensor-utility = { path = "../pallets/utility", default-features = false, features = ["std"] }
Expand All @@ -50,10 +50,10 @@ substrate-fixed = { git = "https://github.com/encointer/substrate-fixed.git", ta
safe-math = { path = "../primitives/safe-math", default-features = false, features = ["std"] }
log = { version = "0.4.21", default-features = false, features = ["std"] }
approx = "0.5"
sp-tracing = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "7cc54bf2d50ae3921d718736dfeb0de9468539c7", default-features = false, features = ["std"] }
sp-tracing = { git = "https://github.com/RaoFoundation/polkadot-sdk.git", rev = "b788099fa0c2a5f9df0d228c77b4a92a8469b778", default-features = false, features = ["std"] }
tracing = "0.1"
tracing-log = "0.2"
tracing-subscriber = { version = "0.3.20", features = ["fmt", "env-filter"] }
tracing-subscriber = { version = "=0.3.19", features = ["fmt", "env-filter"] }
rand = { version = "0.10.0", default-features = false, features = ["std", "thread_rng"] }
hex-literal = "0.4.1"

Expand Down
24 changes: 23 additions & 1 deletion eco-tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,9 @@ impl frame_system::offchain::SigningTypes for Test {
type Signature = test_crypto::Signature;
}

pub type UncheckedExtrinsic = sp_runtime::testing::TestXt<RuntimeCall, ()>;
type TxExtension = frame_system::AuthorizeCall<Test>;

pub type UncheckedExtrinsic = sp_runtime::testing::TestXt<RuntimeCall, TxExtension>;

impl<LocalCall> frame_system::offchain::CreateTransactionBase<LocalCall> for Test
where
Expand All @@ -571,6 +573,26 @@ where
type RuntimeCall = RuntimeCall;
}

impl<LocalCall> frame_system::offchain::CreateTransaction<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
type Extension = TxExtension;

fn create_transaction(call: RuntimeCall, extension: Self::Extension) -> Self::Extrinsic {
UncheckedExtrinsic::new_transaction(call, extension)
}
}

impl<LocalCall> frame_system::offchain::CreateAuthorizedTransaction<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
{
fn create_extension() -> Self::Extension {
TxExtension::new()
}
}

impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Test
where
RuntimeCall: From<LocalCall>,
Expand Down
4 changes: 2 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ subtensor-macros.workspace = true
# profile across the node's hundreds of threads; linking jemalloc as the global allocator (as the
# polkadot binary does) is the proposed mitigation (issue #2724). Gated behind a feature so the
# default release binary is unchanged until an operator opts in.
tikv-jemallocator = { version = "0.5", optional = true, default-features = false }
tikv-jemallocator = { version = "0.6", optional = true, default-features = false }
# Companion to `tikv-jemallocator`, used by the `jemalloc-allocator` feature's
# activation test to read allocator stats over `mallctl`. It already resolves
# transitively and shares the single compiled `tikv-jemalloc-sys` with
# `tikv-jemallocator` (see Cargo.lock), so enabling it adds no second copy of
# jemalloc - only this small ctl FFI shim.
tikv-jemalloc-ctl = { version = "0.5", optional = true }
tikv-jemalloc-ctl = { version = "0.6", optional = true }

[build-dependencies]
substrate-build-script-utils.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub fn create_benchmark_extrinsic(
let era = sp_runtime::generic::Era::mortal(period, best_block.saturated_into());
let extra: runtime::TxExtension = (
(
frame_system::AuthorizeCall::<runtime::Runtime>::new(),
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
Expand All @@ -150,6 +151,7 @@ pub fn create_benchmark_extrinsic(
extra.clone(),
(
(
(),
(),
runtime::VERSION.spec_version,
runtime::VERSION.transaction_version,
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/devnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn devnet_genesis(
"balances": vec![(root_key.clone(), 1_000_000_000_000u128)],
},
"aura": {
"authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>(),
"authorities": initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
},
"grandpa": {
"authorities": initial_authorities
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/finney.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ fn finney_genesis(
) -> serde_json::Value {
serde_json::json!({
"balances": { "balances": balances.to_vec() },
"aura": { "authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>() },
"aura": { "authorities": initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>() },
"grandpa": { "authorities": initial_authorities
.iter()
.map(|x| (x.1.clone(), 1))
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/localnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn localnet_genesis(
serde_json::json!({
"balances": { "balances": balances },
"aura": {
"authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>()
"authorities": initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>()
},
"grandpa": {
"authorities": initial_authorities
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn testnet_genesis(
"balances": vec![(root_key.clone(), 1_000_000_000_000u128)],
},
"aura": {
"authorities": initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>(),
"authorities": initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
},
"grandpa": {
"authorities": initial_authorities
Expand Down
Loading
Loading