Open
Conversation
| } | ||
| isPoolThresholdValid(_poolId); | ||
| uint256 sdToSlash = convertETHToSD(poolThresholdbyPoolId[_poolId].minThreshold); | ||
| for (uint8 i; i < operatorIds.length; i++) { |
There was a problem hiding this comment.
gas optimization: use uint256 for i instead of uint8. use temporary variable for operatorIds.length and use it.
Suggested change
| for (uint8 i; i < operatorIds.length; i++) { | |
| uint256 numOperatorIds = operatorIds.length; | |
| for (uint256 i; i < numOperatorIds; ++i) { |
if you don't much care about the readability, you can move ++i to the end of the loop and put it to unchecked block.
| import '../../../library/ValidatorStatus.sol'; | ||
|
|
||
| struct SSVOperator { | ||
| bool operatorType; // 0 for permissionless and 1 for permissioned |
There was a problem hiding this comment.
nit: true or false instead of 1 or 0.
Comment on lines
+8
to
+16
| struct SSVOperator { | ||
| bool operatorType; // 0 for permissionless and 1 for permissioned | ||
| string operatorName; // name of the operator | ||
| address payable operatorRewardAddress; //Eth1 address of node for reward | ||
| address operatorAddress; // address of operator to interact with stader | ||
| uint64 operatorSSVID; // operator ID on SSV Network | ||
| uint64 keyShareCount; // count of key-share operator is running | ||
| uint256 bondAmount; // amount of ETH bond for new key shares | ||
| } |
There was a problem hiding this comment.
Suggested change
| struct SSVOperator { | |
| bool operatorType; // 0 for permissionless and 1 for permissioned | |
| string operatorName; // name of the operator | |
| address payable operatorRewardAddress; //Eth1 address of node for reward | |
| address operatorAddress; // address of operator to interact with stader | |
| uint64 operatorSSVID; // operator ID on SSV Network | |
| uint64 keyShareCount; // count of key-share operator is running | |
| uint256 bondAmount; // amount of ETH bond for new key shares | |
| } | |
| /// @param operatorType false for permissionless and true for permissioned | |
| /// @param operatorName Name of the operator | |
| /// @param operatorRewardAddress Eth1 address of node for reward | |
| /// @param operatorAddress Address of operator to interact with stader | |
| /// @param operatorSSVID Operator ID on SSV Network | |
| /// @param keyShareCount Count of key-share operator is running | |
| /// @param bondAmount Amount of ETH bond for new key shares | |
| struct SSVOperator { | |
| bool operatorType; | |
| string operatorName; | |
| address payable operatorRewardAddress; | |
| address operatorAddress; | |
| uint64 operatorSSVID; | |
| uint64 keyShareCount; | |
| uint256 bondAmount; | |
| } |
| struct SSVOperator { | ||
| bool operatorType; // 0 for permissionless and 1 for permissioned | ||
| string operatorName; // name of the operator | ||
| address payable operatorRewardAddress; //Eth1 address of node for reward |
|
|
||
| function fullDepositOnBeaconChain(bytes[] calldata _pubkey) external; | ||
|
|
||
| //Getters |
| event UpdatedOwner(address owner); | ||
| event UpdatedStaderConfig(address staderConfig); | ||
|
|
||
| //Getters |
|
|
||
| function staderConfig() external view returns (IStaderConfig); | ||
|
|
||
| //Setters |
| // Distribute rewards | ||
| uint64[] memory operatorIds = nodeRegistry.getOperatorsIdsForValidatorId(validatorId); | ||
| uint256 totalOperators = operatorIds.length; | ||
| for (uint8 i; i < totalOperators; ) { |
There was a problem hiding this comment.
gas optimization: use uint256 instead of uint8 for i
| IPenalty(staderConfig.getPenaltyContract()).markValidatorSettled(poolId, validatorId); | ||
| IStaderStakePoolManager(staderConfig.getStakePoolManager()).receiveWithdrawVaultUserShare{value: userShare}(); | ||
| UtilLib.sendValue(payable(staderConfig.getStaderTreasury()), protocolShare); | ||
| for (uint8 i; i < totalOperators; i++) { |
There was a problem hiding this comment.
gas optimization: same here, uint256
added 2 commits
September 14, 2023 09:34
…n on SSV while doing full deposit
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding new SSV Pool under DVT section, following are the big changes