// SPDX-License-Identifier: MIT pragma solidity 0.8.30; /// @notice Publisher attestations to offchain swarm snapshots, not execution proofs. /// @dev Stores hashes only. No token custody, fee collection or spending functions. contract SwarmCheckpoints { address public immutable publisher; mapping(bytes32 => bool) public recorded; uint256 public checkpointCount; event CheckpointRecorded(bytes32 indexed digest, bytes32 indexed engineHash, uint32 seed, uint32 population, uint64 steps, uint256 sequence); error Unauthorized(); error InvalidCheckpoint(); error AlreadyRecorded(); constructor(address publisher_) { if (publisher_ == address(0)) revert InvalidCheckpoint(); publisher = publisher_; } function record(bytes32 digest, bytes32 engineHash, uint32 seed, uint32 population, uint64 steps) external { if (msg.sender != publisher) revert Unauthorized(); if (digest == bytes32(0) || engineHash == bytes32(0) || (population != 64 && population != 128 && population != 256 && population != 512)) revert InvalidCheckpoint(); if (recorded[digest]) revert AlreadyRecorded(); recorded[digest] = true; emit CheckpointRecorded(digest, engineHash, seed, population, steps, ++checkpointCount); } }