// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import "../verifiers/compose/ComposeVerifier.sol";

/// @title MainnetVerifier
/// @notice SGX-GETH or SGX-RETH + (the other SGX or RISC0 or SP1) verifier
/// @dev DEPRECATED after the Unzen upgrade (Proposal0019): replaced by `ZkRequiredVerifier`,
/// which mandates at least one ZK proof per batch — this contract still accepts the
/// SGX-GETH + SGX-RETH (zero ZK) combination that finalized the June 2026 forged proofs.
/// Do not wire into new deployments. Kept in-repo while the live instance
/// (0x71808449A6217898d602c1a392D95b931Ac5d878) remains the active mainnet verifier, so it
/// stays rebuildable/verifiable and available as a rollback path; remove in the post-Unzen
/// cleanup once Proposal0019 has executed.
/// @custom:security-contact security@taiko.xyz
contract MainnetVerifier is ComposeVerifier {
    /// @notice Creates a new MainnetVerifier instance
    /// @param _sgxGethVerifier Address of the SGX-GETH verifier
    /// @param _sgxRethVerifier Address of the SGX-RETH verifier
    /// @param _risc0RethVerifier Address of the RISC0-RETH verifier
    /// @param _sp1RethVerifier Address of the SP1-RETH verifier
    constructor(
        address _sgxGethVerifier,
        address _sgxRethVerifier,
        address _risc0RethVerifier,
        address _sp1RethVerifier
    )
        ComposeVerifier(
            _sgxGethVerifier,
            address(0),
            address(0),
            _sgxRethVerifier,
            _risc0RethVerifier,
            _sp1RethVerifier
        )
    { }

    /// @notice Check if the provided verifiers are sufficient
    /// @dev Requires exactly 2 verifiers:
    /// SGX-GETH + (SGX-RETH or RISC0 or SP1), or
    /// SGX-RETH + (SGX-GETH or RISC0 or SP1)
    function areVerifiersSufficient(address[] memory _verifiers)
        internal
        view
        override
        returns (bool)
    {
        if (_verifiers.length != 2) return false;

        if (_verifiers[0] == sgxGethVerifier) {
            return _verifiers[1] == sgxRethVerifier || _verifiers[1] == risc0RethVerifier
                || _verifiers[1] == sp1RethVerifier;
        }

        if (_verifiers[0] == sgxRethVerifier) {
            return _verifiers[1] == sgxGethVerifier || _verifiers[1] == risc0RethVerifier
                || _verifiers[1] == sp1RethVerifier;
        }

        return false;
    }
}
