Skip to content

Commit 0614e74

Browse files
author
EchoBT
committed
feat: Add high-level Subtensor API with intelligent set_weights
- Add new subtensor module with Subtensor struct (like Python SDK) - Implement automatic commit-reveal detection and routing: - CRv4 (version >= 4): Timelock encryption with DRAND auto-reveal - Legacy (version < 4): Hash-based commit-reveal with persistence - Direct: When commit-reveal is disabled - Add SubtensorBuilder for configuration - Add WeightResponse with tx_hash and metadata - Add persistence for pending commits (legacy mode) - Re-export mechanism functions and Subtensor types
1 parent 39e6ea3 commit 0614e74

2 files changed

Lines changed: 888 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub mod core;
77
pub mod crv4;
88
pub mod metagraph;
99
pub mod queries;
10+
pub mod subtensor;
1011
pub mod types;
1112
pub mod utils;
1213
pub mod validator;
@@ -72,3 +73,14 @@ pub use crv4::{
7273
Crv4StateManager, DrandInfo, WeightsTlockPayload, DEFAULT_COMMIT_REVEAL_VERSION,
7374
DRAND_QUICKNET_GENESIS, DRAND_QUICKNET_PK_HEX, DRAND_ROUND_INTERVAL_SECS,
7475
};
76+
77+
// Re-export high-level Subtensor API (like Python SDK)
78+
pub use subtensor::{
79+
PendingCommit, Salt, Subtensor, SubtensorBuilder, SubtensorState, WeightResponse,
80+
WeightResponseData,
81+
};
82+
83+
// Re-export mechanism functions from validator
84+
pub use validator::mechanism::{
85+
commit_mechanism_weights, reveal_mechanism_weights, set_mechanism_weights,
86+
};

0 commit comments

Comments
 (0)