build(agent): new-agents-3#dd492b iteration
This commit is contained in:
parent
1d7d93fe3c
commit
ab72bdc70c
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue