Store provenance on IPFS instead of local files

- Add add_json() to ipfs_client for storing JSON data
- Update render_effect task to store provenance on IPFS
- Update execute_dag task to store DAG provenance on IPFS
- Add provenance_cid field to RunStatus model
- Extract provenance_cid from task results

Provenance is now immutable and content-addressed, enabling:
- Cross-L2 verification
- Bitcoin timestamping for dispute resolution
- Complete audit trail on IPFS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 02:40:38 +00:00
parent 51358a2d5f
commit 45826138ca
4 changed files with 61 additions and 5 deletions

View File

@@ -102,6 +102,22 @@ def add_bytes(data: bytes, pin: bool = True) -> Optional[str]:
return None
def add_json(data: dict, pin: bool = True) -> Optional[str]:
"""
Serialize dict to JSON and add to IPFS.
Args:
data: Dictionary to serialize and store
pin: Whether to pin the data (default: True)
Returns:
IPFS CID or None on failure
"""
import json
json_bytes = json.dumps(data, indent=2, sort_keys=True).encode('utf-8')
return add_bytes(json_bytes, pin=pin)
def get_file(cid: str, dest_path: Path) -> bool:
"""
Retrieve a file from IPFS and save to destination.