Skip to content

Releases: zhangfengcdt/prollytree

ProllyTree v0.2.0

13 Jul 01:26
de56c97
Compare
Choose a tag to compare

📦 ProllyTree v0.2.0 Release Notes

🎯 Overview

This release brings significant improvements to the ProllyTree library with critical bug fixes, new
visualization features, and enhanced encoding capabilities. This version focuses on data integrity,
developer experience, and cryptographic transparency.

✨ New Features

🔍 Proof Visualization System (PR #42)

A revolutionary new feature that makes cryptographic proofs visually accessible and transparent.

What's New:

  • print_proof() method - Combines proof generation with visual tree representation
  • Color-coded proof paths - Green highlighting shows the exact cryptographic verification trail
  • Hash transparency - Displays truncated hash values (first 16 hex chars) for manual verification
  • Interactive debugging - Perfect for understanding Merkle tree concepts and verification workflows

Example Output:
root:
└── *[0, 10] (hash: f70044057107ab51...) ← Green highlighted
├── [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
└── [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] (hash: 93c4bfe914b636cf...) ← Green
highlighted

Proof for key [10] is valid: true

Use Cases:

  • Educational demonstrations of cryptographic data structures
  • Debugging distributed systems and verification workflows
  • Trust-but-verify scenarios in peer-to-peer networks
  • Development and testing of prolly tree applications

📊 Enhanced Data Encoding (PR #39)

Expanded encoding capabilities for better data interchange and storage efficiency.

New Encoding Support:

  • Parquet encoding - Industry-standard columnar format for analytics
  • Schema-aware serialization - Leverages JSON Schema for type safety
  • Error propagation - Robust error handling without unwrap() calls
  • Test coverage - Order-agnostic tests for reliable validation

🐛 Critical Bug Fixes

🔒 Data Corruption Fix (PR #41)

CRITICAL: Fixed a severe data corruption bug that could cause catastrophic data loss.

Problem:
The split and merged boolean flags in ProllyNode were being persisted through serialization and never reset,
causing:

  • Split nodes having edges incorrectly hoisted to parent on every operation
  • Merged nodes having siblings incorrectly dropped from parent
  • Progressive tree structure corruption over time

Solution:

  • Made flags transient using #[serde(skip)] - no longer serialized
  • Automatic flag reset when nodes are retrieved from storage
  • Comprehensive test coverage to prevent regressions

Impact: This fix prevents data loss and ensures tree integrity across all operations.

⚖️ Improved Tree Balancing (PR #40)

Enhanced the probabilistic balancing algorithm for better tree performance and structure.

Improvements:

  • Refactored balancing logic for more consistent tree shapes
  • Better handling of edge cases during split/merge operations
  • Improved performance characteristics for various data patterns

🧪 Testing & Quality

Comprehensive Test Suite

  • 36 test cases covering all functionality
  • New proof visualization tests with real-world scenarios
  • Data corruption regression tests to prevent future issues
  • Example programs demonstrating features (examples/proof_visualization.rs)
  • Integration tests ensuring compatibility across features

Code Quality

  • All clippy warnings resolved
  • Consistent formatting with rustfmt
  • Enhanced documentation with usage examples
  • Error handling improvements throughout the codebase

🔧 Technical Details

API Additions

// New proof visualization API
impl Tree for ProllyTree {
fn print_proof(&self, key: &[u8]) -> bool;
}

// Enhanced node visualization
impl Node for ProllyNode {
fn print_tree_with_proof(&self, storage: &S, proof: &Proof, target_key: &[u8]);
}

// New encoding support
enum EncodingType {
Json,
Arrow,
Parquet, // ← New!
}

Breaking Changes

None - This release maintains full backward compatibility.

Performance Impact

  • Minimal overhead - New features only activate when explicitly requested
  • Fixed corruption improves long-term performance by maintaining tree integrity
  • Better balancing reduces tree depth for faster operations

📚 Documentation & Examples

New Examples

  • examples/proof_visualization.rs - Complete demonstration of proof visualization
  • Updated main.rs with proof demo integration
  • Enhanced README with new feature documentation

Improved Developer Experience

  • Visual debugging makes complex tree operations understandable
  • Hash transparency enables manual verification workflows
  • Color-coded output (with graceful degradation for non-color terminals)
  • Clear legends explaining symbols and highlighting

🚀 Migration Guide

From v0.1.x to v0.2.1-beta

No breaking changes - simply update your Cargo.toml:

[dependencies]
prollytree = "0.2.0"

Using New Features

use prollytree::tree::{ProllyTree, Tree};

// Create your tree as usual
let mut tree = ProllyTree::new(storage, config);
tree.insert(b"key".to_vec(), b"value".to_vec());

// NEW: Visualize cryptographic proofs!
let is_valid = tree.print_proof(b"key");

🙏 Acknowledgments

Special thanks to the community for:

  • Reporting the critical data corruption issue
  • Requesting proof visualization features
  • Providing feedback on API design
  • Contributing to the testing and validation process

🔮 What's Next

Looking ahead to v0.2.1:

  • Enhanced proof verification APIs
  • Performance optimizations for large trees
  • Additional encoding format support
  • Expanded visualization options