Files
gru_emoney_token-factory/test/mocks/MockLightClient.sol
defiQUG e8ae376e90 Enhance API services with validation and error handling improvements
- Integrated Zod validation schemas across various API routes to ensure input integrity and improve error handling.
- Updated `mapping-service`, `orchestrator`, `packet-service`, and `webhook-service` to utilize validation middleware for request parameters and bodies.
- Improved error handling in webhook management, packet generation, and compliance routes to provide clearer feedback on request failures.
- Added new validation schemas for various endpoints, enhancing overall API robustness and maintainability.
- Updated dependencies in `package.json` to include the new validation library.
2025-12-12 20:23:45 -08:00

49 lines
1.4 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title MockLightClient
* @notice Mock light client for testing BridgeVault138 unlock functionality
* @dev Always returns true for proof verification in tests
*/
contract MockLightClient {
mapping(bytes32 => mapping(bytes32 => bool)) private _verifiedProofs;
bool public alwaysVerify = true;
/**
* @notice Sets whether proofs should always verify
* @param _alwaysVerify If true, all proofs verify; if false, only pre-registered proofs verify
*/
function setAlwaysVerify(bool _alwaysVerify) external {
alwaysVerify = _alwaysVerify;
}
/**
* @notice Registers a proof as verified for testing
* @param sourceChain Source chain identifier
* @param sourceTx Source transaction hash
*/
function registerProof(bytes32 sourceChain, bytes32 sourceTx) external {
_verifiedProofs[sourceChain][sourceTx] = true;
}
/**
* @notice Verifies a proof
* @param sourceChain Source chain identifier
* @param sourceTx Source transaction hash
* @param proof Proof data (unused in mock)
* @return true if proof is verified, false otherwise
*/
function verifyProof(
bytes32 sourceChain,
bytes32 sourceTx,
bytes calldata proof
) external view returns (bool) {
if (alwaysVerify) {
return true;
}
return _verifiedProofs[sourceChain][sourceTx];
}
}