Conversation
…d add basic tests
eddort
marked this pull request as draft
July 17, 2026 15:03
Hardhat Unit Tests Coverage SummaryDetailsDiff against masterResults for commit: d016fdd Minimum allowed coverage is ♻️ This comment has been updated with latest results |
| } | ||
|
|
||
| function oracleMappingsCount() external view returns (uint256 count) { | ||
| for (uint256 i = 0; i < _oracleCommittees.length; ++i) { |
| } | ||
|
|
||
| function isConfiguredDelegationContract(address candidate) public view returns (bool) { | ||
| for (uint256 i = 0; i < _delegationContracts.length; ++i) { |
Comment on lines
+161
to
+182
| function _validateOldDSM(EDFUpgradeConfig config) internal view { | ||
| IEDFDepositSecurityModule oldDSM = IEDFDepositSecurityModule(config.OLD_DEPOSIT_SECURITY_MODULE()); | ||
| _assertUint("old-dsm-version", oldDSM.VERSION(), config.OLD_DEPOSIT_SECURITY_MODULE_VERSION()); | ||
| _assertAddress("old-dsm-owner", oldDSM.getOwner(), config.AGENT()); | ||
| _assertAddress("old-dsm-staking-router", oldDSM.STAKING_ROUTER(), config.STAKING_ROUTER()); | ||
| _assertUint( | ||
| "old-dsm-pause-validity", | ||
| oldDSM.getPauseIntentValidityPeriodBlocks(), | ||
| config.PAUSE_INTENT_VALIDITY_PERIOD_BLOCKS() | ||
| ); | ||
| _assertUint("old-dsm-max-unvetting", oldDSM.getMaxOperatorsPerUnvetting(), config.MAX_OPERATORS_PER_UNVETTING()); | ||
| _assertUint("old-dsm-quorum", oldDSM.getGuardianQuorum(), config.GUARDIAN_QUORUM()); | ||
| if (oldDSM.isDepositsPaused()) revert InvalidFlag("old-dsm-paused", address(oldDSM)); | ||
|
|
||
| address[] memory guardians = oldDSM.getGuardians(); | ||
| uint256 guardiansCount = config.guardiansCount(); | ||
| if (guardians.length != guardiansCount) revert InvalidMembers(address(oldDSM)); | ||
| for (uint256 i = 0; i < guardiansCount; ++i) { | ||
| (address oldGuardian,) = config.guardianMapping(i); | ||
| if (!oldDSM.isGuardian(oldGuardian)) revert InvalidMembers(address(oldDSM)); | ||
| } | ||
| } |
Comment on lines
+265
to
+292
| function _validateOracleCommittees(EDFUpgradeConfig config, bool finalState) internal view { | ||
| uint256 committeesCount = config.oracleCommitteesCount(); | ||
| for (uint256 i = 0; i < committeesCount; ++i) { | ||
| (address consensusAddress, uint256 quorum) = config.oracleCommittee(i); | ||
| IEDFHashConsensus consensus = IEDFHashConsensus(consensusAddress); | ||
| (address[] memory members,) = consensus.getMembers(); | ||
| uint256 mappingsCount = config.oracleCommitteeMappingsCount(i); | ||
| if (members.length != mappingsCount || consensus.getQuorum() != quorum) { | ||
| revert InvalidMembers(consensusAddress); | ||
| } | ||
|
|
||
| if (!finalState) { | ||
| (, bytes32 consensusReport, bool isReportProcessing) = consensus.getConsensusState(); | ||
| if (consensusReport != bytes32(0) || isReportProcessing) { | ||
| revert UnsafeConsensusState(consensusAddress); | ||
| } | ||
| } | ||
|
|
||
| for (uint256 j = 0; j < mappingsCount; ++j) { | ||
| (address oldMember, address newMember) = config.oracleCommitteeMapping(i, j); | ||
| address expectedMember = finalState ? newMember : oldMember; | ||
| address unexpectedMember = finalState ? oldMember : newMember; | ||
| if (!consensus.getIsMember(expectedMember) || consensus.getIsMember(unexpectedMember)) { | ||
| revert InvalidMembers(consensusAddress); | ||
| } | ||
| } | ||
| } | ||
| } |
Comment on lines
+63
to
+75
| function getVoteItems() public view override returns (VoteItem[] memory items) { | ||
| VoteItem[] memory rawItems = _getVoteItems(); | ||
| CallsScriptBuilder.Context memory scriptBuilder = CallsScriptBuilder.create(); | ||
| for (uint256 i = 0; i < rawItems.length; ++i) { | ||
| scriptBuilder.addCall(rawItems[i].call.to, rawItems[i].call.data); | ||
| } | ||
|
|
||
| items = new VoteItem[](DG_ITEMS_COUNT); | ||
| items[0] = VoteItem({ | ||
| description: "1. Submit the EDF/DSM v5 upgrade to Dual Governance", | ||
| call: _votingCall(AGENT, abi.encodeCall(IForwarder.forward, (scriptBuilder.getResult()))) | ||
| }); | ||
| } |
| EDFUpgradeConfig config = EDFUpgradeConfig(CONFIG); | ||
| uint256 expectedCount = rawActionsCount(); | ||
| items = new VoteItem[](expectedCount); | ||
| uint256 itemIndex; |
F4ever
reviewed
Jul 31, 2026
Member
|
DSM.sol LGTM |
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.
No description provided.