Skip to content

Commit afd7413

Browse files
authored
Merge pull request #62 from opentensor/release/1.1.0
Release/1.1.0
2 parents 01b5cb1 + 1b6afb6 commit afd7413

File tree

11 files changed

+351
-90
lines changed

11 files changed

+351
-90
lines changed

.circleci/config.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: PyO3/[email protected]
4848
with:
4949
target: ${{ matrix.platform.target }}
50-
args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13
50+
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13 python3.14
5151
sccache: 'true'
5252
manylinux: auto
5353
before-script-linux: |
@@ -69,9 +69,9 @@ jobs:
6969
strategy:
7070
matrix:
7171
platform:
72-
- runner: macos-13
72+
- runner: macos-15-intel
7373
target: x86_64
74-
- runner: macos-14
74+
- runner: macos-latest
7575
target: aarch64
7676
steps:
7777
- uses: actions/checkout@v4
@@ -83,7 +83,7 @@ jobs:
8383
uses: PyO3/[email protected]
8484
with:
8585
target: ${{ matrix.platform.target }}
86-
args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13
86+
args: --release --out dist --interpreter python3.10 python3.11 python3.12 python3.13 python3
8787
sccache: 'true'
8888

8989
- name: Upload wheels
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test and Lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
ruff:
9+
name: Ruff Linting
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.9.13'
19+
20+
- name: Install Ruff
21+
run: pip install ruff
22+
23+
- name: Run Ruff
24+
run: ruff check .
25+
26+
build-and-test:
27+
name: Build and Test (Python ${{ matrix.python-version }})
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
32+
fail-fast: false
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Set up Rust
44+
uses: dtolnay/rust-toolchain@stable
45+
46+
- name: Set Up Virtual Environment
47+
run: |
48+
python -m venv .venv
49+
source .venv/bin/activate
50+
python -m pip install --upgrade pip
51+
python -m pip install '.[dev]'
52+
53+
- name: Create test results directory
54+
run: mkdir -p test-results
55+
56+
- name: Run Tests
57+
run: |
58+
source .venv/bin/activate
59+
pytest tests/
60+
continue-on-error: false
61+

CHANGELOG.MD

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## v1.1.0 /2025-11-17
4+
5+
## What's Changed
6+
* Add missing hotkey parameter to test functions by @Gimzou in https://github.com/opentensor/bittensor-drand/pull/48
7+
* Update release workflow by @basfroman in https://github.com/opentensor/bittensor-drand/pull/58
8+
* feat: add encrypt_at_round() for direct Drand round encryption by @ShubhamChndrvnshi in https://github.com/opentensor/bittensor-drand/pull/56
9+
* feat: add decrypt_with_signature() by @ShubhamChndrvnshi in https://github.com/opentensor/bittensor-drand/pull/59
10+
* Python 3.14 support, fix unit tests + move workflow to gh by @basfroman in https://github.com/opentensor/bittensor-drand/pull/60
11+
12+
## New Contributors
13+
* @Gimzou made their first contribution in https://github.com/opentensor/bittensor-drand/pull/48
14+
* @ShubhamChndrvnshi made their first contribution in https://github.com/opentensor/bittensor-drand/pull/56
15+
16+
**Full Changelog**: https://github.com/opentensor/bittensor-drand/compare/v1.0.1...v1.1.0
17+
318
## v1.0.1 /2025-10-29
419
* Updates PyO3 to handle py3.14 by @thewhaleking in https://github.com/opentensor/bittensor-drand/pull/52
520
* Updates workflow to be able to use forks as well by @thewhaleking in https://github.com/opentensor/bittensor-drand/pull/51

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bittensor-drand"
3-
version = "1.0.1"
3+
version = "1.1.0"
44
edition = "2021"
55

66
[lib]

bittensor_drand/__init__.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
get_encrypted_commit as _get_encrypted_commit,
55
get_encrypted_commitment as _get_encrypted_commitment,
66
encrypt as _encrypt,
7+
encrypt_at_round as _encrypt_at_round,
78
decrypt as _decrypt,
9+
decrypt_with_signature as _decrypt_with_signature,
10+
get_signature_for_round as _get_signature_for_round,
811
get_latest_round as _get_latest_round,
912
)
1013

@@ -93,6 +96,23 @@ def encrypt(
9396
return _encrypt(data, n_blocks, block_time)
9497

9598

99+
def encrypt_at_round(data: bytes, reveal_round: int) -> tuple[bytes, int]:
100+
"""Encrypts arbitrary binary data for a specific Drand reveal round.
101+
102+
Arguments:
103+
data: The binary data to encrypt.
104+
reveal_round: The specific Drand round number when decryption becomes possible.
105+
106+
Returns:
107+
encrypted_data (bytes): Raw bytes of the encrypted data.
108+
reveal_round (int): The Drand round number when data can be revealed (same as input).
109+
110+
Raises:
111+
ValueError: If encryption fails.
112+
"""
113+
return _encrypt_at_round(data, reveal_round)
114+
115+
96116
def decrypt(encrypted_data: bytes, no_errors: bool = True) -> Optional[bytes]:
97117
"""Decrypts previously encrypted data if the reveal time has been reached.
98118
@@ -110,6 +130,41 @@ def decrypt(encrypted_data: bytes, no_errors: bool = True) -> Optional[bytes]:
110130
return _decrypt(encrypted_data, no_errors)
111131

112132

133+
def decrypt_with_signature(encrypted_data: bytes, signature_hex: str) -> bytes:
134+
"""Decrypts data using a provided Drand signature.
135+
This function is useful when decrypting multiple ciphertexts for the same round,
136+
allowing you to fetch the signature once and reuse it, avoiding redundant API calls.
137+
138+
Arguments:
139+
encrypted_data: The encrypted data to decrypt.
140+
signature_hex: Hex-encoded Drand BLS signature for the reveal round.
141+
142+
Returns:
143+
decrypted_data (bytes): The decrypted data.
144+
145+
Raises:
146+
ValueError: If decryption fails or signature is invalid.
147+
"""
148+
return _decrypt_with_signature(encrypted_data, signature_hex)
149+
150+
151+
def get_signature_for_round(reveal_round: int) -> str:
152+
"""Fetches the Drand signature for a specific round.
153+
This is useful for batch decryption scenarios where you want to decrypt
154+
multiple ciphertexts for the same round without making redundant API calls.
155+
156+
Arguments:
157+
reveal_round: The Drand round number to fetch the signature for.
158+
159+
Returns:
160+
signature_hex (str): Hex-encoded BLS signature for the round.
161+
162+
Raises:
163+
ValueError: If the signature cannot be fetched or is not yet available.
164+
"""
165+
return _get_signature_for_round(reveal_round)
166+
167+
113168
def get_latest_round() -> int:
114169
"""Gets the latest revealed Drand round number.
115170

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "bittensor-drand"
3-
version = "1.0.1"
3+
version = "1.1.0"
44
description = ""
55
readme = "README.md"
66
license = {file = "LICENSE"}
@@ -21,11 +21,11 @@ classifiers = [
2121
"Topic :: Software Development :: Build Tools",
2222
"License :: OSI Approved :: MIT License",
2323
"Programming Language :: Python :: 3 :: Only",
24-
"Programming Language :: Python :: 3.9",
2524
"Programming Language :: Python :: 3.10",
2625
"Programming Language :: Python :: 3.11",
2726
"Programming Language :: Python :: 3.12",
2827
"Programming Language :: Python :: 3.13",
28+
"Programming Language :: Python :: 3.14",
2929
"Topic :: Scientific/Engineering",
3030
"Topic :: Scientific/Engineering :: Mathematics",
3131
"Topic :: Scientific/Engineering :: Artificial Intelligence",
@@ -49,4 +49,4 @@ exclude = ["tests*"]
4949
dev = [
5050
"maturin==1.7.0",
5151
"pytest-asyncio==0.23.7"
52-
]
52+
]

0 commit comments

Comments
 (0)