From 6efd94ba600019ac42bd05bb9e6a66ea0c685584 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:08:12 -0400
Subject: [PATCH 01/51] add check-labels action

---
 .github/workflows/check-labels.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 .github/workflows/check-labels.yml

diff --git a/.github/workflows/check-labels.yml b/.github/workflows/check-labels.yml
new file mode 100644
index 000000000..a3aa1b626
--- /dev/null
+++ b/.github/workflows/check-labels.yml
@@ -0,0 +1,18 @@
+name: Check Labels
+on:
+  pull_request:
+    types: [opened, labeled, unlabeled, synchronize]
+jobs:
+  check-labels:
+    runs-on: ubuntu-latest
+    permissions:
+      issues: write
+      pull-requests: write
+    steps:
+      - uses: mheap/github-action-required-labels@v5
+        with:
+          mode: exactly
+          count: 2
+          labels: |
+            devnet-pass
+            testnet-pass

From cada696ce4c913c4a2c72b32c2131b82b3c40a29 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:08:41 -0400
Subject: [PATCH 02/51] add label-triggers action

---
 .github/workflows/label-triggers.yml | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 .github/workflows/label-triggers.yml

diff --git a/.github/workflows/label-triggers.yml b/.github/workflows/label-triggers.yml
new file mode 100644
index 000000000..d32396e07
--- /dev/null
+++ b/.github/workflows/label-triggers.yml
@@ -0,0 +1,25 @@
+name: Label Triggers
+on:
+  pull_request:
+    types:
+      - labeled
+
+permissions:
+  issues: write
+  pull-requests: write
+
+jobs:
+  comment_on_breaking_change:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check if 'breaking change' label is added
+        if: github.event.label.name == 'breaking-change'
+        uses: actions/github-script@v6
+        with:
+          script: |
+            github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body: '@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!'
+            })

From 135c8096c3046a944550165ef1376f0016030b73 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:12:57 -0400
Subject: [PATCH 03/51] bump CI


From 925341606470f8dd4c554d5d55d819dad2c47f54 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:22:35 -0400
Subject: [PATCH 04/51] split devnet and testnet label checking into their own
 actions

---
 .../{check-labels.yml => devnet-check.yml}    |  9 +++++----
 .github/workflows/testnet-check.yml           | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)
 rename .github/workflows/{check-labels.yml => devnet-check.yml} (73%)
 create mode 100644 .github/workflows/testnet-check.yml

diff --git a/.github/workflows/check-labels.yml b/.github/workflows/devnet-check.yml
similarity index 73%
rename from .github/workflows/check-labels.yml
rename to .github/workflows/devnet-check.yml
index a3aa1b626..a54e6444d 100644
--- a/.github/workflows/check-labels.yml
+++ b/.github/workflows/devnet-check.yml
@@ -1,4 +1,4 @@
-name: Check Labels
+name: Tested on devnet
 on:
   pull_request:
     types: [opened, labeled, unlabeled, synchronize]
@@ -11,8 +11,9 @@ jobs:
     steps:
       - uses: mheap/github-action-required-labels@v5
         with:
-          mode: exactly
-          count: 2
+          mode: minimum
+          count: 1
           labels: |
             devnet-pass
-            testnet-pass
+            devnet-skip
+            hotfix
diff --git a/.github/workflows/testnet-check.yml b/.github/workflows/testnet-check.yml
new file mode 100644
index 000000000..ab88a049a
--- /dev/null
+++ b/.github/workflows/testnet-check.yml
@@ -0,0 +1,19 @@
+name: Tested on devnet
+on:
+  pull_request:
+    types: [opened, labeled, unlabeled, synchronize]
+jobs:
+  check-labels:
+    runs-on: ubuntu-latest
+    permissions:
+      issues: write
+      pull-requests: write
+    steps:
+      - uses: mheap/github-action-required-labels@v5
+        with:
+          mode: minimum
+          count: 1
+          labels: |
+            testnet-pass
+            testnet-skip
+            hotfix

From f261b89526f8063596137e36d66dedabd5abb413 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:23:23 -0400
Subject: [PATCH 05/51] typo

---
 .github/workflows/testnet-check.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/testnet-check.yml b/.github/workflows/testnet-check.yml
index ab88a049a..5e72e8641 100644
--- a/.github/workflows/testnet-check.yml
+++ b/.github/workflows/testnet-check.yml
@@ -1,4 +1,4 @@
-name: Tested on devnet
+name: Tested on testnet
 on:
   pull_request:
     types: [opened, labeled, unlabeled, synchronize]

From 9a2a77610008982b2c5a0421b7080fd90c68380f Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:30:06 -0400
Subject: [PATCH 06/51] spec-version sub-crate scaffold

---
 Cargo.lock               | 4 ++++
 Cargo.toml               | 1 +
 spec-version/Cargo.toml  | 6 ++++++
 spec-version/src/main.rs | 3 +++
 4 files changed, 14 insertions(+)
 create mode 100644 spec-version/Cargo.toml
 create mode 100644 spec-version/src/main.rs

diff --git a/Cargo.lock b/Cargo.lock
index 77ba885b1..b302fc5b3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7988,6 +7988,10 @@ dependencies = [
  "sp-std",
 ]
 
+[[package]]
+name = "spec-version"
+version = "0.1.0"
+
 [[package]]
 name = "spin"
 version = "0.5.2"
diff --git a/Cargo.toml b/Cargo.toml
index 5389d330c..31dc70bc6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,6 +5,7 @@ members = [
     "pallets/subtensor",
     "pallets/commitments",
     "runtime",
+    "spec-version",
 ]
 
 [profile.release]
diff --git a/spec-version/Cargo.toml b/spec-version/Cargo.toml
new file mode 100644
index 000000000..1065614de
--- /dev/null
+++ b/spec-version/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "spec-version"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
diff --git a/spec-version/src/main.rs b/spec-version/src/main.rs
new file mode 100644
index 000000000..e7a11a969
--- /dev/null
+++ b/spec-version/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+    println!("Hello, world!");
+}

From 36409e2e3dd824aa818c4cb1f6d421a5b632d3ee Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:33:33 -0400
Subject: [PATCH 07/51] remove from workspace to avoid version conflicts for
 now

---
 Cargo.lock              | 4 ----
 Cargo.toml              | 1 -
 spec-version/Cargo.toml | 2 ++
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index b302fc5b3..77ba885b1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7988,10 +7988,6 @@ dependencies = [
  "sp-std",
 ]
 
-[[package]]
-name = "spec-version"
-version = "0.1.0"
-
 [[package]]
 name = "spin"
 version = "0.5.2"
diff --git a/Cargo.toml b/Cargo.toml
index 31dc70bc6..5389d330c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,6 @@ members = [
     "pallets/subtensor",
     "pallets/commitments",
     "runtime",
-    "spec-version",
 ]
 
 [profile.release]
diff --git a/spec-version/Cargo.toml b/spec-version/Cargo.toml
index 1065614de..2ede8c43e 100644
--- a/spec-version/Cargo.toml
+++ b/spec-version/Cargo.toml
@@ -2,5 +2,7 @@
 name = "spec-version"
 version = "0.1.0"
 edition = "2021"
+license = "MIT"
 
 [dependencies]
+subxt = "0.35.3"

From 1ab3f47f8325a23d2c39f8104b2caf0dc4c9a193 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 03:57:09 -0400
Subject: [PATCH 08/51] never mind

---
 spec-version/Cargo.toml  | 8 --------
 spec-version/src/main.rs | 3 ---
 2 files changed, 11 deletions(-)
 delete mode 100644 spec-version/Cargo.toml
 delete mode 100644 spec-version/src/main.rs

diff --git a/spec-version/Cargo.toml b/spec-version/Cargo.toml
deleted file mode 100644
index 2ede8c43e..000000000
--- a/spec-version/Cargo.toml
+++ /dev/null
@@ -1,8 +0,0 @@
-[package]
-name = "spec-version"
-version = "0.1.0"
-edition = "2021"
-license = "MIT"
-
-[dependencies]
-subxt = "0.35.3"
diff --git a/spec-version/src/main.rs b/spec-version/src/main.rs
deleted file mode 100644
index e7a11a969..000000000
--- a/spec-version/src/main.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    println!("Hello, world!");
-}

From ebcda57cd4f64f3fdbd9f68a8d15475bd517ef10 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 13:08:20 -0400
Subject: [PATCH 09/51] WIP

---
 .github/workflows/deploy.yml | 72 ++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 .github/workflows/deploy.yml

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 000000000..f32fb2123
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,72 @@
+name: CI
+
+concurrency:
+  group: ci-${{ github.ref }}
+  cancel-in-progress: true
+
+on:
+  workflow_dispatch:
+    inputs:
+      network:
+        type: choice
+        description: Which network to deploy to
+        required: true
+        default: devnet
+        options:
+          - devnet
+          - testnet
+          - finney
+
+env:
+  CARGO_TERM_COLOR: always
+  RUST_BACKTRACE: 1
+
+jobs:
+  # runs cargo test --workspace
+  cargo-test:
+    name: cargo test
+    runs-on: SubtensorCI
+    strategy:
+      matrix:
+        rust-branch:
+          - nightly-2024-03-05
+        rust-target:
+          - x86_64-unknown-linux-gnu
+          # - x86_64-apple-darwin
+        os:
+          - ubuntu-latest
+          # - macos-latest
+        include:
+          - os: ubuntu-latest
+          # - os: macos-latest
+    env:
+      RELEASE_NAME: development
+      # RUSTFLAGS: -A warnings
+      RUSTV: ${{ matrix.rust-branch }}
+      RUST_BACKTRACE: full
+      RUST_BIN_DIR: target/${{ matrix.rust-target }}
+      SKIP_WASM_BUILD: 1
+      TARGET: ${{ matrix.rust-target }}
+    steps:
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v2
+
+      - name: Install dependencies
+        run: |
+          sudo apt-get update &&
+          sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
+
+      - name: Install Rust ${{ matrix.rust-branch }}
+        uses: actions-rs/toolchain@v1.0.6
+        with:
+          toolchain: ${{ matrix.rust-branch }}
+          components: rustfmt, clippy
+          profile: minimal
+
+      - name: Utilize Rust shared cached
+        uses: Swatinem/rust-cache@v2.2.1
+        with:
+          key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}
+
+      - name: cargo test --workspace
+        run: cargo test --workspace

From 7b3347e59018b9af457c209ae4df6183af747b3b Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 13:59:37 -0400
Subject: [PATCH 10/51] try fake deploy

---
 .github/workflows/deploy.yml | 60 ++++++++++++------------------------
 1 file changed, 19 insertions(+), 41 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index f32fb2123..5f5a0bba5 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -1,4 +1,4 @@
-name: CI
+name: Deploy
 
 concurrency:
   group: ci-${{ github.ref }}
@@ -22,51 +22,29 @@ env:
   RUST_BACKTRACE: 1
 
 jobs:
-  # runs cargo test --workspace
-  cargo-test:
-    name: cargo test
+  deploy:
+    name: Deploy to ${{ github.event.inputs.network }}
     runs-on: SubtensorCI
-    strategy:
-      matrix:
-        rust-branch:
-          - nightly-2024-03-05
-        rust-target:
-          - x86_64-unknown-linux-gnu
-          # - x86_64-apple-darwin
-        os:
-          - ubuntu-latest
-          # - macos-latest
-        include:
-          - os: ubuntu-latest
-          # - os: macos-latest
-    env:
-      RELEASE_NAME: development
-      # RUSTFLAGS: -A warnings
-      RUSTV: ${{ matrix.rust-branch }}
-      RUST_BACKTRACE: full
-      RUST_BIN_DIR: target/${{ matrix.rust-target }}
-      SKIP_WASM_BUILD: 1
-      TARGET: ${{ matrix.rust-target }}
     steps:
-      - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
-
-      - name: Install dependencies
+      - name: Dependencies
         run: |
           sudo apt-get update &&
-          sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
+          sudo apt-get install -y curl jq nodejs clang curl libssl-dev llvm \
+                                  libudev-dev protobuf-compiler &&
+          npm install -g wscat
 
-      - name: Install Rust ${{ matrix.rust-branch }}
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v4
+
+      - name: Install Rust
         uses: actions-rs/toolchain@v1.0.6
-        with:
-          toolchain: ${{ matrix.rust-branch }}
-          components: rustfmt, clippy
-          profile: minimal
 
-      - name: Utilize Rust shared cached
-        uses: Swatinem/rust-cache@v2.2.1
-        with:
-          key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}
+      - name: Get live spec_version for ${{ github.event.inputs.network }}
+        run: |
+          output=$(wscat -c wss://test.finney.opentensor.ai:443 \
+            -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | \
+            jq -r '.result.specVersion' | tr -d '\n')
+          echo "::set-output name=spec_version::$output"
 
-      - name: cargo test --workspace
-        run: cargo test --workspace
+      - name: cargo build --release -p node-subtensor
+        run: cargo build --release -p node-subtensor

From 7c12332c8aafbc77322e6f5587817761136dcdd3 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 14:26:17 -0400
Subject: [PATCH 11/51] force it to show up

---
 .github/workflows/deploy.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 5f5a0bba5..c6176c53f 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -5,6 +5,8 @@ concurrency:
   cancel-in-progress: true
 
 on:
+  pull_request:
+    branches: [main, development, staging]
   workflow_dispatch:
     inputs:
       network:

From ce23465176defd60f96ec0d73d74ce0efaba3abf Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 14:35:07 -0400
Subject: [PATCH 12/51] blah blah specify toolchain yes yes

---
 .github/workflows/deploy.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index c6176c53f..b7a8d24af 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -40,6 +40,8 @@ jobs:
 
       - name: Install Rust
         uses: actions-rs/toolchain@v1.0.6
+        with:
+          toolchain: stable
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |

From 39d4520eda9c686e61f67579e7b4bfaf2a4d8de7 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 14:51:01 -0400
Subject: [PATCH 13/51] use new output style

---
 .github/workflows/deploy.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index b7a8d24af..8b3ac4e1f 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -45,10 +45,11 @@ jobs:
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
-          output=$(wscat -c wss://test.finney.opentensor.ai:443 \
+          spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 \
             -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | \
             jq -r '.result.specVersion' | tr -d '\n')
-          echo "::set-output name=spec_version::$output"
+          echo "spec_version: $spec_version"
+          echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
 
       - name: cargo build --release -p node-subtensor
         run: cargo build --release -p node-subtensor

From b7baa91cacd9d63c6e7db314a567691234c9230c Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 15:00:27 -0400
Subject: [PATCH 14/51] try single line

---
 .github/workflows/deploy.yml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 8b3ac4e1f..8dd4248b6 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -45,9 +45,8 @@ jobs:
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
-          spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 \
-            -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | \
-            jq -r '.result.specVersion' | tr -d '\n')
+          spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
+          ${spec_version:?bad spec version}
           echo "spec_version: $spec_version"
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
 

From 25f5f711c8ab54dc2d344fa745efaba1a524218e Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 10 May 2024 15:05:52 -0400
Subject: [PATCH 15/51] fix

---
 .github/workflows/deploy.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 8dd4248b6..df29194da 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -46,9 +46,9 @@ jobs:
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
           spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
-          ${spec_version:?bad spec version}
+          : ${spec_version:?bad spec version}
           echo "spec_version: $spec_version"
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
 
       - name: cargo build --release -p node-subtensor
-        run: cargo build --release -p node-subtensor
+        run: echo "hey" # cargo build --release -p node-subtensor

From 6f464e3d46f081dfc2843c9376d3027e654e9427 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:18:28 -0400
Subject: [PATCH 16/51] try again

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index df29194da..19d2eb1fc 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -46,8 +46,8 @@ jobs:
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
           spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
+          echo "spec_version: |$spec_version|"
           : ${spec_version:?bad spec version}
-          echo "spec_version: $spec_version"
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
 
       - name: cargo build --release -p node-subtensor

From 2f2df2e394c587e6c4b493662236aaf667e8732a Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:23:02 -0400
Subject: [PATCH 17/51] tweak again

---
 .github/workflows/deploy.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 19d2eb1fc..5743e8dee 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -45,6 +45,7 @@ jobs:
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
+          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1
           spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
           echo "spec_version: |$spec_version|"
           : ${spec_version:?bad spec version}

From 9eaebf9aae92f2e377b801337624d500770de8dc Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:23:50 -0400
Subject: [PATCH 18/51] remove trigger

---
 .github/workflows/deploy.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 5743e8dee..f1daa68b2 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -5,8 +5,6 @@ concurrency:
   cancel-in-progress: true
 
 on:
-  pull_request:
-    branches: [main, development, staging]
   workflow_dispatch:
     inputs:
       network:

From de299855d9680dbc8054f29d7c7f1de796971161 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:26:30 -0400
Subject: [PATCH 19/51] another

---
 .github/workflows/deploy.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index f1daa68b2..d83f913d3 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -41,9 +41,12 @@ jobs:
         with:
           toolchain: stable
 
-      - name: Get live spec_version for ${{ github.event.inputs.network }}
+      - name: try on its own
         run: |
           wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1
+
+      - name: Get live spec_version for ${{ github.event.inputs.network }}
+        run: |
           spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
           echo "spec_version: |$spec_version|"
           : ${spec_version:?bad spec version}

From c3a0448ab1033e36ed2d9d9a79386458091d4fd4 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:29:52 -0400
Subject: [PATCH 20/51] try on ubuntu-latest

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index d83f913d3..df8247d43 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -24,7 +24,7 @@ env:
 jobs:
   deploy:
     name: Deploy to ${{ github.event.inputs.network }}
-    runs-on: SubtensorCI
+    runs-on: ubuntu-latest
     steps:
       - name: Dependencies
         run: |

From 36ab313ead507985d4f2434a1e91529a729922db Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Sun, 12 May 2024 21:31:29 -0400
Subject: [PATCH 21/51] never mind

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index df8247d43..d83f913d3 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -24,7 +24,7 @@ env:
 jobs:
   deploy:
     name: Deploy to ${{ github.event.inputs.network }}
-    runs-on: ubuntu-latest
+    runs-on: SubtensorCI
     steps:
       - name: Dependencies
         run: |

From e6b95cc62df2f8407d12f401f3ead9a22a127b69 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Mon, 13 May 2024 01:51:49 -0400
Subject: [PATCH 22/51] show ping pong

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index d83f913d3..9a62214ff 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -43,7 +43,7 @@ jobs:
 
       - name: try on its own
         run: |
-          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1
+          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 --show-ping-pong
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |

From b97eb5b222e01bec05a2448077aa6b6cc392f101 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Mon, 13 May 2024 01:59:21 -0400
Subject: [PATCH 23/51] wait 30 seconds

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 9a62214ff..8b5ffe399 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -43,7 +43,7 @@ jobs:
 
       - name: try on its own
         run: |
-          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 --show-ping-pong
+          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 30 --show-ping-pong
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |

From 66acddaac647a903575e486371f37d90997ca231 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Mon, 13 May 2024 17:13:05 -0400
Subject: [PATCH 24/51] try test.chain.opentensor.ai instead

---
 .github/workflows/deploy.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 8b5ffe399..b9598967a 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -43,11 +43,11 @@ jobs:
 
       - name: try on its own
         run: |
-          wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 30 --show-ping-pong
+          wscat -c wss://test.chain.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 30 --show-ping-pong
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
-          spec_version=$(wscat -c wss://test.finney.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
+          spec_version=$(wscat -c wss://test.chain.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
           echo "spec_version: |$spec_version|"
           : ${spec_version:?bad spec version}
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT

From 8dbdd714ae952aa760c19efa7b459ae5008d277b Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 15:04:47 -0400
Subject: [PATCH 25/51] try with subxt

---
 .github/workflows/deploy.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index b9598967a..1bfed418c 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -41,9 +41,12 @@ jobs:
         with:
           toolchain: stable
 
+      - name: Install subxt
+        run: cargo install subxt-cli
+
       - name: try on its own
         run: |
-          wscat -c wss://test.chain.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 30 --show-ping-pong
+          PATH=$PATH:$HOME/.cargo/.bin subxt metadata --url wss://test.chain.opentensor.ai:443 --format json
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |

From f832c6891d742c95606058d758f7c6e45a1fcfa2 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 15:10:43 -0400
Subject: [PATCH 26/51] fix

---
 .github/workflows/deploy.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 1bfed418c..d5509661e 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -33,9 +33,6 @@ jobs:
                                   libudev-dev protobuf-compiler &&
           npm install -g wscat
 
-      - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v4
-
       - name: Install Rust
         uses: actions-rs/toolchain@v1.0.6
         with:
@@ -44,6 +41,9 @@ jobs:
       - name: Install subxt
         run: cargo install subxt-cli
 
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v4
+
       - name: try on its own
         run: |
           PATH=$PATH:$HOME/.cargo/.bin subxt metadata --url wss://test.chain.opentensor.ai:443 --format json

From 7c258e71ddd89432af85ffc5407d733d54dac0ec Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 17:22:26 -0400
Subject: [PATCH 27/51] try with new substrate-spec-version crate

---
 .github/workflows/deploy.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index d5509661e..dbd2b5693 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -38,15 +38,15 @@ jobs:
         with:
           toolchain: stable
 
-      - name: Install subxt
-        run: cargo install subxt-cli
+      - name: Install substrate-spec-version
+        run: cargo install substrate-spec-version
 
       - name: Check-out repository under $GITHUB_WORKSPACE
         uses: actions/checkout@v4
 
       - name: try on its own
         run: |
-          PATH=$PATH:$HOME/.cargo/.bin subxt metadata --url wss://test.chain.opentensor.ai:443 --format json
+          PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.chain.opentensor.ai:443
 
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |

From af1bc4e661ce831147e7e6328432789b03214a0a Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 17:28:51 -0400
Subject: [PATCH 28/51] live spec version working :tada: :tada:

---
 .github/workflows/deploy.yml | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index dbd2b5693..f728da0f0 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -29,9 +29,8 @@ jobs:
       - name: Dependencies
         run: |
           sudo apt-get update &&
-          sudo apt-get install -y curl jq nodejs clang curl libssl-dev llvm \
-                                  libudev-dev protobuf-compiler &&
-          npm install -g wscat
+          sudo apt-get install -y curl clang curl libssl-dev llvm \
+                                  libudev-dev protobuf-compiler
 
       - name: Install Rust
         uses: actions-rs/toolchain@v1.0.6
@@ -44,13 +43,9 @@ jobs:
       - name: Check-out repository under $GITHUB_WORKSPACE
         uses: actions/checkout@v4
 
-      - name: try on its own
-        run: |
-          PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.chain.opentensor.ai:443
-
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
-          spec_version=$(wscat -c wss://test.chain.opentensor.ai:443 -x '{"id":1, "jsonrpc":"2.0", "method": "state_getRuntimeVersion"}' -w 1 | jq -r '.result.specVersion' | tr -d '\n')
+          spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.chain.opentensor.ai:443 | tr -d '\n')
           echo "spec_version: |$spec_version|"
           : ${spec_version:?bad spec version}
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT

From 71525d9fbfcf0ab10a40bae765aa26c5756960b7 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 17:38:05 -0400
Subject: [PATCH 29/51] perform full build / make use of spec version

---
 .github/workflows/deploy.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index f728da0f0..df912937c 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -46,9 +46,11 @@ jobs:
       - name: Get live spec_version for ${{ github.event.inputs.network }}
         run: |
           spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.chain.opentensor.ai:443 | tr -d '\n')
-          echo "spec_version: |$spec_version|"
+          echo "spec_version: $spec_version"
           : ${spec_version:?bad spec version}
           echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
 
       - name: cargo build --release -p node-subtensor
-        run: echo "hey" # cargo build --release -p node-subtensor
+        run: |
+          cargo build --release -p node-subtensor
+          ls -lh target/release/node-subtensor

From c92def2b166615b46ad3d9af28740f23f44ca59c Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Wed, 15 May 2024 17:38:27 -0400
Subject: [PATCH 30/51] simplified rust toolchain setup

---
 .github/workflows/deploy.yml | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index df912937c..d2fa8e428 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -32,10 +32,8 @@ jobs:
           sudo apt-get install -y curl clang curl libssl-dev llvm \
                                   libudev-dev protobuf-compiler
 
-      - name: Install Rust
-        uses: actions-rs/toolchain@v1.0.6
-        with:
-          toolchain: stable
+      - name: Set up Rust Toolchain
+        run: curl https://sh.rustup.rs -sSf | sh -s -- -y
 
       - name: Install substrate-spec-version
         run: cargo install substrate-spec-version

From 0f50a7f8ae2402530ec3bb8e5c46abb37d9e6c13 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Fri, 17 May 2024 16:09:53 -0400
Subject: [PATCH 31/51] remove concurrency settings

---
 .github/workflows/deploy.yml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index d2fa8e428..5c793f78d 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -1,9 +1,5 @@
 name: Deploy
 
-concurrency:
-  group: ci-${{ github.ref }}
-  cancel-in-progress: true
-
 on:
   workflow_dispatch:
     inputs:

From 8cf012677c088a48e3e37edad70021216050e796 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 01:43:39 -0400
Subject: [PATCH 32/51] fix using outdated version of checkout action

---
 .github/workflows/check-rust.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml
index b1c36057d..cd017e522 100644
--- a/.github/workflows/check-rust.yml
+++ b/.github/workflows/check-rust.yml
@@ -56,7 +56,7 @@ jobs:
       TARGET: ${{ matrix.rust-target }}
     steps:
       - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Install dependencies
         run: sudo apt-get update && sudo apt-get install -y build-essential
@@ -98,7 +98,7 @@ jobs:
       TARGET: ${{ matrix.rust-target }}
     steps:
       - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Install dependencies
         run: |
@@ -147,7 +147,7 @@ jobs:
       TARGET: ${{ matrix.rust-target }}
     steps:
       - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Install dependencies
         run: |
@@ -196,7 +196,7 @@ jobs:
       TARGET: ${{ matrix.rust-target }}
     steps:
       - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Install dependencies
         run: |
@@ -245,7 +245,7 @@ jobs:
       TARGET: ${{ matrix.rust-target }}
     steps:
       - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
 
       - name: Install dependencies
         run: |
@@ -292,7 +292,7 @@ jobs:
         run: cargo install --locked -q zepter && zepter --version
 
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
         with:
           fetch-depth: 0 # Dont clone historic commits.
 
@@ -304,7 +304,7 @@ jobs:
     runs-on: ubuntu-22.04
     steps:
       - name: Checkout sources
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: Run Try Runtime Checks
         uses: "paritytech/try-runtime-gha@v0.1.0"
@@ -324,7 +324,7 @@ jobs:
   #   runs-on: ubuntu-22.04
   #   steps:
   #     - name: Checkout sources
-  #       uses: actions/checkout@v3
+  #       uses: actions/checkout@v4
   #
   #     - name: Run Try Runtime Checks
   #       uses: "paritytech/try-runtime-gha@v0.1.0"
@@ -339,7 +339,7 @@ jobs:
   #   runs-on: ubuntu-22.04
   #   steps:
   #     - name: Checkout sources
-  #       uses: actions/checkout@v3
+  #       uses: actions/checkout@v4
   #
   #     - name: Run Try Runtime Checks
   #       uses: "paritytech/try-runtime-gha@v0.1.0"

From 664b1be6e6fdbf4e264adfaa87af538a4aade911 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 03:37:06 -0400
Subject: [PATCH 33/51] real spec version check

---
 .github/workflows/check-devnet.yml | 39 +++++++++++++++++++++++
 .github/workflows/deploy.yml       | 50 ------------------------------
 runtime/Cargo.toml                 |  4 +++
 runtime/src/spec_version.rs        |  5 +++
 4 files changed, 48 insertions(+), 50 deletions(-)
 create mode 100644 .github/workflows/check-devnet.yml
 delete mode 100644 .github/workflows/deploy.yml
 create mode 100644 runtime/src/spec_version.rs

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
new file mode 100644
index 000000000..df64b4be1
--- /dev/null
+++ b/.github/workflows/check-devnet.yml
@@ -0,0 +1,39 @@
+name: Devnet CI
+
+on:
+  push:
+    branches: [devnet, main]
+  pull_request:
+    branches: [devnet, main]
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  check-spec-version:
+    name: Check that spec_version has been bumped
+    runs-on: SubtensorCI
+    steps:
+      - name: Dependencies
+        run: |
+          sudo apt-get update &&
+          sudo apt-get install -y curl clang curl libssl-dev llvm \
+                                  libudev-dev protobuf-compiler
+
+      - name: Set up Rust Toolchain
+        run: curl https://sh.rustup.rs -sSf | sh -s -- -y
+
+      - name: Install substrate-spec-version
+        run: cargo install substrate-spec-version
+
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v4
+
+      - name: Check that spec_version has been bumped
+        run: |
+          spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://dev.chain.opentensor.ai:443 | tr -d '\n')
+          echo "network spec_version: $spec_version"
+          : ${spec_version:?bad spec version}
+          local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
+          echo "local spec_version: $local_spec_version"
+          [ "$spec_version" != "$local_spec_version" ]
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
deleted file mode 100644
index 5c793f78d..000000000
--- a/.github/workflows/deploy.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: Deploy
-
-on:
-  workflow_dispatch:
-    inputs:
-      network:
-        type: choice
-        description: Which network to deploy to
-        required: true
-        default: devnet
-        options:
-          - devnet
-          - testnet
-          - finney
-
-env:
-  CARGO_TERM_COLOR: always
-  RUST_BACKTRACE: 1
-
-jobs:
-  deploy:
-    name: Deploy to ${{ github.event.inputs.network }}
-    runs-on: SubtensorCI
-    steps:
-      - name: Dependencies
-        run: |
-          sudo apt-get update &&
-          sudo apt-get install -y curl clang curl libssl-dev llvm \
-                                  libudev-dev protobuf-compiler
-
-      - name: Set up Rust Toolchain
-        run: curl https://sh.rustup.rs -sSf | sh -s -- -y
-
-      - name: Install substrate-spec-version
-        run: cargo install substrate-spec-version
-
-      - name: Check-out repository under $GITHUB_WORKSPACE
-        uses: actions/checkout@v4
-
-      - name: Get live spec_version for ${{ github.event.inputs.network }}
-        run: |
-          spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.chain.opentensor.ai:443 | tr -d '\n')
-          echo "spec_version: $spec_version"
-          : ${spec_version:?bad spec version}
-          echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
-
-      - name: cargo build --release -p node-subtensor
-        run: |
-          cargo build --release -p node-subtensor
-          ls -lh target/release/node-subtensor
diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
index 5e4fd1900..9d07eab38 100644
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -15,6 +15,10 @@ workspace = true
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
 
+[[bin]]
+name = "spec_version"
+path = "src/spec_version.rs"
+
 [dependencies]
 pallet-subtensor = { version = "4.0.0-dev", default-features = false, path = "../pallets/subtensor" }
 subtensor-custom-rpc-runtime-api = { version = "0.0.2", path = "../pallets/subtensor/runtime-api", default-features = false }
diff --git a/runtime/src/spec_version.rs b/runtime/src/spec_version.rs
new file mode 100644
index 000000000..20b75ac04
--- /dev/null
+++ b/runtime/src/spec_version.rs
@@ -0,0 +1,5 @@
+use node_subtensor_runtime::VERSION;
+
+fn main() {
+    println!("{}", VERSION.spec_version);
+}

From df27f60d93201f84b08e0b724318a30f0a607a06 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 03:53:12 -0400
Subject: [PATCH 34/51] clear out old migrations

---
 runtime/src/lib.rs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index b7cc7bea4..a3935635d 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -1171,12 +1171,7 @@ pub type SignedExtra = (
     pallet_commitments::CommitmentsSignedExtension<Runtime>,
 );
 
-type Migrations = (
-    init_storage_versions::Migration,
-    account_data_migration::Migration,
-    pallet_multisig::migrations::v1::MigrateToV1<Runtime>,
-    pallet_preimage::migration::v1::Migration<Runtime>,
-);
+type Migrations = ();
 
 // Unchecked extrinsic type as expected by this runtime.
 pub type UncheckedExtrinsic =

From e7c479d9af0c30d02bf17fddecd6c33922a69b25 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:01:27 -0400
Subject: [PATCH 35/51] fix warnings

---
 runtime/src/lib.rs                               | 1 -
 runtime/src/migrations/account_data_migration.rs | 2 ++
 runtime/src/migrations/init_storage_versions.rs  | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index a3935635d..30757e585 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -10,7 +10,6 @@ mod migrations;
 
 use codec::{Decode, Encode, MaxEncodedLen};
 
-use migrations::{account_data_migration, init_storage_versions};
 use pallet_commitments::CanCommit;
 use pallet_grandpa::{
     fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
diff --git a/runtime/src/migrations/account_data_migration.rs b/runtime/src/migrations/account_data_migration.rs
index 5db5c3261..d94f56e21 100644
--- a/runtime/src/migrations/account_data_migration.rs
+++ b/runtime/src/migrations/account_data_migration.rs
@@ -50,6 +50,8 @@ enum PreUpgradeInfo {
 }
 
 const TARGET: &str = "runtime::account_data_migration";
+
+#[allow(unused)]
 pub struct Migration;
 impl OnRuntimeUpgrade for Migration {
     /// Save pre-upgrade account ids to check are decodable post-upgrade.
diff --git a/runtime/src/migrations/init_storage_versions.rs b/runtime/src/migrations/init_storage_versions.rs
index 9ad0f9b2a..de9395cc5 100644
--- a/runtime/src/migrations/init_storage_versions.rs
+++ b/runtime/src/migrations/init_storage_versions.rs
@@ -1,6 +1,7 @@
 use crate::*;
 
 /// Init the on-chain storage versions of pallets added to the runtime prior to this being an automatic process.
+#[allow(unused)]
 pub struct Migration;
 
 impl OnRuntimeUpgrade for Migration {

From d3070664ff317364f41b6834f18db41e00ca0c7f Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:13:25 -0400
Subject: [PATCH 36/51] proper spec version check

---
 .github/workflows/check-devnet.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index df64b4be1..272cf1897 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -11,7 +11,7 @@ env:
 
 jobs:
   check-spec-version:
-    name: Check that spec_version has been bumped
+    name: Check spec_version bump
     runs-on: SubtensorCI
     steps:
       - name: Dependencies
@@ -36,4 +36,6 @@ jobs:
           : ${spec_version:?bad spec version}
           local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
           echo "local spec_version: $local_spec_version"
-          [ "$spec_version" != "$local_spec_version" ]
+          echo "network spec_version: $spec_version"
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version < $spec_version ❌"; exit 1; fi
+          echo "spec_version will correctly bump from $spec_version to $local_spec_version ✅"

From 5a0259453194ac6d1c8db1651eeea806663de262 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:13:43 -0400
Subject: [PATCH 37/51] fix

---
 .github/workflows/check-devnet.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 272cf1897..7a7f4d672 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -37,5 +37,5 @@ jobs:
           local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
           echo "local spec_version: $local_spec_version"
           echo "network spec_version: $spec_version"
-          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version < $spec_version ❌"; exit 1; fi
+          if (( $(echo "$local_spec_version > $spec_version" | bc -l) )); then echo "$local_spec_version < $spec_version ❌"; exit 1; fi
           echo "spec_version will correctly bump from $spec_version to $local_spec_version ✅"

From 1e8ad85cf46ed9fbfdf73a11c43c370e51b1b1f6 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:20:43 -0400
Subject: [PATCH 38/51] whoops

---
 .github/workflows/check-devnet.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 7a7f4d672..d7967df92 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -37,5 +37,5 @@ jobs:
           local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
           echo "local spec_version: $local_spec_version"
           echo "network spec_version: $spec_version"
-          if (( $(echo "$local_spec_version > $spec_version" | bc -l) )); then echo "$local_spec_version < $spec_version ❌"; exit 1; fi
-          echo "spec_version will correctly bump from $spec_version to $local_spec_version ✅"
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version <= $spec_version ❌"; exit 1; fi
+          echo "spec_version will correctly bump from $local_spec_version to $spec_version ✅"

From ed611e3cd6b5206d7a2116534507db83cd1fe37c Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:27:02 -0400
Subject: [PATCH 39/51] formatting correct now

---
 .github/workflows/check-devnet.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index d7967df92..0d3c07322 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -37,5 +37,5 @@ jobs:
           local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
           echo "local spec_version: $local_spec_version"
           echo "network spec_version: $spec_version"
-          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version <= $spec_version ❌"; exit 1; fi
-          echo "spec_version will correctly bump from $local_spec_version to $spec_version ✅"
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version > $spec_version ❌"; exit 1; fi
+          echo "$local_spec_version > $spec_version ✅"

From 2ce13334df2255c180ad2a69a7a544e03a6594ac Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 04:32:57 -0400
Subject: [PATCH 40/51] use not-greater-than symbol

---
 .github/workflows/check-devnet.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 0d3c07322..87b41ce2f 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -37,5 +37,5 @@ jobs:
           local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
           echo "local spec_version: $local_spec_version"
           echo "network spec_version: $spec_version"
-          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version > $spec_version ❌"; exit 1; fi
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi
           echo "$local_spec_version > $spec_version ✅"

From bff1f63664cf43e5b95aedab65011cf830edf43a Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 05:13:19 -0400
Subject: [PATCH 41/51] fix labels

---
 .github/workflows/check-devnet.yml  | 4 ++--
 .github/workflows/check-rust.yml    | 8 +-------
 .github/workflows/devnet-check.yml  | 1 -
 .github/workflows/testnet-check.yml | 1 -
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 87b41ce2f..4c800f324 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -2,9 +2,9 @@ name: Devnet CI
 
 on:
   push:
-    branches: [devnet, main]
+    branches: [devnet]
   pull_request:
-    branches: [devnet, main]
+    branches: [devnet]
 
 env:
   CARGO_TERM_COLOR: always
diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml
index cd017e522..ef3334727 100644
--- a/.github/workflows/check-rust.yml
+++ b/.github/workflows/check-rust.yml
@@ -5,16 +5,10 @@ concurrency:
   cancel-in-progress: true
 
 on:
-  ## Run automatically for all PRs against main, regardless of what the changes are
-  ## to be safe and so we can more easily force re-run the CI when github is being
-  ## weird by using a blank commit
   push:
-    branches: [main, development, staging]
+    branches: [main, devnet, testnet, finney]
 
-  ##
-  # Run automatically for PRs against default/main branch if Rust files change
   pull_request:
-    branches: [main, development, staging]
 
   ## Allow running workflow manually from the Actions tab
   workflow_dispatch:
diff --git a/.github/workflows/devnet-check.yml b/.github/workflows/devnet-check.yml
index a54e6444d..12bec1a8a 100644
--- a/.github/workflows/devnet-check.yml
+++ b/.github/workflows/devnet-check.yml
@@ -16,4 +16,3 @@ jobs:
           labels: |
             devnet-pass
             devnet-skip
-            hotfix
diff --git a/.github/workflows/testnet-check.yml b/.github/workflows/testnet-check.yml
index 5e72e8641..9c3d4b073 100644
--- a/.github/workflows/testnet-check.yml
+++ b/.github/workflows/testnet-check.yml
@@ -16,4 +16,3 @@ jobs:
           labels: |
             testnet-pass
             testnet-skip
-            hotfix

From 753064aa6e75a27d64bf1612614ebc19f0910821 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 05:16:13 -0400
Subject: [PATCH 42/51] add check-testnet

---
 .github/workflows/check-devnet.yml  |  2 --
 .github/workflows/check-testnet.yml | 39 +++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/check-testnet.yml

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 4c800f324..58434079a 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -1,8 +1,6 @@
 name: Devnet CI
 
 on:
-  push:
-    branches: [devnet]
   pull_request:
     branches: [devnet]
 
diff --git a/.github/workflows/check-testnet.yml b/.github/workflows/check-testnet.yml
new file mode 100644
index 000000000..45086a634
--- /dev/null
+++ b/.github/workflows/check-testnet.yml
@@ -0,0 +1,39 @@
+name: Testnet CI
+
+on:
+  pull_request:
+    branches: [testnet]
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  check-spec-version:
+    name: Check spec_version bump
+    runs-on: SubtensorCI
+    steps:
+      - name: Dependencies
+        run: |
+          sudo apt-get update &&
+          sudo apt-get install -y curl clang curl libssl-dev llvm \
+                                  libudev-dev protobuf-compiler
+
+      - name: Set up Rust Toolchain
+        run: curl https://sh.rustup.rs -sSf | sh -s -- -y
+
+      - name: Install substrate-spec-version
+        run: cargo install substrate-spec-version
+
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v4
+
+      - name: Check that spec_version has been bumped
+        run: |
+          spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.finney.opentensor.ai:443 | tr -d '\n')
+          echo "network spec_version: $spec_version"
+          : ${spec_version:?bad spec version}
+          local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
+          echo "local spec_version: $local_spec_version"
+          echo "network spec_version: $spec_version"
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi
+          echo "$local_spec_version > $spec_version ✅"

From 7bcfe4992e557ab12158947fb3b12431d8de7cbb Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 05:22:50 -0400
Subject: [PATCH 43/51] add finney check

---
 .github/workflows/check-devnet.yml  |  2 +-
 .github/workflows/check-finney.yml  | 39 +++++++++++++++++++++++++++++
 .github/workflows/check-testnet.yml |  2 +-
 3 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/check-finney.yml

diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml
index 58434079a..d8f2be391 100644
--- a/.github/workflows/check-devnet.yml
+++ b/.github/workflows/check-devnet.yml
@@ -1,4 +1,4 @@
-name: Devnet CI
+name: Devnet Deploy Check
 
 on:
   pull_request:
diff --git a/.github/workflows/check-finney.yml b/.github/workflows/check-finney.yml
new file mode 100644
index 000000000..c74980bcd
--- /dev/null
+++ b/.github/workflows/check-finney.yml
@@ -0,0 +1,39 @@
+name: Finney Deploy Check
+
+on:
+  pull_request:
+    branches: [finney]
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  check-spec-version:
+    name: Check spec_version bump
+    runs-on: SubtensorCI
+    steps:
+      - name: Dependencies
+        run: |
+          sudo apt-get update &&
+          sudo apt-get install -y curl clang curl libssl-dev llvm \
+                                  libudev-dev protobuf-compiler
+
+      - name: Set up Rust Toolchain
+        run: curl https://sh.rustup.rs -sSf | sh -s -- -y
+
+      - name: Install substrate-spec-version
+        run: cargo install substrate-spec-version
+
+      - name: Check-out repository under $GITHUB_WORKSPACE
+        uses: actions/checkout@v4
+
+      - name: Check that spec_version has been bumped
+        run: |
+          spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://entrypoint-finney.opentensor.ai:443 | tr -d '\n')
+          echo "network spec_version: $spec_version"
+          : ${spec_version:?bad spec version}
+          local_spec_version=$(cargo run -p node-subtensor-runtime --bin spec_version | tr -d '\n')
+          echo "local spec_version: $local_spec_version"
+          echo "network spec_version: $spec_version"
+          if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi
+          echo "$local_spec_version > $spec_version ✅"
diff --git a/.github/workflows/check-testnet.yml b/.github/workflows/check-testnet.yml
index 45086a634..5fe046b06 100644
--- a/.github/workflows/check-testnet.yml
+++ b/.github/workflows/check-testnet.yml
@@ -1,4 +1,4 @@
-name: Testnet CI
+name: Testnet Deploy Check
 
 on:
   pull_request:

From cc60878130054b43c5e20c58fa6fd91e532198ed Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 05:27:49 -0400
Subject: [PATCH 44/51] tweaks

---
 .github/workflows/{devnet-check.yml => devnet-labels.yml}   | 2 +-
 .github/workflows/{testnet-check.yml => testnet-labels.yml} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename .github/workflows/{devnet-check.yml => devnet-labels.yml} (94%)
 rename .github/workflows/{testnet-check.yml => testnet-labels.yml} (94%)

diff --git a/.github/workflows/devnet-check.yml b/.github/workflows/devnet-labels.yml
similarity index 94%
rename from .github/workflows/devnet-check.yml
rename to .github/workflows/devnet-labels.yml
index 12bec1a8a..0fe409d1d 100644
--- a/.github/workflows/devnet-check.yml
+++ b/.github/workflows/devnet-labels.yml
@@ -1,4 +1,4 @@
-name: Tested on devnet
+name: Tested on Devnet
 on:
   pull_request:
     types: [opened, labeled, unlabeled, synchronize]
diff --git a/.github/workflows/testnet-check.yml b/.github/workflows/testnet-labels.yml
similarity index 94%
rename from .github/workflows/testnet-check.yml
rename to .github/workflows/testnet-labels.yml
index 9c3d4b073..f471f9991 100644
--- a/.github/workflows/testnet-check.yml
+++ b/.github/workflows/testnet-labels.yml
@@ -1,4 +1,4 @@
-name: Tested on testnet
+name: Tested on Testnet
 on:
   pull_request:
     types: [opened, labeled, unlabeled, synchronize]

From 0faea6d06518980b13256750127f146d0c7b8e68 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 10:59:13 -0400
Subject: [PATCH 45/51] WIP

---
 CONTRIBUTING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 CONTRIBUTING.md

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..3580618da
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,57 @@
+# Subtensor Contributor Guide
+
+## Lifecycle of a Pull Request
+
+1. Individuals wishing to contribute to subtensor should develop their change/feature/fix in a
+   [Pull Request](https://github.com/opentensor/subtensor/compare) (PR) targeting the `main`
+   branch of the subtensor GitHub repository. It is recommended to start your pull request as a
+   draft initially until you are ready to have other developers actively look at it.
+2. Once you have finished developing your change/feature/fix and the Rust portion of the CI is
+   passing for your PR (everything prefixed with "CI"), you should mark your PR as "Ready for
+   Review" and request review from "Nucleus".
+3. Core Nucleus team members will review your PR, possibly requesting changes, and will also
+   add appropriate labels to your PR as shown below.
+4. Once the required passing reviews have been obtained, you are ready to request that your PR
+   be included in the next `devnet` deploy. To do this, you should open a companion PR merging
+   your branch into the `devnet-ready` branch. You must include a link to the parent PR in the
+   description and preface your PR title with "(Devnet Ready)" or the PR will be
+   closed/ignored.
+5. A core team administrator will review your "(Devnet Ready)" PR, verifying that it logically
+   matches the changes introduced in the parent PR (there will sometimes be minor differences
+   due to merge conflicts) and will either request changes or approve the PR and merge it. Once
+   your companion PR is merged, the administrator will add the `devnet-ready` label to the
+   parent PR, indicating that the PR is on the `devnet-ready` branch and will be included in
+   the next deploy to `devnet`.
+6. At some point, a core team administrator will open a PR merging the current `devnet-ready`
+   branch into `devnet`, and the CI will enforce some additional safety checks on this PR
+   including a requirement that the new `spec_version` be greater than the current on-chain
+   `spec_version`. The administrator will then need to update all PRs with the `devnet-ready`
+   label to instead have the `on-devnet` label (TODO: automate this upon merge). The
+   administrator will then run deploy `devnet`.
+7. Once the `on-devnet` label appears on your PR, if you are a core team member it is your
+   responsibility to verify that the features/changes/fixes introduced by your PR are
+   functioning properly on `devnet` by interacting with the live network. If you are an
+   external contributor, a core team member will be assigned to test this for you.
+8. If your feature/change/fix is confirmed working on `devnet`, the `devnet-pass` label should
+   be added. Otherwise if there are issues, the `devnet-fail` label should be added and you
+   will need to make changes to your PR and repeat the previous steps in this process. In some
+   cases a revert PR will need to be created reverting your changes from the `pre-devnet` and
+   `devnet` branches, respectively
+
+## PR Labels
+
+| Name  | Description |
+| ----- | ----------- |
+| `breaking-change` | PR requires synchronized changes with bittensor. Triggers an automatic bot message so the relevant teams are made aware once it is added |
+| `migration` | PR contains one or more migrations |
+| `devnet-ready` | PR's branch has been merged into the `devnet-ready` branch and will be included in the next `devnet` deploy |
+| `on-devnet` | PR has been deployed to `devnet`. Removes `devnet-ready` |
+| `devnet-pass` | PR has passed manual testing on `devnet` |
+| `devnet-skip` | Allows a critical hotfix PR to skip required testing on `devnet` |
+| `devnet-fail` | PR has failed manual testing on `devnet` and requires modification |
+| `testnet-ready` | PR's branch has been merged into the `testnet-ready` branch and will be included in the next `testnet` deploy. Requires `devnet-pass` or `devnet-skip` to be already present |
+| `on-testnet` | PR has been deployed to `testnet`. Removes `testnet-ready` |
+| `testnet-pass` | PR has passed manual testing on `testnet` |
+| `testnet-skip` | Allows a critical hotfix PR to skip required manual testing and SOP on `testnet` |
+| `testnet-fail` | PR has failed manual testing on `testnet` and requires modification |
+

From 749ce243a59e6838c59a2a9948335b69189e8ba3 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 13:30:27 -0400
Subject: [PATCH 46/51] labels and pull request lifecycle

---
 CONTRIBUTING.md | 76 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 58 insertions(+), 18 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3580618da..7933ac637 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -5,7 +5,8 @@
 1. Individuals wishing to contribute to subtensor should develop their change/feature/fix in a
    [Pull Request](https://github.com/opentensor/subtensor/compare) (PR) targeting the `main`
    branch of the subtensor GitHub repository. It is recommended to start your pull request as a
-   draft initially until you are ready to have other developers actively look at it.
+   draft initially until you are ready to have other developers actively look at it. Any
+   changes to pallet/runtime code should be accomp
 2. Once you have finished developing your change/feature/fix and the Rust portion of the CI is
    passing for your PR (everything prefixed with "CI"), you should mark your PR as "Ready for
    Review" and request review from "Nucleus".
@@ -25,9 +26,11 @@
 6. At some point, a core team administrator will open a PR merging the current `devnet-ready`
    branch into `devnet`, and the CI will enforce some additional safety checks on this PR
    including a requirement that the new `spec_version` be greater than the current on-chain
-   `spec_version`. The administrator will then need to update all PRs with the `devnet-ready`
-   label to instead have the `on-devnet` label (TODO: automate this upon merge). The
-   administrator will then run deploy `devnet`.
+   `spec_version`. The PR should included a bulleted list of all PRs included in the deploy so
+   they can be easily found after the fact (TODO: automate this). This PR will require two
+   reviews from the core team as a sanity check. After merging, the administrator will then
+   need to update all PRs with the `devnet-ready` label to instead have the `on-devnet` label
+   (TODO: automate this upon merge). The administrator will then run deploy `devnet`.
 7. Once the `on-devnet` label appears on your PR, if you are a core team member it is your
    responsibility to verify that the features/changes/fixes introduced by your PR are
    functioning properly on `devnet` by interacting with the live network. If you are an
@@ -37,21 +40,58 @@
    will need to make changes to your PR and repeat the previous steps in this process. In some
    cases a revert PR will need to be created reverting your changes from the `pre-devnet` and
    `devnet` branches, respectively
+9. Once `devnet-pass` has been added to your PR, it is eligible for inclusion in the next
+   `testnet` deploy. We typically run `testnet` deploys every other wednesday.
+10. On the appropriate date, an administrator will open a PR merging the current `devnet`
+    branch into `testnet`. This PR should include a bulleted list of all PRs included in the
+    deploy so they can be easily found after the fact (TODO: automate this). The PR should
+    exclude any PRs that currently have the `devnet-fail` label via a revert (TODO: enforce via
+    CI). This PR will require two reviews from the core team as a sanity check. After merging
+    into `testnet`, the administrator will then need to run the deploy and update all PRs
+    included in the deploy with the `on-testnet` label (TODO: automate this upon merge). Next
+    the administrator must cut a (pre-release) release in GitHub for `testnet` (TODO: github
+    action to generate the release and release notes).
+11. Once the `on-testnet` label appears on your PR, if you are a core team member it is your
+    responsibility to once again verify that the features/changes/fixes introduced by your PR
+    are functioning properly on `testnet` by interacting with the live network, if applicable.
+    If you are an external contributor, a core team member may be assigned to do this testing
+    for you but otherwise it will be your responsibility to show evidence on the PR that the
+    testing is successful. Once this has been verified, the `testnet-pass` label should be
+    added. If testing fails, the `testnet-fail` label should be added and PRs should be opened
+    reverting the change from `devnet-ready`, and then a PR should be opened merging the
+    modified `devnet` into `testnet`. These revert PRs _must_ be merged before a new deploy can
+    be run (TODO: enforce this via CI).
+12. After the SOP period (72 hours on testnet) has passed and the `testnet-pass` label has been
+    added, the CI checks on your PR should now turn all green and a core team member will be
+    able to merge your PR into `main`. At this point your PR is done and is eligible to be
+    included in the next `finney` deploy (TODO: track and enforce SOP compliance on a per-PR
+    basis in CI based on the timestamps of label changes). We typically run `finney` deploys
+    every other Wednesday, so this will typically happen the Wednesday following the Wednesday
+    your PR was deployed to `testnet`. An administrator will run this deploy. The process the
+    administrator follows is to open a PR merging `main` into the `finney` branch, which will
+    always track the current state of `finney`. This PR automatically has some additional
+    checks on it such as asserting that the spec_version gets bumped properly and other sanity
+    checks designed to stop a bad deploy. Once the PR is reviewed and merged, the administrator
+    will run the actual deploy. Once that is successful, the administrator will cut a new
+    GitHub release tagged off of the latest `main` branch commit that was included in the
+    deploy, and announcements will be made regarding the release.
 
 ## PR Labels
 
-| Name  | Description |
-| ----- | ----------- |
-| `breaking-change` | PR requires synchronized changes with bittensor. Triggers an automatic bot message so the relevant teams are made aware once it is added |
-| `migration` | PR contains one or more migrations |
-| `devnet-ready` | PR's branch has been merged into the `devnet-ready` branch and will be included in the next `devnet` deploy |
-| `on-devnet` | PR has been deployed to `devnet`. Removes `devnet-ready` |
-| `devnet-pass` | PR has passed manual testing on `devnet` |
-| `devnet-skip` | Allows a critical hotfix PR to skip required testing on `devnet` |
-| `devnet-fail` | PR has failed manual testing on `devnet` and requires modification |
-| `testnet-ready` | PR's branch has been merged into the `testnet-ready` branch and will be included in the next `testnet` deploy. Requires `devnet-pass` or `devnet-skip` to be already present |
-| `on-testnet` | PR has been deployed to `testnet`. Removes `testnet-ready` |
-| `testnet-pass` | PR has passed manual testing on `testnet` |
-| `testnet-skip` | Allows a critical hotfix PR to skip required manual testing and SOP on `testnet` |
-| `testnet-fail` | PR has failed manual testing on `testnet` and requires modification |
+| Name  | Description | Automations |
+| ----- | ----------- | ----------- |
+| `red-team` | PR is focused on feature additions/changes | none |
+| `blue-team` | PR is focused on preventative/safety measures and/or dev UX improvements | none |
+| `runtime` | PR contains substantive changes to runtime / pallet code | none |
+| `breaking-change` | PR requires synchronized changes with bittensor | Triggers an automatic bot message so the relevant teams are made aware of the change well in advance |
+| `migration` | PR contains one or more migrations | none |
+| `devnet-ready` | PR's branch has been merged into the `devnet-ready` branch and will be included in the next `devnet` deploy | none |
+| `on-devnet` | PR has been deployed to `devnet` | Removes `devnet-ready` |
+| `devnet-pass` | PR has passed manual testing on `devnet` | `devnet-pass` or `devnet-skip` required |
+| `devnet-skip` | Allows a critical hotfix PR to skip required testing on `devnet` | `devnet-pass` or `devnet-skip` required |
+| `devnet-fail` | PR has failed manual testing on `devnet` and requires modification | none |
+| `on-testnet` | PR has been deployed to `testnet` | none |
+| `testnet-pass` | PR has passed manual testing on `testnet` | `testnet-pass` or `testnet-skip` required |
+| `testnet-skip` | Allows a critical hotfix PR to skip required manual testing and SOP on `testnet` | `testnet-pass` or `testnet-skip` required |
+| `testnet-fail` | PR has failed manual testing on `testnet` and requires modification | none |
 

From 05c297ecea0dab7d4f6609858ba5528b90cb4137 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 13:31:05 -0400
Subject: [PATCH 47/51] tweak

---
 CONTRIBUTING.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7933ac637..670964789 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,8 @@
    [Pull Request](https://github.com/opentensor/subtensor/compare) (PR) targeting the `main`
    branch of the subtensor GitHub repository. It is recommended to start your pull request as a
    draft initially until you are ready to have other developers actively look at it. Any
-   changes to pallet/runtime code should be accomp
+   changes to pallet/runtime code should be accompanied by integration and/or unit tests fully
+   testing all the edge cases of this functionality, if applicable.
 2. Once you have finished developing your change/feature/fix and the Rust portion of the CI is
    passing for your PR (everything prefixed with "CI"), you should mark your PR as "Ready for
    Review" and request review from "Nucleus".
@@ -94,4 +95,3 @@
 | `testnet-pass` | PR has passed manual testing on `testnet` | `testnet-pass` or `testnet-skip` required |
 | `testnet-skip` | Allows a critical hotfix PR to skip required manual testing and SOP on `testnet` | `testnet-pass` or `testnet-skip` required |
 | `testnet-fail` | PR has failed manual testing on `testnet` and requires modification | none |
-

From 3c0c885c81727148fc08ffada6d0c6c4462f38a3 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 14:11:11 -0400
Subject: [PATCH 48/51] done

---
 CONTRIBUTING.md | 110 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 109 insertions(+), 1 deletion(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 670964789..222bd737b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -12,7 +12,7 @@
    passing for your PR (everything prefixed with "CI"), you should mark your PR as "Ready for
    Review" and request review from "Nucleus".
 3. Core Nucleus team members will review your PR, possibly requesting changes, and will also
-   add appropriate labels to your PR as shown below.
+   add appropriate labels to your PR as shown below. Three positive reviews are required.
 4. Once the required passing reviews have been obtained, you are ready to request that your PR
    be included in the next `devnet` deploy. To do this, you should open a companion PR merging
    your branch into the `devnet-ready` branch. You must include a link to the parent PR in the
@@ -95,3 +95,111 @@
 | `testnet-pass` | PR has passed manual testing on `testnet` | `testnet-pass` or `testnet-skip` required |
 | `testnet-skip` | Allows a critical hotfix PR to skip required manual testing and SOP on `testnet` | `testnet-pass` or `testnet-skip` required |
 | `testnet-fail` | PR has failed manual testing on `testnet` and requires modification | none |
+
+
+## Branches
+
+
+### `devnet-ready`
+
+Companion PRs merge into this branch, eventually accumulating into a merge of `devnet-ready`
+into `devnet`, coinciding with a deploy of `devnet`.
+
+#### Restrictions
+* no deleting the branch
+* no force pushes
+* no direct pushes
+* require 1 positive review from an administrator
+* new code changes invalidate existing reviews
+* only merge commit style merging allowed
+
+#### CI-Enforced Restrictions
+* `check-rust.yml` must pass
+* TODO: parent PR must be linked to in description
+* TODO: parent PR must have the required number of positive reviews
+
+
+### `devnet`
+
+Tracks the current state of what is deployed to `devnet`. Modified by an administrator via a PR
+merging `devnet-ready` into `devnet`, in concert with a deploy of `devnet`.
+
+#### Restrictions
+* no deleting the branch
+* no force pushes
+* no direct pushes
+* require 2 positive reviews from core team members
+* new code changes invalidate existing reviews
+* only merge commit style merging allowed
+
+#### CI-Enforced Restrictions
+* `check-rust.yml` must pass
+* `check-devnet.yml` must pass
+* spec_version must be greater than what is currently on live `devnet`
+* TODO: other pre-deploy sanity checks here
+
+
+### `testnet`
+
+Tracks the current state of what is deployed to `testnet`. Administrator will open a PR merging
+current `devnet` into `testnet` and merge it in concert with a deploy to `testnet`. Contains
+tags for `testnet` releases.
+
+#### Restrictions
+* no deleting the branch
+* no force pushes
+* no direct pushes
+* require 2 positive reviews from core team members
+* new code changes invalidate existing reviews
+* only merge commit style merging allowed
+
+#### CI-Enforced Restrictions
+* `check-rust.yml` must pass
+* `check-testnet.yml` must pass
+* spec_version must be greater than what is currently on live `testnet`
+* TODO: other pre-deploy sanity checks here
+
+
+### `main`
+
+Default branch for all new PRs. Slightly ahead of what is currently on `finney`. When a PR is all
+green and "done", meaning it has been tested on `devnet` and `testnet`, it can be merged into
+`main`. Contains tags for `finney` releases.
+
+#### Restrictions
+* no deleting the branch
+* no force pushes
+* no direct pushes
+* require 3 positive reviews from core team members
+* new code changes invalidate existing reviews
+* all conversations must be resolved
+* only merge commit style merging allowed
+
+#### CI-Enforced Restrictions
+* `check-rust.yml` must pass
+* `check-labels.yml` must pass
+* must have `devnet-skip` or `devnet-pass` label
+* must have `testnet-skip` or `testnet-pass` label
+* if `breaking-change` label is present, bot will message the appropriate teams
+* TODO: when we get auditing, presence of `needs-audit` label = require a review from auditor
+* TODO: track SOP on PR based on label age
+
+
+### `finney`
+
+Tracks the current state of what is deployed to `finney` (mainnet). Updated via an
+administrator-submitted PR merging `main` into `finney` in concert with a `finney` deploy.
+
+#### Restrictions
+* no deleting the branch
+* no force pushes
+* no direct pushes
+* require 3 positive reviews from core team members
+* new code changes invalidate existing reviews
+* only merge commit style merging allowed
+
+#### CI-Enforced Restrictions
+* `check-rust.yml` must pass
+* `check-finney.yml` must pass
+* spec_version must be greater than what is currently on live `finney`
+* TODO: other pre-deploy sanity checks here

From a9bbc8829f4bdad809633f222d5386abb181dbcb Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 14:22:42 -0400
Subject: [PATCH 49/51] tweak branches

---
 .github/workflows/check-rust.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml
index ef3334727..8490f97ba 100644
--- a/.github/workflows/check-rust.yml
+++ b/.github/workflows/check-rust.yml
@@ -6,7 +6,7 @@ concurrency:
 
 on:
   push:
-    branches: [main, devnet, testnet, finney]
+    branches: [main, devnet-ready, devnet, testnet, finney]
 
   pull_request:
 

From e294b20f7810b0dec9e898ca0b6f0913f44b70a6 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Thu, 23 May 2024 14:43:29 -0400
Subject: [PATCH 50/51] fix typos

---
 CONTRIBUTING.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 222bd737b..d732e51c7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -27,11 +27,11 @@
 6. At some point, a core team administrator will open a PR merging the current `devnet-ready`
    branch into `devnet`, and the CI will enforce some additional safety checks on this PR
    including a requirement that the new `spec_version` be greater than the current on-chain
-   `spec_version`. The PR should included a bulleted list of all PRs included in the deploy so
+   `spec_version`. The PR should include a bulleted list of all PRs included in the deploy so
    they can be easily found after the fact (TODO: automate this). This PR will require two
    reviews from the core team as a sanity check. After merging, the administrator will then
    need to update all PRs with the `devnet-ready` label to instead have the `on-devnet` label
-   (TODO: automate this upon merge). The administrator will then run deploy `devnet`.
+   (TODO: automate this upon merge). The administrator will then deploy `devnet`.
 7. Once the `on-devnet` label appears on your PR, if you are a core team member it is your
    responsibility to verify that the features/changes/fixes introduced by your PR are
    functioning properly on `devnet` by interacting with the live network. If you are an
@@ -40,7 +40,7 @@
    be added. Otherwise if there are issues, the `devnet-fail` label should be added and you
    will need to make changes to your PR and repeat the previous steps in this process. In some
    cases a revert PR will need to be created reverting your changes from the `pre-devnet` and
-   `devnet` branches, respectively
+   `devnet` branches, respectively.
 9. Once `devnet-pass` has been added to your PR, it is eligible for inclusion in the next
    `testnet` deploy. We typically run `testnet` deploys every other wednesday.
 10. On the appropriate date, an administrator will open a PR merging the current `devnet`
@@ -60,8 +60,8 @@
     testing is successful. Once this has been verified, the `testnet-pass` label should be
     added. If testing fails, the `testnet-fail` label should be added and PRs should be opened
     reverting the change from `devnet-ready`, and then a PR should be opened merging the
-    modified `devnet` into `testnet`. These revert PRs _must_ be merged before a new deploy can
-    be run (TODO: enforce this via CI).
+    modified `devnet` into `testnet`. These revert PRs, if they occur, _must_ be merged before
+    a new deploy can be run (TODO: enforce this via CI).
 12. After the SOP period (72 hours on testnet) has passed and the `testnet-pass` label has been
     added, the CI checks on your PR should now turn all green and a core team member will be
     able to merge your PR into `main`. At this point your PR is done and is eligible to be

From 5e061dd854412f3c0dbed3e54d9392f4bfa01047 Mon Sep 17 00:00:00 2001
From: Sam Johnson <sam@durosoft.com>
Date: Tue, 28 May 2024 10:53:06 -0400
Subject: [PATCH 51/51] update SOP period for testnet

---
 CONTRIBUTING.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d732e51c7..d3616041b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -62,7 +62,7 @@
     reverting the change from `devnet-ready`, and then a PR should be opened merging the
     modified `devnet` into `testnet`. These revert PRs, if they occur, _must_ be merged before
     a new deploy can be run (TODO: enforce this via CI).
-12. After the SOP period (72 hours on testnet) has passed and the `testnet-pass` label has been
+12. After the SOP period (1 week on `testnet`) has passed and the `testnet-pass` label has been
     added, the CI checks on your PR should now turn all green and a core team member will be
     able to merge your PR into `main`. At this point your PR is done and is eligible to be
     included in the next `finney` deploy (TODO: track and enforce SOP compliance on a per-PR