-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.10; | ||
|
||
import "../../utils/BytesGenerator.sol"; | ||
|
||
import {Base} from "../Base.sol"; | ||
import {BaseService} from "./BaseService.sol"; | ||
|
||
contract OperatorService is BaseService, BytesGenerator { | ||
string internal operatorOneName = "NodeMasters"; | ||
string internal operatorTwoName = "StakePros"; | ||
|
||
uint256 internal operatorOneIndex; | ||
uint256 internal operatorTwoIndex; | ||
|
||
address internal operatorOne; | ||
address internal operatorOneFeeRecipient; | ||
address internal operatorTwo; | ||
address internal operatorTwoFeeRecipient; | ||
|
||
constructor(Base _base) BaseService(_base) { | ||
operatorOne = makeAddr("operatorOne"); | ||
operatorTwo = makeAddr("operatorTwo"); | ||
staticOperatorsSetup(); | ||
} | ||
|
||
function staticOperatorsSetup() internal prankAdmin { | ||
base.oracle().addMember(base.oracleMember(), 1); | ||
|
||
operatorOneIndex = base.operatorsRegistry().addOperator(operatorOneName, operatorOne); | ||
operatorTwoIndex = base.operatorsRegistry().addOperator(operatorTwoName, operatorTwo); | ||
|
||
bytes memory hundredKeysOp1 = genBytes((48 + 96) * 100); | ||
|
||
base.operatorsRegistry().addValidators(operatorOneIndex, 100, hundredKeysOp1); | ||
|
||
bytes memory hundredKeysOp2 = genBytes((48 + 96) * 100); | ||
|
||
base.operatorsRegistry().addValidators(operatorTwoIndex, 100, hundredKeysOp2); | ||
|
||
uint256[] memory operatorIndexes = new uint256[](2); | ||
operatorIndexes[0] = operatorOneIndex; | ||
operatorIndexes[1] = operatorTwoIndex; | ||
uint32[] memory operatorLimits = new uint32[](2); | ||
operatorLimits[0] = 100; | ||
operatorLimits[1] = 100; | ||
|
||
base.operatorsRegistry().setOperatorLimits(operatorIndexes, operatorLimits, block.number); | ||
} | ||
|
||
// function getTargetSelectors() external view override returns (StdInvariant.FuzzSelector memory selectors) { | ||
// } | ||
|
||
// TODO: Add the dynamic operator management | ||
} |
27 changes: 27 additions & 0 deletions
27
contracts/test/invariants/handlers/OracleDaemonService.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.10; | ||
|
||
import "forge-std/StdInvariant.sol"; | ||
|
||
import {Base} from "../Base.sol"; | ||
import {BaseService} from "./BaseService.sol"; | ||
|
||
import {IOracleManagerV1} from "../../../src/interfaces/components/IOracleManager.1.sol"; | ||
contract OracleDaemonService is BaseService { | ||
constructor(Base _base) BaseService(_base) {} | ||
|
||
function getTargetSelectors() external view override returns (StdInvariant.FuzzSelector memory selectors) { | ||
bytes4[] memory selectorsArray = new bytes4[](1); | ||
selectorsArray[0] = this.action_report.selector; | ||
|
||
selectors.selectors = selectorsArray; | ||
selectors.addr = address(this); | ||
} | ||
|
||
function action_report() external prankOracleMember { | ||
IOracleManagerV1.ConsensusLayerReport memory dummyReport; | ||
dummyReport.stoppedValidatorCountPerOperator = new uint32[](1); | ||
base.oracle().reportConsensusLayerData(dummyReport); | ||
} | ||
} |