Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
jobs:
cargo-audit:
name: cargo audit
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-cargo-audit') }}
steps:
- name: Check-out repositoroy under $GITHUB_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-bittensor-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
strategy:
matrix:
platform:
- runner: [self-hosted, type-ccx33]
- runner: [self-hosted, fireactions-heavy]
triple: x86_64-unknown-linux-gnu
arch: amd64
runtime: ["fast-runtime", "non-fast-runtime"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

jobs:
build:
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker Image
run: docker build .

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
2 changes: 1 addition & 1 deletion .github/workflows/check-finney.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime-finney]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-node-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
build:
name: build ${{ matrix.version.name }}
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
if: contains(github.event.pull_request.labels.*.name, 'check-node-compat')
env:
RUST_BACKTRACE: full
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:

test:
needs: [build]
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
steps:
- name: Download old node binary
uses: actions/download-artifact@v4
Expand All @@ -85,4 +85,4 @@ jobs:

- name: Run test
working-directory: ${{ github.workspace }}/.github/workflows/check-node-compat
run: npm run test
run: npm run test
14 changes: 7 additions & 7 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# runs cargo fmt
cargo-fmt:
name: cargo fmt
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUST_BACKTRACE: full
steps:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:

cargo-clippy-default-features:
name: cargo clippy
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUST_BACKTRACE: full
SKIP_WASM_BUILD: 1
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:

cargo-check-lints:
name: check custom lints
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:

cargo-clippy-all-features:
name: cargo clippy --all-features
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUST_BACKTRACE: full
SKIP_WASM_BUILD: 1
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
# runs cargo test --workspace --all-features
cargo-test:
name: cargo test
runs-on: [self-hosted, type-ccx43]
runs-on: [self-hosted, fireactions-heavy]
env:
RUST_BACKTRACE: full
SKIP_WASM_BUILD: 1
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
# ensures cargo fix has no trivial changes that can be applied
cargo-fix:
name: cargo fix
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUST_BACKTRACE: full
SKIP_WASM_BUILD: 1
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:

check-feature-propagation:
name: zepter run check
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
check-spec-version:
name: Check spec_version bump
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }}
steps:
- name: Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:

jobs:
run:
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
env:
RUST_BACKTRACE: full
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-localnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
matrix:
platform:
# triple names used `in scripts/install_prebuilt_binaries.sh` file
- runner: [self-hosted, type-ccx33]
- runner: [self-hosted, fireactions-heavy]
triple: x86_64-unknown-linux-gnu
arch: amd64
- runner: [ubuntu-24.04-arm]
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
# Collect all artifacts and publish them to docker repo
docker:
needs: [setup, artifacts]
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
defaults:
run:
working-directory: ${{ github.workspace }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ permissions:

jobs:
publish:
runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]

steps:
- name: Determine Docker tag and ref
Expand Down Expand Up @@ -71,4 +71,4 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ env.tag }}
${{ env.latest_tag == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
${{ env.latest_tag == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
2 changes: 1 addition & 1 deletion .github/workflows/eco-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
jobs:
eco-tests:
name: cargo test (eco-tests)
runs-on: [self-hosted, type-ccx43]
runs-on: [self-hosted, fireactions-heavy]
env:
RUST_BACKTRACE: full
SKIP_WASM_BUILD: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hotfixes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
handle-hotfix-pr:
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
steps:
- name: Check if PR is a hotfix into `main`
if: >
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/label-triggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:

jobs:
comment_on_breaking_change:
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
steps:
- name: Check if 'breaking change' label is added
if: github.event.label.name == 'breaking-change'
Expand All @@ -25,4 +25,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: '@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!'
})
})
2 changes: 1 addition & 1 deletion .github/workflows/require-clean-merges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,77 +9,77 @@

jobs:
assert-clean-merges:
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensures we get all branches for merging

- name: Determine Target Branch and Set Merge List
id: set-merge-branches
run: |
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_ENV

if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
echo "MERGE_BRANCHES=testnet main" >> $GITHUB_ENV
elif [[ "$TARGET_BRANCH" == "testnet" ]]; then
echo "MERGE_BRANCHES=main" >> $GITHUB_ENV
elif [[ "$TARGET_BRANCH" == "main" ]]; then
echo "MERGE_BRANCHES=" >> $GITHUB_ENV # No need to merge anything into main
else
echo "MERGE_BRANCHES=devnet-ready devnet testnet main" >> $GITHUB_ENV
fi

- name: Add Fork Remote and Fetch PR Branch
if: github.event.pull_request.head.repo.fork == true
run: |
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
PR_FORK="${{ github.event.pull_request.head.repo.clone_url }}"
git remote add fork $PR_FORK
git fetch --no-tags --prune fork $PR_BRANCH

- name: Check Merge Cleanliness
run: |
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
echo "Fetching all branches..."
git fetch --all --prune

if [[ "${{github.event.pull_request.head.repo.fork}}" == "true" ]]; then
PR_BRANCH_REF="fork/$PR_BRANCH"
echo "Using fork reference: $PR_BRANCH_REF"
else
PR_BRANCH_REF="origin/$PR_BRANCH"
echo "Using origin reference: $PR_BRANCH_REF"
fi

echo "Checking out PR branch: $PR_BRANCH"
git checkout $PR_BRANCH_REF
git reset --hard $PR_BRANCH_REF

# Configure a temporary Git identity to allow merging
git config --local user.email "github-actions@github.com"
git config --local user.name "GitHub Actions"

for branch in $MERGE_BRANCHES; do
echo "Checking merge from $branch into $PR_BRANCH_REF..."

# Ensure PR branch is up to date
git reset --hard $PR_BRANCH_REF

# Merge without committing to check for conflicts
if git merge --no-commit --no-ff origin/$branch; then
echo "✅ Merge from $branch into $PR_BRANCH_REF is clean."
else
echo "❌ Merge conflict detected when merging $branch into $PR_BRANCH_REF"
exit 1
fi

# Abort merge if one was started, suppressing errors if no merge happened
git merge --abort 2>/dev/null || true
done

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
4 changes: 2 additions & 2 deletions .github/workflows/rustdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@

jobs:
build:
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update
sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" build-essential clang curl libssl-dev llvm libudev-dev protobuf-compiler pkg-config

- name: Install rustup
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Generate documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items

- name: Fix file permissions
shell: sh
run: |
chmod -c -R +rX "target/doc" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Generate index.html file
run: |
echo "<meta http-equiv=refresh content=0;url=wasm_oidc_plugin/index.html>" > target/doc/index.html
- name: Upload documentation
uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc

deploy:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
needs: build
runs-on: [self-hosted, type-ccx13]
runs-on: [self-hosted, fireactions-light]

permissions:
pages: write
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/scheduled-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ permissions:

jobs:
run-smoke-tests:
runs-on: [self-hosted, type-ccx33]
runs-on: ${{ matrix.runner }}
timeout-minutes: 30

strategy:
fail-fast: false
matrix:
include:
- test: smoke_mainnet
runner: [self-hosted, fireactions-tryruntime-finney]
- test: smoke_testnet
runner: [self-hosted, fireactions-tryruntime]

name: "smoke-e2e-${{ matrix.test }}"

Expand All @@ -44,4 +46,4 @@ jobs:

- name: Run smoke test
working-directory: ts-tests
run: pnpm moonwall test ${{ matrix.test }}
run: pnpm moonwall test ${{ matrix.test }}
6 changes: 3 additions & 3 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
check-devnet:
name: check devnet
if: github.base_ref != 'main'
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
check-testnet:
name: check testnet
if: github.base_ref != 'main'
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
check-finney:
name: check finney
# if: github.base_ref == 'testnet' || github.base_ref == 'devnet' || github.base_ref == 'main'
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-tryruntime-finney]
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/typescript-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

# Build the node binary in both variants and share as artifacts.
build:
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
needs: [typescript-formatting]
timeout-minutes: 60
strategy:
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:

run-e2e-tests:
needs: [build]
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
timeout-minutes: 30

strategy:
Expand Down Expand Up @@ -140,4 +140,4 @@ jobs:
- name: Run tests
run: |
cd ts-tests
pnpm moonwall test ${{ matrix.test }}
pnpm moonwall test ${{ matrix.test }}
2 changes: 1 addition & 1 deletion .github/workflows/update-chainspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
update-chainspecs:
runs-on: [self-hosted, type-ccx33]
runs-on: [self-hosted, fireactions-heavy]
permissions:
contents: write
if: >
Expand Down
5 changes: 1 addition & 4 deletions pallets/subtensor/src/staking/order_swap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use super::*;
use frame_support::traits::fungible::Mutate;
use frame_support::traits::tokens::Preservation;
use frame_support::transactional;
use substrate_fixed::types::U64F64;
use subtensor_runtime_common::{AlphaBalance, NetUid, TaoBalance};
Expand Down Expand Up @@ -103,8 +101,7 @@ impl<T: Config> OrderSwapInterface<T::AccountId> for Pallet<T> {
}

fn transfer_tao(from: &T::AccountId, to: &T::AccountId, amount: TaoBalance) -> DispatchResult {
<T as Config>::Currency::transfer(from, to, amount, Preservation::Expendable)?;
Ok(())
Pallet::<T>::transfer_tao(from, to, amount)
}

#[transactional]
Expand Down
23 changes: 4 additions & 19 deletions pallets/subtensor/src/subnets/leasing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::*;
use frame_support::{
dispatch::RawOrigin,
traits::{Defensive, fungible::*, tokens::Preservation},
traits::{Defensive, fungible::*},
};
use frame_system::pallet_prelude::OriginFor;
use frame_system::pallet_prelude::*;
Expand Down Expand Up @@ -92,12 +92,7 @@ impl<T: Config> Pallet<T> {
frame_system::Pallet::<T>::inc_providers(&lease_coldkey);
frame_system::Pallet::<T>::inc_providers(&lease_hotkey);

<T as Config>::Currency::transfer(
&crowdloan.funds_account,
&lease_coldkey,
crowdloan.raised,
Preservation::Expendable,
)?;
Self::transfer_tao(&crowdloan.funds_account, &lease_coldkey, crowdloan.raised)?;

Self::do_register_network(
RawOrigin::Signed(lease_coldkey.clone()).into(),
Expand Down Expand Up @@ -151,23 +146,13 @@ impl<T: Config> Pallet<T> {
.saturating_mul(U64F64::from(u64::from(leftover_cap)))
.floor()
.saturating_to_num::<u64>();
<T as Config>::Currency::transfer(
&lease_coldkey,
&contributor,
contributor_refund.into(),
Preservation::Expendable,
)?;
Self::transfer_tao(&lease_coldkey, &contributor, contributor_refund.into())?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Update leasing weight for per-contributor issuance accounting

This refund loop now calls Self::transfer_tao, which does more storage work than the previous direct Currency::transfer: it checks the source balance, reads Balances total issuance before and after, and can mutate Subtensor TotalIssuance when dust is burned. Because this runs once per contributor, register_leased_network(k) gained O(k) additional reads and possible writes, but SubnetLeasingWeightInfo::do_register_leased_network and the generated benchmark weight were not updated. Re-benchmark/update the weight or manually add the extra DB reads/writes so the extrinsic is not underweighted at high MaxContributors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad review. Direct Currency::transfer does not update subtensor pallet TotalIssuance if it burns dust.

refunded_cap = refunded_cap.saturating_add(contributor_refund);
}

// Refund what's left after refunding the contributors to the beneficiary
let beneficiary_refund = leftover_cap.saturating_sub(refunded_cap.into());
<T as Config>::Currency::transfer(
&lease_coldkey,
&who,
beneficiary_refund,
Preservation::Expendable,
)?;
Self::transfer_tao(&lease_coldkey, &who, beneficiary_refund)?;

Self::deposit_event(Event::SubnetLeaseCreated {
beneficiary: who,
Expand Down
Loading
Loading