bittensor-sentinel 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bittensor_sentinel-0.0.6/.cruft.json +20 -0
- bittensor_sentinel-0.0.6/.github/dependabot.yml +12 -0
- bittensor_sentinel-0.0.6/.github/workflows/ci.yml +60 -0
- bittensor_sentinel-0.0.6/.github/workflows/publish.yml +122 -0
- bittensor_sentinel-0.0.6/.gitignore +18 -0
- bittensor_sentinel-0.0.6/.shellcheckrc +2 -0
- bittensor_sentinel-0.0.6/CHANGELOG.md +39 -0
- bittensor_sentinel-0.0.6/PKG-INFO +118 -0
- bittensor_sentinel-0.0.6/README.md +96 -0
- bittensor_sentinel-0.0.6/SECURITY.md +52 -0
- bittensor_sentinel-0.0.6/docs/3rd_party/cookiecutter-rt-pkg/CHANGELOG.md +15 -0
- bittensor_sentinel-0.0.6/docs/3rd_party/cookiecutter-rt-pkg/extractors/extrinsics.md +103 -0
- bittensor_sentinel-0.0.6/noxfile.py +213 -0
- bittensor_sentinel-0.0.6/pyproject.toml +158 -0
- bittensor_sentinel-0.0.6/src/sentinel/__init__.py +0 -0
- bittensor_sentinel-0.0.6/src/sentinel/_internal/__init__.py +5 -0
- bittensor_sentinel-0.0.6/src/sentinel/_version.py +34 -0
- bittensor_sentinel-0.0.6/src/sentinel/py.typed +0 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/__init__.py +3 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/dto.py +120 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/models/__init__.py +1 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/models/block.py +76 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/models/subnet.py +42 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/providers/__init__.py +12 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/providers/base.py +33 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/providers/bittensor.py +192 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/providers/substrate.py +160 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/__init__.py +1 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/__init__.py +1 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/events/__init__.py +5 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/events/extractor.py +24 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/extrinsics/__init__.py +15 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/extrinsics/extractor.py +39 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/extrinsics/filters.py +160 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/extractors/hyperparam.py +45 -0
- bittensor_sentinel-0.0.6/src/sentinel/v1/services/sentinel.py +44 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/__init__.py +1 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/__main__.py +6 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/blocks.py +56 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/commands/__init__.py +1 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/commands/block.py +54 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/commands/events.py +106 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/commands/extrinsics.py +169 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/commands/hyperparams.py +80 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/main.py +51 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/output.py +113 -0
- bittensor_sentinel-0.0.6/src/sentinel_cli/settings.py +15 -0
- bittensor_sentinel-0.0.6/tests/__init__.py +0 -0
- bittensor_sentinel-0.0.6/tests/conftest.py +1 -0
- bittensor_sentinel-0.0.6/tests/unit/__init__.py +3 -0
- bittensor_sentinel-0.0.6/tests/unit/api/__init__.py +5 -0
- bittensor_sentinel-0.0.6/tests/unit/api/test_setup.py +2 -0
- bittensor_sentinel-0.0.6/tests/unit/internal/__init__.py +5 -0
- bittensor_sentinel-0.0.6/tests/unit/internal/test_setup.py +19 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/__init__.py +0 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/conftest.py +33 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/factories.py +72 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/providers.py +69 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/services/__init__.py +0 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/services/test_events_extractor.py +38 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/services/test_extrinsics_filters.py +81 -0
- bittensor_sentinel-0.0.6/tests/unit/v1/test_block_ingestion.py +16 -0
- bittensor_sentinel-0.0.6/uv.lock +1719 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "https://github.com/reef-technologies/cookiecutter-rt-pkg",
|
|
3
|
+
"commit": "985688f5137b0211b92f860bdd055cb6e563585c",
|
|
4
|
+
"checkout": null,
|
|
5
|
+
"context": {
|
|
6
|
+
"cookiecutter": {
|
|
7
|
+
"package_name": "sentinel",
|
|
8
|
+
"repository_github_url": "https://github.com/bittensor-church/sentinel",
|
|
9
|
+
"is_django_package": "n",
|
|
10
|
+
"build_docker_image": "n",
|
|
11
|
+
"_jinja2_env_vars": {
|
|
12
|
+
"block_start_string": "# COOKIECUTTER{%",
|
|
13
|
+
"block_end_string": "%}"
|
|
14
|
+
},
|
|
15
|
+
"_template": "https://github.com/reef-technologies/cookiecutter-rt-pkg",
|
|
16
|
+
"_commit": "985688f5137b0211b92f860bdd055cb6e563585c"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"directory": null
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/" # specify the directory to scan for dependency files, e.g., "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "daily"
|
|
7
|
+
open-pull-requests-limit: 0 # Only security updates will be opened as PRs
|
|
8
|
+
- package-ecosystem: "docker"
|
|
9
|
+
directory: "/" # specify the directory to scan for dependency files, e.g., "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
12
|
+
open-pull-requests-limit: 0 # Only security updates will be opened as PRs
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
PYTHON_DEFAULT_VERSION: "3.12"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
linter:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
|
|
23
|
+
cache: "pip"
|
|
24
|
+
cache-dependency-path: 'uv.lock'
|
|
25
|
+
- uses: actions/cache@v4
|
|
26
|
+
with:
|
|
27
|
+
path: ~/.cache/uv
|
|
28
|
+
key: ${{ env.PYTHON_DEFAULT_VERSION }}-uv-${{ hashFiles('uv.lock') }}
|
|
29
|
+
restore-keys: ${{ env.PYTHON_DEFAULT_VERSION }}-uv-
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: python -m pip install --upgrade nox uv
|
|
32
|
+
- name: Run linters
|
|
33
|
+
run: nox -vs lint
|
|
34
|
+
test:
|
|
35
|
+
timeout-minutes: 10
|
|
36
|
+
runs-on: ${{ matrix.os }}
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
os: ["ubuntu-latest"]
|
|
41
|
+
python-version: ["3.11", "3.12"]
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
with:
|
|
45
|
+
fetch-depth: 0
|
|
46
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
47
|
+
uses: actions/setup-python@v5
|
|
48
|
+
with:
|
|
49
|
+
python-version: ${{ matrix.python-version }}
|
|
50
|
+
cache: 'pip'
|
|
51
|
+
cache-dependency-path: 'uv.lock'
|
|
52
|
+
- uses: actions/cache@v4
|
|
53
|
+
with:
|
|
54
|
+
path: ~/.cache/uv
|
|
55
|
+
key: ${{ matrix.python-version }}-uv-${{ hashFiles('uv.lock') }}
|
|
56
|
+
restore-keys: ${{ matrix.python-version }}-uv-
|
|
57
|
+
- name: Install dependencies
|
|
58
|
+
run: python -m pip install --upgrade 'nox==2024.3.2' uv
|
|
59
|
+
- name: Run unit tests
|
|
60
|
+
run: nox -vs test
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
name: "Continuous Deployment"
|
|
2
|
+
|
|
3
|
+
# This workflow requires https://docs.pypi.org/trusted-publishers/ to be enabled for the repository.
|
|
4
|
+
# Follow instructions from this link to enable it.
|
|
5
|
+
# Use this workflow (`publish.yml`) in the configuration.
|
|
6
|
+
# Please note this process has to be repeated for Test PyPI and PyPI separately.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags:
|
|
11
|
+
- 'v*' # push events to matching v*, i.e. v1.0, v20.15.10
|
|
12
|
+
- 'draft/v*'
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
PYTHON_DEFAULT_VERSION: "3.12"
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
# Job to get version from tag
|
|
19
|
+
get-version:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
outputs:
|
|
22
|
+
version: ${{ steps.get-version.outputs.version }}
|
|
23
|
+
draft: ${{ steps.get-version.outputs.draft }}
|
|
24
|
+
prerelease: ${{ steps.get-version.outputs.prerelease }}
|
|
25
|
+
is_latest_version: ${{ steps.highest-version.outputs.is_latest_version }}
|
|
26
|
+
steps:
|
|
27
|
+
- name: Get version from tag
|
|
28
|
+
id: get-version
|
|
29
|
+
run: |
|
|
30
|
+
if [[ ${{ github.ref }} == refs/tags/v* ]]; then
|
|
31
|
+
echo "draft=false" >> "$GITHUB_OUTPUT"
|
|
32
|
+
echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
|
|
33
|
+
else
|
|
34
|
+
echo "draft=true" >> "$GITHUB_OUTPUT"
|
|
35
|
+
echo "version=${GITHUB_REF#refs/tags/draft/v}" >> "$GITHUB_OUTPUT"
|
|
36
|
+
fi
|
|
37
|
+
export IS_PRERELEASE=$([[ ${{ github.ref }} =~ [^0-9]$ ]] && echo true || echo false)
|
|
38
|
+
echo "prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
|
|
39
|
+
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
fetch-depth: 0
|
|
43
|
+
|
|
44
|
+
- name: Get the highest version in the repository
|
|
45
|
+
id: highest-version
|
|
46
|
+
run: |
|
|
47
|
+
git fetch --tags
|
|
48
|
+
highest_version=$(git tag --sort=-v:refname | grep -E '^v[0-9]+' | head -n 1)
|
|
49
|
+
echo "highest_version=${highest_version#v}" >> "$GITHUB_OUTPUT"
|
|
50
|
+
if [[ ${{ steps.get-version.outputs.version }} == "${highest_version#v}" ]] && [ "${{ steps.get-version.outputs.draft }}" == "false" ]; then
|
|
51
|
+
echo "is_latest_version=true" >> "$GITHUB_OUTPUT"
|
|
52
|
+
else
|
|
53
|
+
echo "is_latest_version=false" >> "$GITHUB_OUTPUT"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Job for Python package publishing
|
|
57
|
+
publish-python:
|
|
58
|
+
needs: get-version
|
|
59
|
+
env:
|
|
60
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
61
|
+
permissions:
|
|
62
|
+
id-token: write # allows publishing to PyPI
|
|
63
|
+
contents: write # allows uploading a GitHub release
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
with:
|
|
68
|
+
fetch-depth: 0
|
|
69
|
+
|
|
70
|
+
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
|
|
71
|
+
uses: actions/setup-python@v5
|
|
72
|
+
with:
|
|
73
|
+
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
|
|
74
|
+
|
|
75
|
+
- name: Install dependencies
|
|
76
|
+
run: python -m pip install --upgrade nox uv
|
|
77
|
+
|
|
78
|
+
- name: Read the Changelog
|
|
79
|
+
id: read-changelog
|
|
80
|
+
uses: mindsers/changelog-reader-action@v2
|
|
81
|
+
with:
|
|
82
|
+
version: ${{ needs.get-version.outputs.version }}
|
|
83
|
+
path: ./CHANGELOG.md
|
|
84
|
+
continue-on-error: ${{ fromJSON(needs.get-version.outputs.draft) }}
|
|
85
|
+
|
|
86
|
+
- name: Build
|
|
87
|
+
run: uv build
|
|
88
|
+
|
|
89
|
+
- name: Sign distribution
|
|
90
|
+
uses: sigstore/gh-action-sigstore-python@v3.1.0
|
|
91
|
+
with:
|
|
92
|
+
inputs: >-
|
|
93
|
+
dist/*.tar.gz
|
|
94
|
+
dist/*.whl
|
|
95
|
+
|
|
96
|
+
- name: Create GitHub release
|
|
97
|
+
id: create-release
|
|
98
|
+
uses: softprops/action-gh-release@v2
|
|
99
|
+
with:
|
|
100
|
+
name: ${{ needs.get-version.outputs.version }}
|
|
101
|
+
body: ${{ steps.read-changelog.outputs.changes }}
|
|
102
|
+
draft: ${{ fromJSON(needs.get-version.outputs.draft) }}
|
|
103
|
+
prerelease: ${{ fromJSON(needs.get-version.outputs.prerelease) }}
|
|
104
|
+
files: >-
|
|
105
|
+
dist/*.tar.gz
|
|
106
|
+
dist/*.whl
|
|
107
|
+
dist/*.sigstore
|
|
108
|
+
|
|
109
|
+
- name: Remove signature files as pypa/gh-action-pypi-publish does not support them
|
|
110
|
+
run: rm -f dist/*.sigstore dist/*.sigstore.json
|
|
111
|
+
|
|
112
|
+
- name: Publish distribution 📦 to TestPyPI
|
|
113
|
+
if: ${{ needs.get-version.outputs.draft == 'true' }}
|
|
114
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
115
|
+
with:
|
|
116
|
+
repository-url: https://test.pypi.org/legacy/
|
|
117
|
+
|
|
118
|
+
- name: Publish distribution 📦 to PyPI
|
|
119
|
+
if: ${{ needs.get-version.outputs.draft == 'false' }}
|
|
120
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
121
|
+
|
|
122
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the changes for the
|
|
8
|
+
upcoming release can be found in [changelog.d](changelog.d).
|
|
9
|
+
|
|
10
|
+
<!-- towncrier release notes start -->
|
|
11
|
+
|
|
12
|
+
## [0.0.6](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.6) - 2025-12-04
|
|
13
|
+
|
|
14
|
+
No significant changes.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.0.5](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.5) - 2025-12-01
|
|
18
|
+
|
|
19
|
+
No significant changes.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.0.4](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.4) - 2025-11-28
|
|
23
|
+
|
|
24
|
+
No significant changes.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [0.0.3](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.3) - 2025-11-28
|
|
28
|
+
|
|
29
|
+
No significant changes.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [0.0.2](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.2) - 2025-11-28
|
|
33
|
+
|
|
34
|
+
No significant changes.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.0.1](https://github.com/bittensor-church/sentinel/releases/tag/v0.0.1) - 2025-11-27
|
|
38
|
+
|
|
39
|
+
No significant changes.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bittensor-sentinel
|
|
3
|
+
Version: 0.0.6
|
|
4
|
+
Project-URL: Source, https://github.com/bittensor-church/sentinel
|
|
5
|
+
Project-URL: Issue Tracker, https://github.com/bittensor-church/sentinel/issues
|
|
6
|
+
Author-email: Reef Technologies <opensource@reef.pl>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: asgiref>=3.11.0
|
|
16
|
+
Requires-Dist: pydantic>=2.12.5
|
|
17
|
+
Requires-Dist: structlog>=25.5.0
|
|
18
|
+
Requires-Dist: substrate-interface>=1.7.0
|
|
19
|
+
Requires-Dist: turbobt>=0.3.0
|
|
20
|
+
Requires-Dist: typer>=0.12.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# sentinel
|
|
24
|
+
[](https://github.com/bittensor-church/sentinel/actions?query=workflow%3A%22Continuous+Integration%22) [](https://pypi.python.org/pypi/bittensor-sentinel) [](https://pypi.python.org/pypi/bittensor-sentinel) [](https://pypi.python.org/pypi/bittensor-sentinel)
|
|
25
|
+
|
|
26
|
+
Sentinel is a blockchain data extraction and monitoring tool designed to work with the Bittensor network.
|
|
27
|
+
|
|
28
|
+
Features:
|
|
29
|
+
- Extract extrinsics, events, and hyperparameters from Bittensor blockchain.
|
|
30
|
+
- Provides both a Python library and a command-line interface (CLI) for ease of use.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install bittensor-sentinel
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
> [!IMPORTANT]
|
|
41
|
+
> This package uses [ApiVer](#versioning), make sure to import `sentinel.v1`.
|
|
42
|
+
|
|
43
|
+
### As a library
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from sentinel.v1.providers.bittensor import bittensor_provider
|
|
47
|
+
from sentinel.v1.services.extractors.extrinsics import get_hyperparam_extrinsics
|
|
48
|
+
from sentinel.v1.services.sentinel import sentinel_service
|
|
49
|
+
|
|
50
|
+
provider = bittensor_provider()
|
|
51
|
+
service = sentinel_service(provider)
|
|
52
|
+
block = service.ingest_block(resolved_block)
|
|
53
|
+
for extrinsic in block.extrinsics:
|
|
54
|
+
print(extrinsic)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### CLI
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
$ sentinel --help
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Usage: sentinel [OPTIONS] COMMAND [ARGS]...
|
|
64
|
+
|
|
65
|
+
Sentinel CLI - Blockchain data extraction and monitoring tool.
|
|
66
|
+
|
|
67
|
+
╭─ Options ────────────────────────────────────────────────────────────────────╮
|
|
68
|
+
│ --format -f [table|json] Output format. [default: table] │
|
|
69
|
+
│ --install-completion Install completion for the │
|
|
70
|
+
│ current shell. │
|
|
71
|
+
│ --show-completion Show completion for the current │
|
|
72
|
+
│ shell, to copy it or customize │
|
|
73
|
+
│ the installation. │
|
|
74
|
+
│ --help Show this message and exit. │
|
|
75
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
76
|
+
╭─ Commands ───────────────────────────────────────────────────────────────────╮
|
|
77
|
+
│ extrinsics Read extrinsics from a blockchain block. │
|
|
78
|
+
│ events Read events from a blockchain block. │
|
|
79
|
+
│ hyperparams Read hyperparameters for a subnet at a specific block. │
|
|
80
|
+
│ block Block-related commands. │
|
|
81
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Versioning
|
|
86
|
+
|
|
87
|
+
This package uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
88
|
+
TL;DR you are safe to use [compatible release version specifier](https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release) `~=MAJOR.MINOR` in your `pyproject.toml` or `requirements.txt`.
|
|
89
|
+
|
|
90
|
+
Additionally, this package uses [ApiVer](https://www.youtube.com/watch?v=FgcoAKchPjk) to further reduce the risk of breaking changes.
|
|
91
|
+
This means, the public API of this package is explicitly versioned, e.g. `sentinel.v1`, and will not change in a backwards-incompatible way even when `sentinel.v2` is released.
|
|
92
|
+
|
|
93
|
+
Internal packages, i.e. prefixed by `sentinel._` do not share these guarantees and may change in a backwards-incompatible way at any time even in patch releases.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
Pre-requisites:
|
|
100
|
+
- [uv](https://docs.astral.sh/uv/)
|
|
101
|
+
- [nox](https://nox.thea.codes/en/stable/)
|
|
102
|
+
- [docker](https://www.docker.com/) and [docker compose plugin](https://docs.docker.com/compose/)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
Ideally, you should run `nox -t format lint` before every commit to ensure that the code is properly formatted and linted.
|
|
106
|
+
Before submitting a PR, make sure that tests pass as well, you can do so using:
|
|
107
|
+
```
|
|
108
|
+
nox -t check # equivalent to `nox -t format lint test`
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If you wish to install dependencies into `.venv` so your IDE can pick them up, you can do so using:
|
|
112
|
+
```
|
|
113
|
+
uv sync --all-extras --dev
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Release process
|
|
117
|
+
|
|
118
|
+
Run `nox -s make_release -- X.Y.Z` where `X.Y.Z` is the version you're releasing and follow the printed instructions.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# sentinel
|
|
2
|
+
[](https://github.com/bittensor-church/sentinel/actions?query=workflow%3A%22Continuous+Integration%22) [](https://pypi.python.org/pypi/bittensor-sentinel) [](https://pypi.python.org/pypi/bittensor-sentinel) [](https://pypi.python.org/pypi/bittensor-sentinel)
|
|
3
|
+
|
|
4
|
+
Sentinel is a blockchain data extraction and monitoring tool designed to work with the Bittensor network.
|
|
5
|
+
|
|
6
|
+
Features:
|
|
7
|
+
- Extract extrinsics, events, and hyperparameters from Bittensor blockchain.
|
|
8
|
+
- Provides both a Python library and a command-line interface (CLI) for ease of use.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install bittensor-sentinel
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
> [!IMPORTANT]
|
|
19
|
+
> This package uses [ApiVer](#versioning), make sure to import `sentinel.v1`.
|
|
20
|
+
|
|
21
|
+
### As a library
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from sentinel.v1.providers.bittensor import bittensor_provider
|
|
25
|
+
from sentinel.v1.services.extractors.extrinsics import get_hyperparam_extrinsics
|
|
26
|
+
from sentinel.v1.services.sentinel import sentinel_service
|
|
27
|
+
|
|
28
|
+
provider = bittensor_provider()
|
|
29
|
+
service = sentinel_service(provider)
|
|
30
|
+
block = service.ingest_block(resolved_block)
|
|
31
|
+
for extrinsic in block.extrinsics:
|
|
32
|
+
print(extrinsic)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### CLI
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
$ sentinel --help
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Usage: sentinel [OPTIONS] COMMAND [ARGS]...
|
|
42
|
+
|
|
43
|
+
Sentinel CLI - Blockchain data extraction and monitoring tool.
|
|
44
|
+
|
|
45
|
+
╭─ Options ────────────────────────────────────────────────────────────────────╮
|
|
46
|
+
│ --format -f [table|json] Output format. [default: table] │
|
|
47
|
+
│ --install-completion Install completion for the │
|
|
48
|
+
│ current shell. │
|
|
49
|
+
│ --show-completion Show completion for the current │
|
|
50
|
+
│ shell, to copy it or customize │
|
|
51
|
+
│ the installation. │
|
|
52
|
+
│ --help Show this message and exit. │
|
|
53
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
54
|
+
╭─ Commands ───────────────────────────────────────────────────────────────────╮
|
|
55
|
+
│ extrinsics Read extrinsics from a blockchain block. │
|
|
56
|
+
│ events Read events from a blockchain block. │
|
|
57
|
+
│ hyperparams Read hyperparameters for a subnet at a specific block. │
|
|
58
|
+
│ block Block-related commands. │
|
|
59
|
+
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Versioning
|
|
64
|
+
|
|
65
|
+
This package uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
66
|
+
TL;DR you are safe to use [compatible release version specifier](https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release) `~=MAJOR.MINOR` in your `pyproject.toml` or `requirements.txt`.
|
|
67
|
+
|
|
68
|
+
Additionally, this package uses [ApiVer](https://www.youtube.com/watch?v=FgcoAKchPjk) to further reduce the risk of breaking changes.
|
|
69
|
+
This means, the public API of this package is explicitly versioned, e.g. `sentinel.v1`, and will not change in a backwards-incompatible way even when `sentinel.v2` is released.
|
|
70
|
+
|
|
71
|
+
Internal packages, i.e. prefixed by `sentinel._` do not share these guarantees and may change in a backwards-incompatible way at any time even in patch releases.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
Pre-requisites:
|
|
78
|
+
- [uv](https://docs.astral.sh/uv/)
|
|
79
|
+
- [nox](https://nox.thea.codes/en/stable/)
|
|
80
|
+
- [docker](https://www.docker.com/) and [docker compose plugin](https://docs.docker.com/compose/)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Ideally, you should run `nox -t format lint` before every commit to ensure that the code is properly formatted and linted.
|
|
84
|
+
Before submitting a PR, make sure that tests pass as well, you can do so using:
|
|
85
|
+
```
|
|
86
|
+
nox -t check # equivalent to `nox -t format lint test`
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If you wish to install dependencies into `.venv` so your IDE can pick them up, you can do so using:
|
|
90
|
+
```
|
|
91
|
+
uv sync --all-extras --dev
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Release process
|
|
95
|
+
|
|
96
|
+
Run `nox -s make_release -- X.Y.Z` where `X.Y.Z` is the version you're releasing and follow the printed instructions.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
We value the contributions of the community and welcome any input on potential security issues.
|
|
6
|
+
To ensure the safety of our users, we encourage following responsible disclosure practices described in this document.
|
|
7
|
+
|
|
8
|
+
## Supported Versions
|
|
9
|
+
|
|
10
|
+
Only the latest release version is supported.
|
|
11
|
+
We use SemVer and encourage to pin only to the major version of our software and update to the latest minor and patch versions regularly.
|
|
12
|
+
|
|
13
|
+
## Reporting a Vulnerability
|
|
14
|
+
|
|
15
|
+
If you discover a security vulnerability in our repository, we encourage you to report it to us as quickly as possible.
|
|
16
|
+
Please do not publicly disclose the details of the vulnerability until we have had a chance to address it.
|
|
17
|
+
|
|
18
|
+
### How to Report
|
|
19
|
+
|
|
20
|
+
1. **Submit vulnerability report**:
|
|
21
|
+
|
|
22
|
+
Please use [Report a vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability) functionality of this GitHub repository.
|
|
23
|
+
|
|
24
|
+
Please use the following template:
|
|
25
|
+
|
|
26
|
+
> ## Description of the vulnerability
|
|
27
|
+
>
|
|
28
|
+
> ## Steps to reproduce
|
|
29
|
+
>
|
|
30
|
+
> ## Potential impact
|
|
31
|
+
>
|
|
32
|
+
> ## Any potential fixes or mitigations
|
|
33
|
+
>
|
|
34
|
+
> ## How would you like to be attributed in the public changelog
|
|
35
|
+
>
|
|
36
|
+
> e.g., name, email, or GitHub handle
|
|
37
|
+
|
|
38
|
+
2. **Response Time**:
|
|
39
|
+
We will acknowledge your report within 10 days and provide a timeline for fixing the vulnerability.
|
|
40
|
+
|
|
41
|
+
3. **Updates**:
|
|
42
|
+
We will keep you updated as we work on a fix.
|
|
43
|
+
You may be asked to provide additional information or clarification.
|
|
44
|
+
|
|
45
|
+
4. **Disclosure**:
|
|
46
|
+
We follow a coordinated disclosure process.
|
|
47
|
+
Once a fix is implemented, we will release it and publicly disclose the details of the vulnerability along with credits to the reporter.
|
|
48
|
+
|
|
49
|
+
## Security Updates
|
|
50
|
+
|
|
51
|
+
Security updates will be communicated through our repository's release notes.
|
|
52
|
+
Please ensure you stay up-to-date with the latest releases to protect your environment.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# cookiecutter-rt-pkg Changelog
|
|
2
|
+
|
|
3
|
+
Main purpose of this file is to provide a changelog for the template itself.
|
|
4
|
+
It is not intended to be used as a changelog for the generated project.
|
|
5
|
+
|
|
6
|
+
This changelog will document any know **BREAKING** changes between versions of the template.
|
|
7
|
+
Please review this new entries carefully after applying `cruft update` before committing the changes.
|
|
8
|
+
|
|
9
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
10
|
+
|
|
11
|
+
Currently, `cookiecutter-rt-pkg` has no explicit versioning amd we purely rely on `cruft` diff.
|
|
12
|
+
|
|
13
|
+
## [Unreleased]
|
|
14
|
+
|
|
15
|
+
* **BREAKING** Introduced cookiecutter-rt-pkg template
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
### Extrinsic Call Flow
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
1. Compose inner call → AdminUtils module + function + params
|
|
5
|
+
2. Wrap in Sudo → Sudo.sudo(inner_call)
|
|
6
|
+
3. Sign with coldkey → wallet.coldkey
|
|
7
|
+
4. Submit extrinsic → substrate.submit_extrinsic()
|
|
8
|
+
5. Wait for finalization
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Subnet Hyperparameters Table
|
|
12
|
+
|
|
13
|
+
### Consensus & Weights Parameters
|
|
14
|
+
|
|
15
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
16
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
17
|
+
| `rho` | `int` | `sudo_set_rho` | `{"netuid": int, "rho": int}` | Rate of decay |
|
|
18
|
+
| `kappa` | `int` | `sudo_set_kappa` | `{"netuid": int, "kappa": int}` | Constant multiplier in calculations |
|
|
19
|
+
| `tempo` | `int` | `sudo_set_tempo` | `{"netuid": int, "tempo": int}` | Blocks per epoch |
|
|
20
|
+
| `weights_version` | `int` | `sudo_set_weights_version_key` | `{"netuid": int, "weights_version_key": int}` | Version number of weights |
|
|
21
|
+
| `weights_rate_limit` | `int` | `sudo_set_weights_set_rate_limit` | `{"netuid": int, "weights_set_rate_limit": int}` | Rate limit for weight updates |
|
|
22
|
+
| `max_weight_limit` | `float` | `sudo_set_max_weight_limit` | `{"netuid": int, "max_weight_limit": int}` | Maximum weight limit |
|
|
23
|
+
| `min_allowed_weights` | `int` | `sudo_set_min_allowed_weights` | `{"netuid": int, "min_allowed_weights": int}` | Minimum allowed weights |
|
|
24
|
+
| `bonds_moving_avg` | `int` | `sudo_set_bonds_moving_average` | `{"netuid": int, "bonds_moving_average": int}` | Moving average of bonds |
|
|
25
|
+
| `bonds_reset_enabled` | `bool` | `sudo_set_bonds_reset_enabled` | `{"netuid": int, "enabled": bool}` | Flag for bonds reset |
|
|
26
|
+
|
|
27
|
+
### Commit-Reveal Weights
|
|
28
|
+
|
|
29
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
30
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
31
|
+
| `commit_reveal_weights_enabled` | `bool` | `sudo_set_commit_reveal_weights_enabled` | `{"netuid": int, "enabled": bool}` | Enable/disable commit-reveal |
|
|
32
|
+
| `commit_reveal_period` | `int` | `sudo_set_commit_reveal_period` | `{"netuid": int, "commit_reveal_period": int}` | Commit-reveal interval in blocks |
|
|
33
|
+
|
|
34
|
+
### Alpha Parameters (Liquid Alpha)
|
|
35
|
+
|
|
36
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
37
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
38
|
+
| `alpha_high` | `int` | `sudo_set_alpha_values` | `{"netuid": int, "alpha_low": int, "alpha_high": int}` | High alpha value |
|
|
39
|
+
| `alpha_low` | `int` | `sudo_set_alpha_values` | `{"netuid": int, "alpha_low": int, "alpha_high": int}` | Low alpha value |
|
|
40
|
+
| `liquid_alpha_enabled` | `bool` | `sudo_set_liquid_alpha_enabled` | `{"netuid": int, "enabled": bool}` | Enable liquid alpha |
|
|
41
|
+
| `alpha_sigmoid_steepness` | `float` | `sudo_set_alpha_sigmoid_steepness` | `{"netuid": int, "alpha_sigmoid_steepness": int}` | Sigmoid steepness for alpha |
|
|
42
|
+
|
|
43
|
+
### Registration Parameters
|
|
44
|
+
|
|
45
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
46
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
47
|
+
| `registration_allowed` | `bool` | `sudo_set_network_registration_allowed` | `{"netuid": int, "registration_allowed": bool}` | Allow registration on subnet |
|
|
48
|
+
| `target_regs_per_interval` | `int` | `sudo_set_target_registrations_per_interval` | `{"netuid": int, "target_registrations_per_interval": int}` | Target registrations per interval |
|
|
49
|
+
| `max_regs_per_block` | `int` | `sudo_set_max_registrations_per_block` | `{"netuid": int, "max_registrations_per_block": int}` | Max registrations per block |
|
|
50
|
+
| `immunity_period` | `int` | `sudo_set_immunity_period` | `{"netuid": int, "immunity_period": int}` | Immunity period duration |
|
|
51
|
+
|
|
52
|
+
### Difficulty & Burn Parameters
|
|
53
|
+
|
|
54
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
55
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
56
|
+
| `difficulty` | `int` | `sudo_set_difficulty` | `{"netuid": int, "difficulty": int}` | Current difficulty level |
|
|
57
|
+
| `min_difficulty` | `int` | `sudo_set_min_difficulty` | `{"netuid": int, "min_difficulty": int}` | Minimum difficulty |
|
|
58
|
+
| `max_difficulty` | `int` | `sudo_set_max_difficulty` | `{"netuid": int, "max_difficulty": int}` | Maximum difficulty |
|
|
59
|
+
| `min_burn` | `int` | `sudo_set_min_burn` | `{"netuid": int, "min_burn": int}` | Minimum burn value |
|
|
60
|
+
| `max_burn` | `int` | `sudo_set_max_burn` | `{"netuid": int, "max_burn": int}` | Maximum burn value |
|
|
61
|
+
| `adjustment_alpha` | `int` | `sudo_set_adjustment_alpha` | `{"netuid": int, "adjustment_alpha": int}` | Alpha for adjustments |
|
|
62
|
+
| `adjustment_interval` | `int` | `sudo_set_adjustment_interval` | `{"netuid": int, "adjustment_interval": int}` | Adjustment interval |
|
|
63
|
+
|
|
64
|
+
### Validator Parameters
|
|
65
|
+
|
|
66
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
67
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
68
|
+
| `max_validators` | `int` | `sudo_set_max_allowed_validators` | `{"netuid": int, "max_allowed_validators": int}` | Maximum validators |
|
|
69
|
+
| `activity_cutoff` | `int` | `sudo_set_activity_cutoff` | `{"netuid": int, "activity_cutoff": int}` | Activity cutoff threshold |
|
|
70
|
+
| `serving_rate_limit` | `int` | `sudo_set_serving_rate_limit` | `{"netuid": int, "serving_rate_limit": int}` | Serving rate limit |
|
|
71
|
+
|
|
72
|
+
### Subnet State Parameters
|
|
73
|
+
|
|
74
|
+
| Hyperparameter | Type | Extrinsic Function | Call Params | Description |
|
|
75
|
+
|----------------|------|-------------------|-------------|-------------|
|
|
76
|
+
| `subnet_is_active` | `bool` | N/A (set by START CALL) | N/A | Subnet active status |
|
|
77
|
+
| `transfers_enabled` | `bool` | `sudo_set_transfers_enabled` | `{"netuid": int, "enabled": bool}` | Enable transfers |
|
|
78
|
+
| `user_liquidity_enabled` | `bool` | `sudo_set_user_liquidity_enabled` | `{"netuid": int, "enabled": bool}` | Enable user liquidity |
|
|
79
|
+
| `yuma_version` | `int` | `sudo_set_yuma_version` | `{"netuid": int, "yuma_version": int}` | Yuma consensus version |
|
|
80
|
+
|
|
81
|
+
## Global (Non-Subnet) Parameters
|
|
82
|
+
|
|
83
|
+
These parameters are set globally, not per-subnet:
|
|
84
|
+
|
|
85
|
+
| Parameter | Extrinsic Function | Call Params | Description |
|
|
86
|
+
|-----------|-------------------|-------------|-------------|
|
|
87
|
+
| Admin Freeze Window | `sudo_set_admin_freeze_window` | `{"window": int}` | Freeze window at end of tempo |
|
|
88
|
+
| Network Rate Limit | `sudo_set_network_rate_limit` | `{"rate_limit": int}` | Global network rate limit |
|
|
89
|
+
| TX Rate Limit | `sudo_set_tx_rate_limit` | `{"rate_limit": int}` | Transaction rate limit |
|
|
90
|
+
| Lock Reduction Interval | `sudo_set_lock_reduction_interval` | `{"interval": int}` | Lock reduction interval |
|
|
91
|
+
| Nominator Min Stake | `sudo_set_nominator_min_required_stake` | `{"stake": int}` | Minimum nominator stake |
|
|
92
|
+
| Stake Threshold | `sudo_set_stake_threshold` | `{"stake_threshold": int}` | Stake threshold |
|
|
93
|
+
| Delegate Take Rate Limit | `sudo_set_tx_delegate_take_rate_limit` | `{"rate_limit": int}` | Delegate take rate limit |
|
|
94
|
+
| POW Registration | `sudo_set_network_pow_registration_allowed` | `{"netuid": int, "enabled": bool}` | Allow POW registration |
|
|
95
|
+
|
|
96
|
+
## Mechanism Parameters
|
|
97
|
+
|
|
98
|
+
Special parameters for subnet mechanisms:
|
|
99
|
+
|
|
100
|
+
| Parameter | Extrinsic Function | Call Params | Description |
|
|
101
|
+
|-----------|-------------------|-------------|-------------|
|
|
102
|
+
| Mechanism Count | `sudo_set_mechanism_count` | `{"netuid": int, "mechanism_count": int}` | Number of subnet mechanisms |
|
|
103
|
+
| Mechanism Emission Split | `sudo_set_mechanism_emission_split` | `{"netuid": int, "maybe_split": list[int]}` | Emission distribution ratio |
|