Skip to content

v0.4.0: Python-friendly Receipt API

Choose a tag to compare

@garyrob garyrob released this 16 Aug 18:47
· 6 commits to main since this release

What's Changed

πŸŽ‰ Major Receipt API Improvements

Python-friendly properties and methods for better ergonomics and security.

New Features

  • Journal Properties: journal_bytes, journal_hex, journal_text, journal_len for easy journal access
  • Structured Exit Status: ExitStatus with kind, user_code, and ok properties
  • ExitKind Enum: Clear exit types (HALTED, PAUSED, SYSTEM_SPLIT, SESSION_LIMIT)
  • Image ID Properties: claimed_image_id_hex/claimed_image_id_bytes (clearly marked as untrusted)
  • New Verification Methods:
    • verify_hex(image_id) - accepts hex strings with optional 0x prefix
    • verify_bytes(image_id) - accepts 32-byte values
    • verify_integrity() - safe inspection of failed proofs
  • Receipt Serialization: to_bytes()/from_bytes() for storage/transport
  • Helper Function: compute_image_id_hex(elf_bytes) to derive trusted image IDs
  • Better Debugging: Improved __repr__() with journal preview and image ID

Security Improvements

  • Clear separation between "claimed" (from receipt) and "trusted" (from verifier) image IDs
  • Verification methods require explicit trusted image ID parameter
  • Better error messages and validation

Removed

  • decode_journal() - Not implemented as RISC Zero 1.2 doesn't expose needed APIs (requires 2.x+)

Backward Compatibility

  • Legacy properties (journal, program_id, exit_code) still work
  • verify() method continues to work with image_id parameter

Installation

# For development
uv tool run maturin build --release
uv pip install --force-reinstall target/wheels/PyR0-*.whl

Full Changelog: v0.3.0...v0.4.0