feat: add encrypt_at_round() for direct Drand round encryption#56
Merged
basfroman merged 4 commits intoopentensor:stagingfrom Nov 12, 2025
Merged
feat: add encrypt_at_round() for direct Drand round encryption#56basfroman merged 4 commits intoopentensor:stagingfrom
basfroman merged 4 commits intoopentensor:stagingfrom
Conversation
Contributor
|
Looks fine to me, but I want @basfroman to have a look. |
Contributor
Author
Thanks for the review! Happy to make any changes if @basfroman has feedback. |
Contributor
Hey @ShubhamChndrvnshi LGTM. But I updated |
Contributor
Author
|
@basfroman |
basfroman
approved these changes
Nov 12, 2025
This was referenced Nov 17, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
encrypt_at_round(data: bytes, reveal_round: int)to timelock-encrypt data for a specific Drand reveal round. Expose the function to Python and extend tests.Changes
encrypt_at_roundtosrc/python_bindings.rsusingdrand::encrypt_and_compressanddrand::UserData { encrypted_data, reveal_round }.encode()._encrypt_at_roundfrom native module and provide a typed wrapperencrypt_at_round(data: bytes, reveal_round: int) -> tuple[bytes, int]inbittensor_drand/__init__.py.tests/test_all_functions.pywithtest_encrypt_at_round_and_decryptcovering past and future round behavior.Diff Summary
main:bittensor_drand/__init__.py(+17)src/python_bindings.rs(+38)tests/test_all_functions.py(+28 −1)Technical Details
reveal_round: u64and produces an encoded payload that includes both the ciphertext and the round metadata.(encrypted_bytes, reveal_round).no_errors=True.Compatibility
encrypt,decrypt,get_encrypted_commit,get_encrypted_commitment) remain unchanged.Cargo.tomland Python versions inpyproject.toml.Testing
tests/test_all_functions.py.maturin developfollowed by running the test suite.Documentation
encrypt_at_roundin__init__.py.encrypt_at_round.Checklist
Related
opentensor/bittensor-drand(link)