Skip to content

Commit 56b3365

Browse files
committed
Merge branch 'devnet-ready' into feat/solidity-get-stake
2 parents 9f64385 + 4b45cd3 commit 56b3365

File tree

5 files changed

+84
-2
lines changed

5 files changed

+84
-2
lines changed

.github/workflows/hotfixes.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Handle Hotfix PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: write
10+
11+
jobs:
12+
handle-hotfix-pr:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check if PR is a hotfix into `main`
16+
if: >
17+
github.event.pull_request.base.ref == 'main' &&
18+
github.event.pull_request.head.ref != 'testnet'
19+
run: |
20+
echo "Hotfix PR detected. Proceeding to label and comment."
21+
22+
- name: Add `hotfix` label
23+
if: >
24+
github.event.pull_request.base.ref == 'main' &&
25+
github.event.pull_request.head.ref != 'testnet'
26+
run: |
27+
curl -X POST \
28+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
29+
-H "Accept: application/vnd.github.v3+json" \
30+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
31+
-d '{"labels":["hotfix"]}'
32+
33+
- name: Add hotfix bot comment
34+
if: >
35+
github.event.pull_request.base.ref == 'main' &&
36+
github.event.pull_request.head.ref != 'testnet'
37+
run: |
38+
COMMENT_BODY=$(cat <<EOF
39+
## 🚨🚨🚨 HOTFIX DETECTED 🚨🚨🚨
40+
41+
It looks like you are trying to merge a hotfix PR into `main`. If this isn't what you wanted to do, and you just wanted to make a regular PR, please close this PR, base your changes off the `devnet-ready` branch and open a new PR into `devnet ready`.
42+
43+
If you _are_ trying to merge a hotfix PR, please complete the following essential steps:
44+
1. [ ] go ahead and get this PR into `main` merged, so we can get the change in as quickly as possible!
45+
2. [ ] merge `main` into `testnet`, bumping `spec_version`
46+
3. [ ] deploy `testnet`
47+
4. [ ] merge `testnet` into `devnet`, bumping `spec_version`
48+
5. [ ] deploy `devnet`
49+
6. [ ] merge `devnet` into `devnet-ready`
50+
51+
52+
If you do not complete these steps, your hotfix may be inadvertently removed in the future when branches are promoted to \`main\`, so it is essential that you do so.
53+
EOF
54+
)
55+
56+
curl -X POST \
57+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
58+
-H "Accept: application/vnd.github.v3+json" \
59+
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
60+
-d "$(jq -n --arg body "$COMMENT_BODY" '{body: $body}')"
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pallets/subtensor/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,4 @@ try-runtime = [
116116
"pallet-collective/try-runtime"
117117
]
118118
pow-faucet = []
119+
fast-blocks = []

pallets/subtensor/src/subnets/registration.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,12 @@ impl<T: Config> Pallet<T> {
381381
);
382382

383383
// --- 3. Ensure the supplied work passes the difficulty.
384-
let difficulty: U256 = U256::from(1_000_000); // Base faucet difficulty.
384+
let difficulty: U256 = if !cfg!(feature = "fast-blocks") {
385+
U256::from(1_000_000) // Base faucet difficulty.
386+
} else {
387+
U256::from(100) // Lowered for fast blocks
388+
};
389+
385390
let work_hash: H256 = Self::vec_to_hash(work.clone());
386391
ensure!(
387392
Self::hash_meets_difficulty(&work_hash, difficulty),

runtime/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ substrate-wasm-builder = { workspace = true, optional = true }
122122
[features]
123123
default = ["std"]
124124
pow-faucet = ["pallet-subtensor/pow-faucet"]
125-
fast-blocks = []
125+
fast-blocks = [
126+
"pallet-subtensor/fast-blocks"
127+
]
126128
std = [
127129
"frame-try-runtime?/std",
128130
"frame-system-benchmarking?/std",

runtime/src/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ pub enum ProxyType {
643643
Transfer,
644644
SmallTransfer,
645645
RootWeights,
646+
ChildKeys,
646647
SudoUncheckedSetCode,
647648
}
648649
// Transfers below SMALL_TRANSFER_LIMIT are considered small transfers
@@ -664,6 +665,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
664665
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::remove_stake { .. })
665666
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::burned_register { .. })
666667
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::root_register { .. })
668+
| RuntimeCall::SubtensorModule(
669+
pallet_subtensor::Call::schedule_swap_coldkey { .. }
670+
)
671+
| RuntimeCall::SubtensorModule(pallet_subtensor::Call::swap_hotkey { .. })
667672
),
668673
ProxyType::Transfer => matches!(
669674
c,
@@ -716,6 +721,13 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
716721
c,
717722
RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_root_weights { .. })
718723
),
724+
ProxyType::ChildKeys => matches!(
725+
c,
726+
RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_children { .. })
727+
| RuntimeCall::SubtensorModule(
728+
pallet_subtensor::Call::set_childkey_take { .. }
729+
)
730+
),
719731
ProxyType::SudoUncheckedSetCode => match c {
720732
RuntimeCall::Sudo(pallet_sudo::Call::sudo_unchecked_weight { call, weight: _ }) => {
721733
let inner_call: RuntimeCall = *call.clone();

0 commit comments

Comments
 (0)