From 917f89c3a434ba439ff728625e826b1cff90c62b Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 8 Aug 2024 09:11:13 -0700 Subject: [PATCH 1/6] Adds e2e multiple versions script to master --- .../e2e-multiple-bittensor-tests.yml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/e2e-multiple-bittensor-tests.yml diff --git a/.github/workflows/e2e-multiple-bittensor-tests.yml b/.github/workflows/e2e-multiple-bittensor-tests.yml new file mode 100644 index 0000000000..470ccef4f8 --- /dev/null +++ b/.github/workflows/e2e-multiple-bittensor-tests.yml @@ -0,0 +1,115 @@ +name: E2E tests w/ multiple bittensor versions + +on: + workflow_dispatch: + inputs: + bittensor_versions: + description: 'Bittensor versions to test (comma-separated)' + required: true + default: '7.3.1,7.2.1' + bittensor_branch: + description: 'Branch of bittensor' + required: true + default: 'staging' + subtensor_branch: + description: 'Branch of subtensor' + required: true + default: 'testnet' + +env: + RUSTV: nightly-2024-03-05 + RUST_BACKTRACE: full + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Set up test matrix + id: set-matrix + run: | + versions=$(echo "${{ github.event.inputs.bittensor_versions }}" | jq -R -s -c 'split(",")| map(select(. != ""))') + echo "matrix=${versions}" >> $GITHUB_OUTPUT + + test: + needs: setup + runs-on: SubtensorCI + strategy: + fail-fast: false + matrix: + bittensor-version: ${{fromJson(needs.setup.outputs.matrix)}} + rust-target: + - x86_64-unknown-linux-gnu + env: + RUST_BIN_DIR: target/${{ matrix.rust-target }} + TARGET: ${{ matrix.rust-target }} + steps: + - name: Check-out repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.bittensor_branch }} + + - name: Print working directory + run: | + pwd + ls -la + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Install Rust dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler + + - name: Install Rust ${{ env.RUSTV }} + uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: ${{ env.RUSTV }} + components: rustfmt + profile: minimal + + - name: Add wasm32-unknown-unknown target + run: | + rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu + rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu + + - name: Clone subtensor repo + run: git clone https://github.com/opentensor/subtensor.git + + - name: Setup subtensor repo + working-directory: ${{ github.workspace }}/subtensor + run: git checkout ${{ github.event.inputs.subtensor_branch }} + + - name: Create tox.ini + run: | + cd ../.. + cat << EOF > tox.ini + [tox] + envlist = bt-${{ matrix.bittensor-version }} + + [testenv] + deps = + pytest + pytest-asyncio + anyio + nest_asyncio + bittensor==${{ matrix.bittensor-version }} + commands = + pytest ${{ github.workspace }}/tests/e2e_tests -v -s {posargs} + passenv = + LOCALNET_SH_PATH + + [pytest] + asyncio_mode = auto + EOF + + - name: Run tox + env: + LOCALNET_SH_PATH: ${{ github.workspace }}/subtensor/scripts/localnet.sh + run: | + cd ../.. + tox -c tox.ini -e bt-${{ matrix.bittensor-version }} From df3f23fd98edbc6425dce7b520671938fbf33032 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Mon, 22 Jul 2024 10:32:07 -0400 Subject: [PATCH 2/6] Merge pull request #2156 from opentensor/feat/ledger-integration [Ledger Integration] [Feature] bump pysub to 1.7.9+ --- bittensor/subtensor.py | 13 ------------- requirements/prod.txt | 4 ++-- scripts/environments/apple_m1_environment.yml | 4 ++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py index d1ebac9df4..c50ec7a4ca 100644 --- a/bittensor/subtensor.py +++ b/bittensor/subtensor.py @@ -23,7 +23,6 @@ import argparse import copy -import functools import socket import time from typing import List, Dict, Union, Optional, Tuple, TypedDict, Any @@ -109,18 +108,6 @@ KEY_NONCE: Dict[str, int] = {} -####### -# Monkey patch in caching the convert_type_string method -####### -if hasattr(RuntimeConfiguration, "convert_type_string"): - original_convert_type_string = RuntimeConfiguration.convert_type_string - - @functools.lru_cache(maxsize=None) - def convert_type_string(_, name): - return original_convert_type_string(name) - - RuntimeConfiguration.convert_type_string = convert_type_string -####### class ParamWithTypes(TypedDict): diff --git a/requirements/prod.txt b/requirements/prod.txt index 2d9ecabab5..e02456f998 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -25,9 +25,9 @@ python-statemachine~=2.1.2 retry requests rich -scalecodec==1.2.7 # scalecodec should not be changed unless first verifying compatibility with the subtensor's monkeypatching of scalecodec.RuntimeConfiguration.get_decoder_class +scalecodec==1.2.11 shtab~=1.6.5 -substrate-interface~=1.7.5 +substrate-interface~=1.7.9 termcolor tqdm uvicorn<=0.30 diff --git a/scripts/environments/apple_m1_environment.yml b/scripts/environments/apple_m1_environment.yml index a3712e267c..25824aa64e 100644 --- a/scripts/environments/apple_m1_environment.yml +++ b/scripts/environments/apple_m1_environment.yml @@ -228,7 +228,7 @@ dependencies: - retry==0.9.2 - rich==12.5.1 - rsa==4.9 - - scalecodec==1.2.7 # scalecodec should not be changed unless first verifying compatibility with the subtensor's monkeypatching of scalecodec.RuntimeConfiguration.get_decoder_class + - scalecodec==1.2.11 - scikit-learn==1.2.2 - scipy==1.10.1 - sentencepiece==0.1.99 @@ -242,7 +242,7 @@ dependencies: - sqlalchemy==2.0.19 - starlette==0.37.2 - streamlit==1.22.0 - - substrate-interface==1.5.2 + - substrate-interface==1.7.9 - tenacity==8.2.2 - termcolor==2.1.1 - threadpoolctl==3.1.0 From 959a42b0a7a865661ac4b6b7e864ba5ee70a46c0 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 25 Jul 2024 13:17:22 -0700 Subject: [PATCH 3/6] Bumps version to 7.3.1 --- VERSION | 2 +- bittensor/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 8b23b8d47c..34a8f745d4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.3.0 \ No newline at end of file +7.3.1 \ No newline at end of file diff --git a/bittensor/__init__.py b/bittensor/__init__.py index c872fdf973..e2dc10ae8a 100644 --- a/bittensor/__init__.py +++ b/bittensor/__init__.py @@ -40,7 +40,7 @@ # Bittensor code and protocol version. -__version__ = "7.3.0" +__version__ = "7.3.1" _version_split = __version__.split(".") __version_info__ = tuple(int(part) for part in _version_split) From 014e24314a4230cd4c96289c6f850e081d4ed95c Mon Sep 17 00:00:00 2001 From: Gus Date: Mon, 19 Aug 2024 13:26:08 -0400 Subject: [PATCH 4/6] chore: update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a0ba068b..07603362d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 7.3.1 / 2024-08-19 + +## What's Changed +* https://github.com/opentensor/bittensor/pull/2156 by @camfairchild + +**Full Changelog**: https://github.com/opentensor/bittensor/compare/v7.3.0...v7.3.1 + ## 7.3.0 / 2024-07-12 ## What's Changed From d6a225afd47161bf946bec62147ce58c110bc986 Mon Sep 17 00:00:00 2001 From: Gus Date: Mon, 19 Aug 2024 13:43:58 -0400 Subject: [PATCH 5/6] ruff --- bittensor/subtensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py index c50ec7a4ca..75484fd69f 100644 --- a/bittensor/subtensor.py +++ b/bittensor/subtensor.py @@ -109,7 +109,6 @@ KEY_NONCE: Dict[str, int] = {} - class ParamWithTypes(TypedDict): name: str # Name of the parameter. type: str # ScaleType string of the parameter. From 94c432cf6c235a4ba9c22bff39a58bd970f1aa03 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Mon, 19 Aug 2024 11:04:40 -0700 Subject: [PATCH 6/6] Updates timeout type --- bittensor/dendrite.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bittensor/dendrite.py b/bittensor/dendrite.py index dca513e0b2..3341d15ddf 100644 --- a/bittensor/dendrite.py +++ b/bittensor/dendrite.py @@ -23,6 +23,7 @@ import uuid import time import aiohttp +from aiohttp import ClientTimeout import bittensor from typing import Optional, List, Union, AsyncGenerator, Any @@ -521,7 +522,7 @@ async def call( url, headers=synapse.to_headers(), json=synapse.model_dump(), - timeout=timeout, + timeout=ClientTimeout(total=timeout), ) as response: # Extract the JSON response from the server json_response = await response.json() @@ -603,7 +604,7 @@ async def call_stream( url, headers=synapse.to_headers(), json=synapse.model_dump(), - timeout=timeout, + timeout=ClientTimeout(total=timeout), ) as response: # Use synapse subclass' process_streaming_response method to yield the response chunks async for chunk in synapse.process_streaming_response(response): # type: ignore