@@ -41,6 +41,8 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
4141 error ZeroRewardToken ();
4242 error ZeroEpochDuration ();
4343 error ZeroSlashingWindow ();
44+ error ZeroStakerReward ();
45+ error ZeroOperatorNetOptin ();
4446
4547 error NotOperator ();
4648 error NotVault ();
@@ -61,9 +63,7 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
6163 error InvalidEpoch ();
6264
6365 error SlashingWindowTooShort ();
64- error TooBigSlashAmount ();
6566 error UnknownSlasherType ();
66- error NotVetoSlasher ();
6767
6868 error ZeroTotalStake ();
6969 error ZeroRewardAmount ();
@@ -77,13 +77,6 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
7777 bytes32 key;
7878 }
7979
80- struct SlashedInfo {
81- uint48 epoch;
82- address operator;
83- uint256 slashedAmount;
84- uint256 timeStamp;
85- }
86-
8780 address public NETWORK;
8881 address public OPERATOR_REGISTRY;
8982 address public VAULT_REGISTRY;
@@ -96,14 +89,13 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
9689 uint48 public EPOCH_DURATION;
9790 uint48 public SLASHING_WINDOW;
9891 uint48 public START_TIME;
99- bytes32 public constant REWARD_DISTRIBUTION_ROLE = keccak256 ("REWARD_DISTRIBUTION_ROLE " );
92+ bytes32 public constant REWARD_DISTRIBUTION_ROLE =
93+ 0x9f89a45310bee56665a077229020c3130eedbd18bff771c3dc399fb850b2e12f ; // keccak256("REWARD_DISTRIBUTION_ROLE");
10094
10195 uint48 private constant INSTANT_SLASHER_TYPE = 0 ;
10296 uint48 private constant VETO_SLASHER_TYPE = 1 ;
10397
104- uint256 public slashIndex;
10598 uint256 public subnetworksCnt;
106- mapping (uint256 slashIndex = > SlashedInfo) slashedInfos;
10799 mapping (uint48 => uint256 ) public totalStakeCache;
108100 mapping (uint48 => bool ) public totalStakeCached;
109101 mapping (uint48 epoch = > mapping (address operator = > uint256 amounts )) public operatorStakeCache;
@@ -151,13 +143,33 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
151143 __Ownable_init (_owner);
152144 MultisigValidated.initialize (_owner, _minimumThreshold, _threshold);
153145
154- _checkNonZeroAddress (_network, "ZeroNetwork " );
155- _checkNonZeroAddress (_operatorRegistry, "ZeroOperatorRegistry " );
156- _checkNonZeroAddress (_vaultRegistry, "ZeroVaultRegistry " );
157- _checkNonZeroAddress (_operatorNetOptin, "ZeroOperatorNetOptin " );
158- _checkNonZeroAddress (_owner, "ZeroOwner " );
159- _checkNonZeroAddress (_stakerReward, "ZeroStakerReward " );
160- _checkNonZeroAddress (_operatorReward, "ZeroOperatorReward " );
146+ if (_network == address (0 )) {
147+ revert ZeroNetwork ();
148+ }
149+
150+ if (_operatorRegistry == address (0 )) {
151+ revert ZeroOperatorRegistry ();
152+ }
153+
154+ if (_vaultRegistry == address (0 )) {
155+ revert ZeroVaultRegistry ();
156+ }
157+
158+ if (_operatorNetOptin == address (0 )) {
159+ revert ZeroOperatorNetOptin ();
160+ }
161+
162+ if (_owner == address (0 )) {
163+ revert ZeroOwner ();
164+ }
165+
166+ if (_stakerReward == address (0 )) {
167+ revert ZeroStakerReward ();
168+ }
169+
170+ if (_operatorReward == address (0 )) {
171+ revert ZeroOperatorReward ();
172+ }
161173
162174 if (_slashingWindow < _epochDuration) {
163175 revert SlashingWindowTooShort ();
@@ -520,12 +532,6 @@ contract NetworkMiddleware is Initializable, SimpleKeyRegistry32, OwnableUpgrade
520532 return enabledTime != 0 && enabledTime <= timestamp && (disabledTime == 0 || disabledTime >= timestamp);
521533 }
522534
523- function _checkNonZeroAddress (address addr , string memory errorMessage ) private pure {
524- if (addr == address (0 )) {
525- revert (errorMessage);
526- }
527- }
528-
529535 function _slashVault (
530536 uint48 timestamp ,
531537 address vault ,
0 commit comments