// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

/// Mock SP1 verifier for tests — accepts only specific (vKey, proof) pairs
/// set by `setValid()`. Real SP1 verifier deployment goes through Succinct's
/// canonical artifacts.
///
/// IMPORTANT: mirrors the REAL SP1VerifierGateway semantics — verifyProof
/// RETURNS NOTHING and REVERTS on an invalid proof (it does NOT return a
/// bool). This is deliberate so tests exercise the exact code path used
/// against the production gateway.
contract MockSp1Verifier {
    mapping(bytes32 => bool) public valid;

    error MockInvalidProof();

    function setValid(bytes32 marker, bool ok) external {
        valid[marker] = ok;
    }

    function verifyProof(bytes32 programVKey, bytes calldata publicValues, bytes calldata proof) external view {
        bytes32 marker = keccak256(abi.encode(programVKey, publicValues, proof));
        if (!valid[marker]) revert MockInvalidProof();
    }
}
