Skip to content

Commit

Permalink
Code tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
kanewallmann committed Feb 11, 2025
1 parent db3a15e commit 85442a1
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
pragma solidity 0.7.6;

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "./RocketDAOProtocolSettings.sol";
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import "../../../../interface/network/RocketNetworkSnapshotsInterface.sol";

// Network auction settings
import {RocketStorageInterface} from "../../../../interface/RocketStorageInterface.sol";
import {RocketDAOProtocolSettings} from "./RocketDAOProtocolSettings.sol";
import {RocketDAOProtocolSettingsNodeInterface} from "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import {RocketNetworkSnapshotsInterface} from "../../../../interface/network/RocketNetworkSnapshotsInterface.sol";

/// @notice Network auction settings
contract RocketDAOProtocolSettingsNode is RocketDAOProtocolSettings, RocketDAOProtocolSettingsNodeInterface {

// Construct
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "./RocketDAOProtocolSettings.sol";
import "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol";
import {RocketStorageInterface} from "../../../../interface/RocketStorageInterface.sol";
import {RocketDAOProtocolSettings} from "./RocketDAOProtocolSettings.sol";
import {RocketDAOProtocolSettingsSecurityInterface} from "../../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol";

/// @notice Protocol parameters relating to the security council
contract RocketDAOProtocolSettingsSecurity is RocketDAOProtocolSettings, RocketDAOProtocolSettingsSecurityInterface {
Expand Down
23 changes: 12 additions & 11 deletions contracts/contract/dao/security/RocketDAOSecurityProposals.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../../../interface/RocketVaultInterface.sol";
import "../../../interface/dao/RocketDAOProposalInterface.sol";
import "../../../interface/dao/protocol/RocketDAOProtocolInterface.sol";
import "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol";
import "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNetworkInterface.sol";
import "../../../interface/dao/security/RocketDAOSecurityActionsInterface.sol";
import "../../../interface/dao/security/RocketDAOSecurityInterface.sol";
import "../../../interface/dao/security/RocketDAOSecurityProposalsInterface.sol";
import "../../../interface/network/RocketNetworkRevenuesInterface.sol";
import "../../../interface/util/IERC20Burnable.sol";
import "../../RocketBase.sol";
import {RocketBase} from "../../RocketBase.sol";
import {RocketStorageInterface} from "../../../interface/RocketStorageInterface.sol";
import {RocketVaultInterface} from "../../../interface/RocketVaultInterface.sol";
import {RocketDAOProposalInterface} from "../../../interface/dao/RocketDAOProposalInterface.sol";
import {RocketDAOProtocolInterface} from "../../../interface/dao/protocol/RocketDAOProtocolInterface.sol";
import {RocketDAOProtocolSettingsSecurityInterface} from "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsSecurityInterface.sol";
import {RocketDAOProtocolSettingsNetworkInterface} from "../../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNetworkInterface.sol";
import {RocketDAOSecurityActionsInterface} from "../../../interface/dao/security/RocketDAOSecurityActionsInterface.sol";
import {RocketDAOSecurityInterface} from "../../../interface/dao/security/RocketDAOSecurityInterface.sol";
import {RocketDAOSecurityProposalsInterface} from "../../../interface/dao/security/RocketDAOSecurityProposalsInterface.sol";
import {RocketNetworkRevenuesInterface} from "../../../interface/network/RocketNetworkRevenuesInterface.sol";
import {IERC20Burnable} from "../../../interface/util/IERC20Burnable.sol";

/// @notice Proposal contract for the security council
contract RocketDAOSecurityProposals is RocketBase, RocketDAOSecurityProposalsInterface {
Expand Down
3 changes: 1 addition & 2 deletions contracts/contract/deposit/RocketDepositPool.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../../interface/util/LinkedListStorageInterface.sol";
import {AddressQueueStorageInterface} from "../../interface/util/AddressQueueStorageInterface.sol";
import {LinkedListStorageInterface} from "../../interface/util/LinkedListStorageInterface.sol";
import {LinkedListStorageInterface, DepositQueueKey, DepositQueueValue} from "../../interface/util/LinkedListStorageInterface.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketDAOProtocolSettingsDepositInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol";
import {RocketDAOProtocolSettingsMinipoolInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
Expand Down
3 changes: 1 addition & 2 deletions contracts/contract/megapool/RocketMegapoolManager.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "./RocketMegapoolStorageLayout.sol";
import "./RocketMegapoolStorageLayout.sol";
import {RocketMegapoolStorageLayout} from "./RocketMegapoolStorageLayout.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketMegapoolInterface} from "../../interface/megapool/RocketMegapoolInterface.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
Expand Down
7 changes: 3 additions & 4 deletions contracts/contract/megapool/RocketMegapoolStorageLayout.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ abstract contract RocketMegapoolStorageLayout {
// Megapool state
//

address internal nodeAddress; // Megapool owner
uint32 internal numValidators; // Number of individual validators handled by this megapool
address internal nodeAddress; // Megapool owner
uint32 internal numValidators; // Number of individual validators handled by this megapool
uint32 internal numInactiveValidators; // Number of validators that are no longer contributing to bond requirement

uint256 internal assignedValue; // ETH assigned from DP pending prestake/stake
uint256 internal refundValue; // ETH refunded to the owner after a dissolution
Expand All @@ -76,6 +77,4 @@ abstract contract RocketMegapoolStorageLayout {

mapping(uint32 => ValidatorInfo) internal validators;
mapping(uint32 => PrestakeData) internal prestakeData;

uint32 internal numInactiveValidators; // Number of validators that are no longer contributing to bond requirement
}
3 changes: 2 additions & 1 deletion contracts/contract/network/RocketNetworkRevenues.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../RocketBase.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {RocketNetworkSnapshotsInterface} from "../../interface/network/RocketNetworkSnapshotsInterface.sol";
import {RocketNetworkRevenuesInterface} from "../../interface/network/RocketNetworkRevenuesInterface.sol";

Expand Down
7 changes: 4 additions & 3 deletions contracts/contract/network/RocketNetworkSnapshots.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// Adapted from OpenZeppelin `Checkpoints` contract
pragma solidity 0.8.18;

import "@openzeppelin4/contracts/utils/math/Math.sol";
import {Math} from "@openzeppelin4/contracts/utils/math/Math.sol";

import "../RocketBase.sol";
import "../../interface/network/RocketNetworkSnapshotsInterface.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {RocketNetworkSnapshotsInterface, Checkpoint224} from "../../interface/network/RocketNetworkSnapshotsInterface.sol";

/// @notice Accounting for snapshotting of values based on block numbers
contract RocketNetworkSnapshots is RocketBase, RocketNetworkSnapshotsInterface {
Expand Down
28 changes: 14 additions & 14 deletions contracts/contract/node/RocketNodeDeposit.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../../interface/RocketStorageInterface.sol";
import "../../interface/RocketVaultInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import "../../interface/deposit/RocketDepositPoolInterface.sol";
import "../../interface/megapool/RocketMegapoolFactoryInterface.sol";
import "../../interface/megapool/RocketMegapoolInterface.sol";
import "../../interface/network/RocketNetworkFeesInterface.sol";
import "../../interface/network/RocketNetworkVotingInterface.sol";
import "../../interface/network/RocketNetworkSnapshotsInterface.sol";
import "../../interface/node/RocketNodeDepositInterface.sol";
import "../../interface/node/RocketNodeManagerInterface.sol";
import "../../interface/node/RocketNodeStakingInterface.sol";
import "../RocketBase.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {RocketVaultInterface} from "../../interface/RocketVaultInterface.sol";
import {RocketDAOProtocolSettingsMinipoolInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsMinipoolInterface.sol";
import {RocketDAOProtocolSettingsNodeInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import {RocketDepositPoolInterface} from "../../interface/deposit/RocketDepositPoolInterface.sol";
import {RocketMegapoolFactoryInterface} from "../../interface/megapool/RocketMegapoolFactoryInterface.sol";
import {RocketMegapoolInterface} from "../../interface/megapool/RocketMegapoolInterface.sol";
import {RocketNetworkFeesInterface} from "../../interface/network/RocketNetworkFeesInterface.sol";
import {RocketNetworkVotingInterface} from "../../interface/network/RocketNetworkVotingInterface.sol";
import {RocketNetworkSnapshotsInterface} from "../../interface/network/RocketNetworkSnapshotsInterface.sol";
import {RocketNodeDepositInterface} from "../../interface/node/RocketNodeDepositInterface.sol";
import {RocketNodeManagerInterface} from "../../interface/node/RocketNodeManagerInterface.sol";
import {RocketNodeStakingInterface} from "../../interface/node/RocketNodeStakingInterface.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketMegapoolManagerInterface} from "../../interface/megapool/RocketMegapoolManagerInterface.sol";
import {RocketVaultWithdrawerInterface} from "../../interface/RocketVaultWithdrawerInterface.sol";

Expand Down
4 changes: 2 additions & 2 deletions contracts/contract/node/RocketNodeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity 0.8.18;
pragma abicoder v2;

import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol";
import "../../types/MinipoolStatus.sol";
import {RocketDAOProtocolSettingsDepositInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsDepositInterface.sol";
import {MinipoolStatus} from "../../types/MinipoolStatus.sol";
import {AddressSetStorageInterface} from "../../interface/util/AddressSetStorageInterface.sol";
import {IERC20} from "../../interface/util/IERC20.sol";
import {NodeDetails} from "../../types/NodeDetails.sol";
Expand Down
5 changes: 3 additions & 2 deletions contracts/contract/rewards/RocketVoterRewards.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../../interface/RocketVaultInterface.sol";
import "../RocketBase.sol";
import {RocketBase} from "../RocketBase.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {RocketVaultInterface} from "../../interface/RocketVaultInterface.sol";
import {RocketVoterRewardsInterface} from "../../interface/rewards/RocketVoterRewardsInterface.sol";

/// @notice Holding contract for voter's share of ETH rewards until implementation details are resolved
Expand Down
20 changes: 7 additions & 13 deletions contracts/contract/upgrade/RocketUpgradeOneDotFour.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;

import "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNodeInterface.sol";
import "../../interface/megapool/RocketMegapoolFactoryInterface.sol";
import "../../interface/minipool/RocketMinipoolManagerInterface.sol";
import "../../interface/network/RocketNetworkPricesInterface.sol";
import "../../interface/network/RocketNetworkRevenuesInterface.sol";
import "../../interface/network/RocketNetworkSnapshotsInterface.sol";
import "../../interface/util/AddressSetStorageInterface.sol";
import "../RocketBase.sol";
import {RocketDAOProtocolSettingsNetworkInterface} from "../../interface/dao/protocol/settings/RocketDAOProtocolSettingsNetworkInterface.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {RocketNetworkRevenuesInterface} from "../../interface/network/RocketNetworkRevenuesInterface.sol";
import {RocketBase} from "../RocketBase.sol";

interface InitialiseInterface {
function initialise() external;
Expand Down Expand Up @@ -184,10 +178,10 @@ contract RocketUpgradeOneDotFour is RocketBase {

// Initialise UARS setting defaults per RPIP-46
settingNameSpace = keccak256(abi.encodePacked("dao.protocol.setting.", "network"));
setUint(keccak256(abi.encodePacked(settingNameSpace,"network.node.commission.share")), 0.05 ether); // 5% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace,"network.node.commission.share.security.council.adder")), 0 ether); // 0% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace,"network.voter.share")), 0.09 ether); // 9% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace,"network.max.node.commission.share.council.adder")), 0.01 ether); // 1% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace, "network.node.commission.share")), 0.05 ether); // 5% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace, "network.node.commission.share.security.council.adder")), 0 ether); // 0% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace, "network.voter.share")), 0.09 ether); // 9% (RPIP-46)
setUint(keccak256(abi.encodePacked(settingNameSpace, "network.max.node.commission.share.council.adder")), 0.01 ether); // 1% (RPIP-46)

// Initialise UARS system
RocketNetworkRevenuesInterface rocketNetworkRevenuesInstance = RocketNetworkRevenuesInterface(rocketNetworkRevenues);
Expand Down
2 changes: 1 addition & 1 deletion contracts/contract/util/BeaconStateVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {RocketBase} from "../RocketBase.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {SSZ} from "./SSZ.sol";
import {BlockRootsInterface} from "../../interface/util/BlockRootsInterface.sol";
import "../../interface/util/BeaconStateVerifierInterface.sol";
import {BeaconStateVerifierInterface, ValidatorProof, Withdrawal} from "../../interface/util/BeaconStateVerifierInterface.sol";

contract BeaconStateVerifier is RocketBase, BeaconStateVerifierInterface {
// TODO: Decide how to supply these required beacon chain constants
Expand Down
4 changes: 3 additions & 1 deletion contracts/contract/util/LinkedListStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ contract LinkedListStorage is RocketBase, LinkedListStorageInterface {
}

/// @notice Returns the supplied number of entries starting at the supplied index
/// @param _namespace The namespace of the linked list to scan
/// @param _start The index to start from, or 0 to start from the start of the first item in the list
/// @param _count The maximum number of items to return
function scan(bytes32 _namespace, uint256 _start, uint256 _count) override external view returns (DepositQueueValue[] memory entries, uint256 nextIndex) {
entries = new DepositQueueValue[](_count);
nextIndex = _start;
Expand All @@ -258,5 +261,4 @@ contract LinkedListStorage is RocketBase, LinkedListStorageInterface {

return (entries, nextIndex);
}

}
6 changes: 3 additions & 3 deletions contracts/contract/util/LinkedListStorageHelper.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.18;
pragma abicoder v2;

// SPDX-License-Identifier: GPL-3.0-only

import "./LinkedListStorage.sol";
import {RocketStorageInterface} from "../../interface/RocketStorageInterface.sol";
import {LinkedListStorage, DepositQueueValue, DepositQueueKey} from "./LinkedListStorage.sol";

/// @notice A linked list storage helper to test internal functions
contract LinkedListStorageHelper is LinkedListStorage {
Expand Down
3 changes: 1 addition & 2 deletions contracts/interface/RocketStorageInterface.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pragma solidity >0.5.0 <0.9.0;

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >0.5.0 <0.9.0;

interface RocketStorageInterface {

Expand Down
3 changes: 1 addition & 2 deletions contracts/interface/util/LinkedListStorageInterface.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >0.5.0 <0.9.0;
pragma abicoder v2;

// SPDX-License-Identifier: GPL-3.0-only

struct DepositQueueValue {
address receiver; // the address that will receive the requested value
uint32 validatorId; // internal validator id
Expand Down

0 comments on commit 85442a1

Please sign in to comment.