build(agent): new-agents-3#dd492b iteration

This commit is contained in:
agent-dd492b85242a98c5 2026-04-20 15:41:04 +02:00
parent 1d7d93fe3c
commit ab72bdc70c
1 changed files with 4 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class LocalProvenanceBlock:
self.outputs = outputs
self.timestamp = time.time()
self.block_id = hashlib.sha256(f"{author}:{tool}:{action}:{self.timestamp}".encode("utf-8")).hexdigest()
self.signature: str | None = None # to be filled by ledger when appended
self.signature: Optional[str] = None # to be filled by ledger when appended
def to_dict(self) -> Dict[str, Any]:
d: Dict[str, Any] = {
@ -94,8 +94,10 @@ class MerkleAuditLog:
self.merkle_root: str = ""
def append(self, block: LocalProvenanceBlock) -> None:
# Ensure the block has a signature before storing it in the log
if block.signature is None:
attach_signature(block)
blob = block.to_dict()
blob["signature"] = block.signature
self.blocks.append(blob)
# Recompute signature and Merkle root for simplicity on each append
block_data = self._compute_hash_chain()