pragma solidity ^0.8.13; contract ManifestRootRegistry { event RootSet(address indexed agent, bytes32 root); mapping(address => bytes32) private _roots; function setRoot(bytes32 root) external { _roots[msg.sender] = root; emit RootSet(msg.sender, root); } function getRoot(address agent) external view returns (bytes32) { return _roots[agent]; } function verify(address agent, bytes32 leaf, bytes32[] calldata proof) external view returns (bool) { bytes32 root = _roots[agent]; bytes32 computed = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 sibling = proof[i]; if (computed < sibling) { computed = keccak256(abi.encodePacked(computed, sibling)); } else { computed = keccak256(abi.encodePacked(sibling, computed)); } } return computed == root; } function makeLeaf(bytes calldata manifest) external pure returns (bytes32) { return keccak256(manifest); } }