Open distributedstatemachine opened 3 months ago
The process will look like this:
Commit: (netuid, hotkey_pub, nonce, weights) -> hash -> commit_weights
Reveal: (netuid, nonce, weights) -> reveal_weights -> (netuid, hotkey_pub, nonce, weights) -> hash -> verify
@sam0x17 breaking change
Decscription
The goal is to implement a commit-reveal scheme for submitting weights in the Subtensor module. This scheme will require validators to submit a hashed version of their weights along with a signature during the commit phase. After a specified number of blocks (reveal tempo), validators will reveal the actual weights, which will be verified against the commit hash.
Requirements
commit_weights
function that allows validators to submit a hashed version of their weights along with a signature during the commit phase.reveal_weights
function that allows validators to reveal the actual weights after the specified reveal tempo.Rust Implementation
Storage
Add the following storage item to store commit hashes, signatures, and block numbers per validator and subnet:
commit_weights
FunctionImplement the
commit_weights
function for the commit phase:reveal_weights
FunctionImplement the
reveal_weights
function for the reveal phase:Helper Functions
Implement helper functions for the commit-reveal process:
Implement background tasks for cleaning up expired commits and managing the commit-reveal process.
Python Implementation
commit_weights
FunctionAdd to
bittensor/subtensor.py
:reveal_weights
FunctionAdd to
bittensor/subtensor.py
:Helper Functions
Add to
bittensor/subtensor.py
:Implement background tasks for cleaning up expired commits and managing the commit-reveal process.
Error Handling
Provide clear error messages in
bittensor/errors.py
for various scenarios, such as:Testing
commit_weights
andreveal_weights
functions in both Rust and Python.Documentation
Const
Vune