Skip to content

Commit 688259b

Browse files
committed
refactor(contracts): remove redundant if case; move struct to interface
1 parent 64ae098 commit 688259b

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

packages/contracts/contracts/src/AdvancedChecker.sol

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

4-
import {IAdvancedChecker, Check} from "./interfaces/IAdvancedChecker.sol";
5-
6-
/// @notice Tracks validation status for pre, main, and post checks.
7-
/// @dev Used to maintain check state in AdvancedPolicy.
8-
struct CheckStatus {
9-
/// @dev Pre-check completion status.
10-
bool pre;
11-
/// @dev Number of completed main checks.
12-
uint8 main;
13-
/// @dev Post-check completion status.
14-
bool post;
15-
}
4+
import {IAdvancedChecker, Check, CheckStatus} from "./interfaces/IAdvancedChecker.sol";
165

176
/// @title AdvancedChecker.
187
/// @notice Multi-phase validation checker with pre, main, and post checks.

packages/contracts/contracts/src/AdvancedPolicy.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ abstract contract AdvancedPolicy is IAdvancedPolicy, Policy {
7777
} else if (checkType == Check.POST) {
7878
// Handle POST check.
7979
if (SKIP_POST) revert CannotPostCheckWhenSkipped();
80-
if (!status.pre) {
81-
revert PreCheckNotEnforced();
82-
}
8380
if (status.main == 0) {
8481
revert MainCheckNotEnforced();
8582
}

packages/contracts/contracts/src/interfaces/IAdvancedChecker.sol

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ enum Check {
1212
POST
1313
}
1414

15+
/// @notice Tracks validation status for pre, main, and post checks.
16+
/// @dev Used to maintain check state in AdvancedPolicy.
17+
struct CheckStatus {
18+
/// @dev Pre-check completion status.
19+
bool pre;
20+
/// @dev Number of completed main checks.
21+
uint8 main;
22+
/// @dev Post-check completion status.
23+
bool post;
24+
}
25+
1526
/// @title IAdvancedChecker.
1627
/// @notice Defines multi-phase validation system interface.
1728
/// @dev Implement this for custom validation logic with pre/main/post checks.

0 commit comments

Comments
 (0)