diff --git a/.github/workflows/hotfixes.yml b/.github/workflows/hotfixes.yml new file mode 100644 index 000000000..c63399bff --- /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 < Pallet { ); // --- 3. Ensure the supplied work passes the difficulty. - 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 { + 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), 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", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index b03b3f066..2455da5d0 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -643,6 +643,7 @@ pub enum ProxyType { Transfer, SmallTransfer, RootWeights, + ChildKeys, SudoUncheckedSetCode, } // Transfers below SMALL_TRANSFER_LIMIT are considered small transfers @@ -664,6 +665,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, @@ -716,6 +721,13 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_root_weights { .. }) ), + ProxyType::ChildKeys => matches!( + c, + RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. }) + | RuntimeCall::SubtensorModule( + pallet_subtensor::Call::set_childkey_take { .. } + ) + ), ProxyType::SudoUncheckedSetCode => match c { RuntimeCall::Sudo(pallet_sudo::Call::sudo_unchecked_weight { call, weight: _ }) => { let inner_call: RuntimeCall = *call.clone();