From d48e2bfbda2222244f469cc5150bb458eb4f0b5d Mon Sep 17 00:00:00 2001 From: johnreedv Date: Mon, 4 Nov 2024 13:50:36 -0800 Subject: [PATCH 01/12] Add key swaps & set_children to proxies --- runtime/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 3d1cbb582..fcceb66b3 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -663,6 +663,10 @@ impl InstanceFilter for ProxyType { | RuntimeCall::SubtensorModule(pallet_subtensor::Call::remove_stake { .. }) | RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. }) | RuntimeCall::SubtensorModule(pallet_subtensor::Call::root_register { .. }) + | RuntimeCall::SubtensorModule( + pallet_subtensor::Call::schedule_swap_coldkey { .. } + ) + | RuntimeCall::SubtensorModule(pallet_subtensor::Call::swap_hotkey { .. }) ), ProxyType::Transfer => matches!( c, @@ -704,6 +708,7 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::add_stake { .. }) | RuntimeCall::SubtensorModule(pallet_subtensor::Call::remove_stake { .. }) + | RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) ), ProxyType::Registration => matches!( c, From aa5c4f030aaf5098dd9fc3ae34cfe5b7e4f82930 Mon Sep 17 00:00:00 2001 From: johnreedv Date: Mon, 4 Nov 2024 14:13:53 -0800 Subject: [PATCH 02/12] new ProxyType for childkeys --- runtime/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index fcceb66b3..33e2c3853 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -643,6 +643,7 @@ pub enum ProxyType { Transfer, SmallTransfer, RootWeights, + ChildKeys, } // Transfers below SMALL_TRANSFER_LIMIT are considered small transfers pub const SMALL_TRANSFER_LIMIT: Balance = 500_000_000; // 0.5 TAO @@ -708,7 +709,6 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::add_stake { .. }) | RuntimeCall::SubtensorModule(pallet_subtensor::Call::remove_stake { .. }) - | RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) ), ProxyType::Registration => matches!( c, @@ -719,6 +719,10 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_root_weights { .. }) ), + ProxyType::ChildKeys => matches!( + c, + RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) + ), } } fn is_superset(&self, o: &Self) -> bool { From 9ddbf101df4c6b38ccc215c8609017dc71c2e2a5 Mon Sep 17 00:00:00 2001 From: johnreedv Date: Tue, 5 Nov 2024 08:00:27 -0800 Subject: [PATCH 03/12] bump spec --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 33e2c3853..9bd636da4 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -160,7 +160,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 206, + spec_version: 207, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 1a98baedaacba5647d872bae8b36eb66bda60a96 Mon Sep 17 00:00:00 2001 From: johnreedv Date: Tue, 5 Nov 2024 14:15:21 -0800 Subject: [PATCH 04/12] add set_childkey_take to ChildKeys ProxyType --- runtime/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 9bd636da4..9fe6c5854 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -722,6 +722,9 @@ impl InstanceFilter for ProxyType { ProxyType::ChildKeys => matches!( c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) + | RuntimeCall::SubtensorModule( + pallet_subtensor::Call::set_childkey_take { .. } + ) ), } } From 42fb426e747efe0e1fab977cb653dd0f5b67eed0 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Thu, 7 Nov 2024 13:34:10 -0500 Subject: [PATCH 05/12] lower faucet diff to 1k --- pallets/subtensor/src/subnets/registration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index 9310b7a3f..9bc192759 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -381,7 +381,7 @@ impl Pallet { ); // --- 3. Ensure the supplied work passes the difficulty. - let difficulty: U256 = U256::from(1_000_000); // Base faucet difficulty. + let difficulty: U256 = U256::from(1_000); // Base faucet difficulty. let work_hash: H256 = Self::vec_to_hash(work.clone()); ensure!( Self::hash_meets_difficulty(&work_hash, difficulty), From 2b325b362ae21a7f937b6a1af9d8ae6eab42eed3 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Thu, 7 Nov 2024 13:39:17 -0500 Subject: [PATCH 06/12] lower pow faucet diff using the fast blocks feature flag --- pallets/subtensor/src/subnets/registration.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index 9bc192759..6285a90ab 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -381,7 +381,12 @@ impl Pallet { ); // --- 3. Ensure the supplied work passes the difficulty. - let difficulty: U256 = U256::from(1_000); // Base faucet difficulty. + if !cfg!(feature = "fast-blocks") { + let difficulty: U256 = U256::from(1_000_000); // Base faucet difficulty. + } else { + let difficulty: U256 = U256::from(100); // Lowered for fast blocks + } + let work_hash: H256 = Self::vec_to_hash(work.clone()); ensure!( Self::hash_meets_difficulty(&work_hash, difficulty), From a2d8a58ef7a7c1a91eba68e78046a9c64c3c9af3 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Thu, 7 Nov 2024 13:43:48 -0500 Subject: [PATCH 07/12] add fast blocks feature to the cargo files --- pallets/subtensor/Cargo.toml | 1 + runtime/Cargo.toml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pallets/subtensor/Cargo.toml b/pallets/subtensor/Cargo.toml index 3023d1e0d..100ce0dde 100644 --- a/pallets/subtensor/Cargo.toml +++ b/pallets/subtensor/Cargo.toml @@ -116,3 +116,4 @@ try-runtime = [ "pallet-collective/try-runtime" ] pow-faucet = [] +fast-blocks = [] diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index c82a5aa49..1c37e0bb4 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -122,7 +122,9 @@ substrate-wasm-builder = { workspace = true, optional = true } [features] default = ["std"] pow-faucet = ["pallet-subtensor/pow-faucet"] -fast-blocks = [] +fast-blocks = [ + "pallet-subtensor/fast-blocks" +] std = [ "frame-try-runtime?/std", "frame-system-benchmarking?/std", From 0ece437a362afb471f259b99446d128be855083d Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Thu, 7 Nov 2024 13:44:04 -0500 Subject: [PATCH 08/12] fix faucet diff definition --- pallets/subtensor/src/subnets/registration.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index 6285a90ab..516fd8cf3 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -381,11 +381,11 @@ impl Pallet { ); // --- 3. Ensure the supplied work passes the difficulty. - if !cfg!(feature = "fast-blocks") { - let difficulty: U256 = U256::from(1_000_000); // Base faucet difficulty. + let difficulty: U256 = if !cfg!(feature = "fast-blocks") { + U256::from(1_000_000) // Base faucet difficulty. } else { - let difficulty: U256 = U256::from(100); // Lowered for fast blocks - } + U256::from(100) // Lowered for fast blocks + }; let work_hash: H256 = Self::vec_to_hash(work.clone()); ensure!( From 4550edd1b34c5be5d05d7dc32cf0d6112a1148d0 Mon Sep 17 00:00:00 2001 From: johnreedv Date: Thu, 7 Nov 2024 21:03:17 -0800 Subject: [PATCH 09/12] fmt & bump spec --- runtime/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 6d2611a1d..2455da5d0 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -160,7 +160,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 207, + spec_version: 208, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -645,7 +645,6 @@ pub enum ProxyType { RootWeights, ChildKeys, SudoUncheckedSetCode, - } // Transfers below SMALL_TRANSFER_LIMIT are considered small transfers pub const SMALL_TRANSFER_LIMIT: Balance = 500_000_000; // 0.5 TAO From 7f6d8ca8a5dc4e4668e19ff9a32ad6726793aa01 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Sun, 10 Nov 2024 02:19:58 -0500 Subject: [PATCH 10/12] add bot warning for hotfix PRs --- .github/workflows/hotfixes.yml | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/hotfixes.yml diff --git a/.github/workflows/hotfixes.yml b/.github/workflows/hotfixes.yml new file mode 100644 index 000000000..1663c40ce --- /dev/null +++ b/.github/workflows/hotfixes.yml @@ -0,0 +1,62 @@ +name: Handle Hotfix PRs + +on: + pull_request: + types: [opened] + +permissions: + pull-requests: write + contents: write + +jobs: + handle-hotfix-pr: + runs-on: ubuntu-latest + steps: + - name: Check if PR is a hotfix into `main` + if: > + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.ref != 'testnet' + run: | + echo "Hotfix PR detected. Proceeding to label and comment." + + - name: Add `hotfix` label + if: > + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.ref != 'testnet' + run: | + curl -X POST \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \ + -d '{"labels":["hotfix"]}' + + - name: Add hotfix bot comment + if: > + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.ref != 'testnet' + run: | + COMMENT_BODY=$(cat < Date: Sun, 10 Nov 2024 02:23:24 -0500 Subject: [PATCH 11/12] tweak --- .github/workflows/hotfixes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hotfixes.yml b/.github/workflows/hotfixes.yml index 1663c40ce..c63399bff 100644 --- a/.github/workflows/hotfixes.yml +++ b/.github/workflows/hotfixes.yml @@ -38,7 +38,7 @@ jobs: COMMENT_BODY=$(cat < Date: Sun, 10 Nov 2024 02:24:43 -0500 Subject: [PATCH 12/12] bump CI