You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add comprehensive type stubs for VersionedKvStore proof and merge functionality (#102)
* Add generate_proof and verify_proof methods to VersionedKvStore
Expose cryptographic proof functionality from ProllyTree to VersionedKvStore
in both Rust and Python APIs for consistent proof generation and verification
across versioned key-value operations.
## Changes
### Rust Implementation
- Add `generate_proof(&self, key: &[u8]) -> Proof<N>` to VersionedKvStore
- Add `verify(&self, proof: Proof<N>, key: &[u8], expected_value: Option<&[u8]>) -> bool`
- Both methods delegate to underlying ProllyTree implementation
- Add comprehensive unit test `test_versioned_store_proof_methods`
### Python Bindings
- Add `generate_proof(key: bytes) -> bytes` to PyVersionedKvStore
- Add `verify_proof(proof_bytes: bytes, key: bytes, expected_value: Optional[bytes]) -> bool`
- Handle proof serialization/deserialization with bincode
- Thread-safe implementation with proper GIL handling
## API Usage
```python
store = VersionedKvStore.open("/path/to/repo")
proof = store.generate_proof(b"key1")
is_valid = store.verify_proof(proof, b"key1", b"value1")
```
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Update Python README to document VersionedKvStore proof methods
Add documentation for the newly added generate_proof and verify_proof
methods in the VersionedKvStore example section. Also update the
cryptographic verification feature description to clarify it's
available for both trees and versioned storage.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Add comprehensive type stubs for VersionedKvStore proof and merge functionality
Update Python type stubs (.pyi) to include the newly added proof methods
and previously missing merge functionality for better IDE support and
type checking.
## Added Type Stubs
### VersionedKvStore Methods
- `generate_proof(key: bytes) -> bytes` - Generate cryptographic proofs
- `verify_proof(proof: bytes, key: bytes, expected_value: Optional[bytes]) -> bool` - Verify proofs
- `get_commits_for_key(key: bytes) -> List[Dict[str, Union[str, int]]]` - Get key history
- `get_commit_history() -> List[Dict[str, Union[str, int]]]` - Get repository history
- `merge(source_branch: str, conflict_resolution: Optional[ConflictResolution]) -> str` - Merge branches
- `try_merge(source_branch: str) -> Tuple[bool, List[MergeConflict]]` - Attempt merge with conflict detection
### New Classes
- `MergeConflict` - Represents merge conflicts with key, base_value, source_value, destination_value properties
- `ConflictResolution` - Enum with IgnoreAll, TakeSource, TakeDestination strategies
These additions ensure comprehensive IDE support and type checking for all
VersionedKvStore functionality including the newly added proof methods.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
0 commit comments