Skip to content

Commit 91ec2c3

Browse files
committed
refactor(contracts): core contracts optimization, reflect on tests
1 parent 0bd434c commit 91ec2c3

12 files changed

+590
-451
lines changed

packages/contracts/contracts/src/AdvancedChecker.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

4-
import {IAdvancedChecker, Check, CheckStatus} from "./interfaces/IAdvancedChecker.sol";
4+
import {IAdvancedChecker, Check} from "./interfaces/IAdvancedChecker.sol";
55
import {Checker} from "./Checker.sol";
66

77
/// @title AdvancedChecker.

packages/contracts/contracts/src/Checker.sol

+8-6
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ abstract contract Checker is IChecker {
2020
verifiers = _verifiers;
2121
}
2222

23-
/// @notice Retrieves the list of third-party verifiers' addresses.
24-
/// @return Array of addresses for the necessary verification contracts.
25-
function getVerifiers() internal view returns (address[] memory) {
26-
return verifiers;
23+
/// @notice Retrieves the verifier address at a specific index.
24+
/// @param index The index of the verifier in the array.
25+
/// @return The address of the verifier at the specified index.
26+
/// @custom:throws VerifierNotFound if no address have been specified at given index.
27+
function getVerifierAtIndex(uint256 index) external view returns (address) {
28+
return _getVerifierAtIndex(index);
2729
}
2830

29-
/// @notice Retrieves the verifier address at a specific index.
31+
/// @notice Internal implementation of verifier address retrieval at a specific index.
3032
/// @param index The index of the verifier in the array.
3133
/// @return The address of the verifier at the specified index.
3234
/// @custom:throws VerifierNotFound if no address have been specified at given index.
33-
function getVerifierAtIndex(uint256 index) internal view returns (address) {
35+
function _getVerifierAtIndex(uint256 index) internal view returns (address) {
3436
if (index >= verifiers.length) revert VerifierNotFound();
3537

3638
return verifiers[index];

packages/contracts/contracts/src/interfaces/IChecker.sol

+6
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ pragma solidity ^0.8.20;
66
interface IChecker {
77
/// @notice Core error conditions.
88
error VerifierNotFound();
9+
10+
/// @notice Retrieves the verifier address at a specific index.
11+
/// @param index The index of the verifier in the array.
12+
/// @return The address of the verifier at the specified index.
13+
/// @custom:throws VerifierNotFound if no address have been specified at given index.
14+
function getVerifierAtIndex(uint256 index) external view returns (address);
915
}

0 commit comments

Comments
 (0)