diff --git a/src/v0.8/core/filplus/Filplus.sol b/src/v0.8/core/filplus/Filplus.sol index 213135ba..dc132d8d 100644 --- a/src/v0.8/core/filplus/Filplus.sol +++ b/src/v0.8/core/filplus/Filplus.sol @@ -523,7 +523,7 @@ contract Filplus is Initializable, UUPSUpgradeable, IFilplus, RolesModifiers { } ///@notice Returns the election time for auditors. - function auditorsElectionTime() external view returns (uint64) { + function datasetRuleAuditorsElectionTime() external view returns (uint64) { return rules.datasetRuleAuditorsElectionTime; } diff --git a/src/v0.8/core/finance/escrow/EscrowChallengeAuditCollateral.sol b/src/v0.8/core/finance/escrow/EscrowChallengeAuditCollateral.sol index d3a20d05..99142d56 100644 --- a/src/v0.8/core/finance/escrow/EscrowChallengeAuditCollateral.sol +++ b/src/v0.8/core/finance/escrow/EscrowChallengeAuditCollateral.sol @@ -38,7 +38,13 @@ contract EscrowChallengeAuditCollateral is EscrowBase { uint64 _matchingId, address _payer, address _token - ) public view override onlyRole(roles, RolesType.DATASWAP_CONTRACT) returns (uint256 amount) { + ) + public + view + override + onlyRole(roles, RolesType.DATASWAP_CONTRACT) + returns (uint256 amount) + { (, , uint256 current, ) = roles.finance().getAccountEscrow( _datasetId, _matchingId, @@ -93,7 +99,7 @@ contract EscrowChallengeAuditCollateral is EscrowBase { _payer, _token, FinanceType.Type.EscrowChallengeAuditCollateral - ); + ); } /// @dev Internal function to get payment amount. @@ -114,7 +120,7 @@ contract EscrowChallengeAuditCollateral is EscrowBase { _payer, _token, FinanceType.Type.EscrowChallengeAuditCollateral - ); + ); } /// @dev Internal function to check if a refund is applicable. @@ -124,9 +130,15 @@ contract EscrowChallengeAuditCollateral is EscrowBase { uint64 _datasetId, uint64 /*_matchingId*/ ) internal view override returns (bool refund) { - //TODO: refund when reject without dispute - // return (roles.datasets().getDatasetState(_datasetId) == - // DatasetType.State.Approved); + DatasetType.State state = roles.datasets().getDatasetState(_datasetId); + if ( + state == DatasetType.State.Approved || + state == DatasetType.State.Rejected + ) { + return true; + } else { + //TODO: refund when reject without dispute + } } /// @dev Internal function to check if a payment is applicable. diff --git a/src/v0.8/interfaces/core/IFilplus.sol b/src/v0.8/interfaces/core/IFilplus.sol index 81e6efb6..e40febc1 100644 --- a/src/v0.8/interfaces/core/IFilplus.sol +++ b/src/v0.8/interfaces/core/IFilplus.sol @@ -240,7 +240,7 @@ interface IFilplus { returns (uint8); ///@notice Returns the election time for auditors. - function auditorsElectionTime() external view returns (uint64); + function datasetRuleAuditorsElectionTime() external view returns (uint64); /// @notice Check if the storage area complies with filplus rules. function isCompliantRuleGeolocation( diff --git a/src/v0.8/interfaces/module/IDatasetsChallenge.sol b/src/v0.8/interfaces/module/IDatasetsChallenge.sol index a9c89772..93b129ce 100644 --- a/src/v0.8/interfaces/module/IDatasetsChallenge.sol +++ b/src/v0.8/interfaces/module/IDatasetsChallenge.sol @@ -88,13 +88,12 @@ interface IDatasetsChallenge { uint64 _datasetId ) external view returns (uint64); - ///@notice Retrieves sorted auditor candidates for a specific dataset. - ///@dev Retrieves a list of auditor candidates sorted based on certain criteria. - ///@param _datasetId The ID of the dataset for which auditor candidates are retrieved. - ///@return candidates An array containing the addresses of the sorted auditor candidates. - function getSortedAuditorCandidates( + /// @dev Retrieves auditor candidates for a given dataset ID. + /// @param _datasetId The ID of the dataset for which auditor candidates are requested. + /// @return candidates An array containing addresses of auditor candidates. + function getDatasetAuditorCandidates( uint64 _datasetId - ) external returns (address[] memory candidates); + ) external view returns (address[] memory candidates); /// @notice Retrieves the end height of the auditor election for a specific dataset. /// @dev Retrieves the block height at which the auditor election for the specified dataset ends. @@ -104,6 +103,22 @@ interface IDatasetsChallenge { uint64 _datasetId ) external view returns (uint64); + /// @notice Retrieves the required collateral for challenge audits. + /// @return The amount of collateral required for challenge audits. + function getChallengeAuditCollateralRequirement() + external + view + returns (uint256); + + /// @dev Checks whether the given account is a winner for a specific dataset ID. + /// @param _datasetId The ID of the dataset being checked. + /// @param _account The address of the account being checked for winner status. + /// @return A boolean indicating whether the account is a winner for the dataset ID. + function isWinner( + uint64 _datasetId, + address _account + ) external returns (bool); + /// @notice Get the Roles contract. /// @return Roles contract address. function roles() external view returns (IRoles); diff --git a/src/v0.8/module/dataset/Datasets.sol b/src/v0.8/module/dataset/Datasets.sol index 8f33acbc..e641b336 100644 --- a/src/v0.8/module/dataset/Datasets.sol +++ b/src/v0.8/module/dataset/Datasets.sol @@ -88,6 +88,23 @@ contract Datasets is return _getImplementation(); } + /// @dev Claims the dataset escrow for a given dataset ID. + /// @param _datasetId The ID of the dataset for which the escrow is being claimed. + function _claimDatasetEscrow(uint64 _datasetId) internal { + roles.finance().claimEscrow( + _datasetId, + 0, + FinanceType.FIL, + FinanceType.Type.EscrowChallengeCommission + ); + roles.finance().claimEscrow( + _datasetId, + 0, + FinanceType.FIL, + FinanceType.Type.EscrowChallengeAuditCollateral + ); + } + ///@notice Approve a dataset. ///@dev This function changes the state of the dataset to Approved and emits the DatasetApproved event. function __approveDataset( @@ -114,13 +131,7 @@ contract Datasets is dataset._emitDatasetEvent(DatasetType.Event.Approved); - // Payment challenge commission - roles.finance().claimEscrow( - _datasetId, - 0, - FinanceType.FIL, - FinanceType.Type.EscrowChallengeCommission - ); + _claimDatasetEscrow(_datasetId); emit DatasetsEvents.DatasetApproved(_datasetId); } @@ -139,12 +150,7 @@ contract Datasets is dataset._emitDatasetEvent(DatasetType.Event.Rejected); - roles.finance().claimEscrow( - _datasetId, - 0, - FinanceType.FIL, - FinanceType.Type.EscrowChallengeCommission - ); + _claimDatasetEscrow(_datasetId); uint64 mappingSize = roles.datasetsProof().getDatasetSize( _datasetId, @@ -438,12 +444,7 @@ contract Datasets is DatasetType.Dataset storage dataset = datasets[_datasetId]; dataset._emitDatasetEvent(DatasetType.Event.WorkflowTimeout); - roles.finance().claimEscrow( - _datasetId, - 0, - FinanceType.FIL, - FinanceType.Type.EscrowChallengeCommission - ); + _claimDatasetEscrow(_datasetId); uint64 mappingSize = roles.datasetsProof().getDatasetSize( _datasetId, diff --git a/src/v0.8/module/dataset/DatasetsChallenge.sol b/src/v0.8/module/dataset/DatasetsChallenge.sol index 3d44c28d..c9e59e51 100644 --- a/src/v0.8/module/dataset/DatasetsChallenge.sol +++ b/src/v0.8/module/dataset/DatasetsChallenge.sol @@ -27,10 +27,12 @@ import {DatasetsEvents} from "src/v0.8/shared/events/DatasetsEvents.sol"; import {DatasetsModifiers} from "src/v0.8/shared/modifiers/DatasetsModifiers.sol"; /// library import {DatasetChallengeProofLIB} from "src/v0.8/module/dataset/library/challenge/DatasetChallengeProofLIB.sol"; +import {DatasetAuditorElectionLIB} from "src/v0.8/module/dataset/library/challenge/DatasetAuditorElectionLIB.sol"; /// type import {RolesType} from "src/v0.8/types/RolesType.sol"; import {DatasetType} from "src/v0.8/types/DatasetType.sol"; +import {FinanceType} from "src/v0.8/types/FinanceType.sol"; import {GeolocationType} from "src/v0.8/types/GeolocationType.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; @@ -46,6 +48,8 @@ contract DatasetsChallenge is DatasetsModifiers { using DatasetChallengeProofLIB for DatasetType.DatasetChallengeProof; + using DatasetAuditorElectionLIB for DatasetType.DatasetAuditorElection; + mapping(uint64 => DatasetType.DatasetChallengeProof) private datasetChallengeProofs; // Mapping of dataset ID to dataset details @@ -84,7 +88,29 @@ contract DatasetsChallenge is /// @dev Allows auditors to stake tokens for a specific dataset. /// @param _datasetId The ID of the dataset for which auditors are staking tokens. /// @param _amount The amount of tokens to stake. - function auditorStake(uint64 _datasetId, uint256 _amount) external {} + function auditorStake(uint64 _datasetId, uint256 _amount) external { + require( + uint64(block.number) < getAuditorElectionEndHeight(_datasetId), + "auditors election timeout" + ); + + roles.finance().__escrow( + _datasetId, + 0, + msg.sender, + FinanceType.FIL, + FinanceType.Type.EscrowChallengeAuditCollateral, + _amount + ); + + DatasetType.DatasetChallengeProof + storage datasetChallengeProof = datasetChallengeProofs[_datasetId]; + datasetChallengeProof.election._stake( + roles, + _datasetId, + FinanceType.FIL + ); + } ///@notice Submit challenge proof for a dataset /// Based on merkle proof challenge. @@ -107,6 +133,9 @@ contract DatasetsChallenge is roles.datasets().__reportDatasetWorkflowTimeout(_datasetId); return; } + + require(isWinner(_datasetId, msg.sender), "Not an election winner"); + DatasetType.DatasetChallengeProof storage datasetChallengeProof = datasetChallengeProofs[_datasetId]; require( @@ -310,13 +339,17 @@ contract DatasetsChallenge is )[0]; } - ///@notice Retrieves sorted auditor candidates for a specific dataset. - ///@dev Retrieves a list of auditor candidates sorted based on certain criteria. - ///@param _datasetId The ID of the dataset for which auditor candidates are retrieved. - ///@return candidates An array containing the addresses of the sorted auditor candidates. - function getSortedAuditorCandidates( + /// @dev Retrieves auditor candidates for a given dataset ID. + /// @param _datasetId The ID of the dataset for which auditor candidates are requested. + /// @return candidates An array containing addresses of auditor candidates. + function getDatasetAuditorCandidates( uint64 _datasetId - ) external returns (address[] memory candidates) {} + ) external view returns (address[] memory candidates) { + DatasetType.DatasetChallengeProof + storage datasetChallengeProof = datasetChallengeProofs[_datasetId]; + + candidates = datasetChallengeProof.election.candidates; + } /// @notice Retrieves the end height of the auditor election for a specific dataset. /// @dev Retrieves the block height at which the auditor election for the specified dataset ends. @@ -324,5 +357,50 @@ contract DatasetsChallenge is /// @return The end height of the auditor election. function getAuditorElectionEndHeight( uint64 _datasetId - ) public view returns (uint64) {} + ) public view returns (uint64) { + uint64 proofCompleteHeight = roles + .datasetsProof() + .getDatasetProofCompleteHeight(_datasetId); + + return + proofCompleteHeight + + roles.filplus().datasetRuleAuditorsElectionTime(); + } + + /// @dev Retrieves the required collateral for challenge audits. + /// @return The amount of collateral required for challenge audits. + function getChallengeAuditCollateralRequirement() + public + view + returns (uint256) + { + return + DatasetAuditorElectionLIB._getChallengeAuditCollateralRequirement( + roles + ); + } + + /// @dev Checks whether the given account is a winner for a specific dataset ID. + /// @param _datasetId The ID of the dataset being checked. + /// @param _account The address of the account being checked for winner status. + /// @return A boolean indicating whether the account is a winner for the dataset ID. + function isWinner( + uint64 _datasetId, + address _account + ) public returns (bool) { + require( + uint64(block.number) >= getAuditorElectionEndHeight(_datasetId), + "auditor election not completed" + ); + + DatasetType.DatasetChallengeProof + storage datasetChallengeProof = datasetChallengeProofs[_datasetId]; + + return + datasetChallengeProof.election._processTicketResult( + getAuditorElectionEndHeight(_datasetId), + _account, + getChallengeSubmissionCount(_datasetId) + ); + } } diff --git a/src/v0.8/module/dataset/library/challenge/DatasetAuditorElectionLIB.sol b/src/v0.8/module/dataset/library/challenge/DatasetAuditorElectionLIB.sol index 3b62df03..54065f6a 100644 --- a/src/v0.8/module/dataset/library/challenge/DatasetAuditorElectionLIB.sol +++ b/src/v0.8/module/dataset/library/challenge/DatasetAuditorElectionLIB.sol @@ -18,15 +18,16 @@ pragma solidity ^0.8.21; import {IRoles} from "src/v0.8/interfaces/core/IRoles.sol"; import {FinanceType} from "src/v0.8/types/FinanceType.sol"; +import {DatasetType} from "src/v0.8/types/DatasetType.sol"; -contract DatasetAuditorElectionLIB { +library DatasetAuditorElectionLIB { ///@notice Internal function to stake tokens. - ///@param _candidates The storage array to store candidate addresses. + ///@param self The storage to store candidate. ///@param _roles The contract instance of IRoles. ///@param _datasetId The ID of the dataset. ///@param _token The address of the token to stake. function _stake( - address[] storage _candidates, + DatasetType.DatasetAuditorElection storage self, IRoles _roles, uint64 _datasetId, address _token @@ -40,78 +41,111 @@ contract DatasetAuditorElectionLIB { ); require( - escrow >= _roles.filplus().getProofAuditFee(), - "auditor escrow invalid" + escrow >= _getChallengeAuditCollateralRequirement(_roles), + "auditor escrow value invalid" ); // Add or update candidate bool isNewCandidate = true; - for (uint256 i = 0; i < _candidates.length; i++) { - if (_candidates[i] == msg.sender) { + for (uint256 i = 0; i < self.candidates.length; i++) { + if (self.candidates[i] == msg.sender) { isNewCandidate = false; break; } } if (isNewCandidate) { - _candidates.push(msg.sender); + self.candidates.push(msg.sender); } } - ///@notice Internal function to elect winners based on staked amounts. - ///@param _candidates The storage array containing candidate addresses. - ///@param _roles The contract instance of IRoles. - ///@param _datasetId The ID of the dataset. - ///@param _token The address of the token used for staking. - ///@param _numWinners The number of winners to be elected. - ///@return winners An array containing the addresses of the elected winners. - function _electWinners( - address[] storage _candidates, - IRoles _roles, - uint64 _datasetId, - address _token, + /// @dev Internal function to retrieve the block hash at a specific height. + /// @param _height The target block height to retrieve the hash for. + /// @return _hash The block hash at the specified height. + function _getBlockHashBaseHeight( + uint64 _height + ) internal view returns (bytes32 _hash) { + uint64 currentHeight = uint64(block.number); + uint64 _targetHeight; + + // If the difference between current height and specified height is less than 256, + // set target height to the specified height. + if (currentHeight - _height < 256) { + _targetHeight = _height; + } else { + // Otherwise, set targetHeight to the nearest higher multiple of 256 from _height + _targetHeight = _height + ((currentHeight - _height) / 256) * 256; + } + + // Retrieve the block hash at the target height + _hash = blockhash(uint32(_targetHeight)); + } + + /// @dev Internal function to retrieve the block hash at a specified height. + /// @param self The storage reference to the dataset auditor candidate. + /// @param _height The target block height to retrieve the hash for. + /// @return blockHash The block hash at the specified height. + function _electSeed( + DatasetType.DatasetAuditorElection storage self, + uint64 _height + ) internal returns (bytes32) { + if (self.seed == bytes32(0)) { + self.seed = _getBlockHashBaseHeight(_height); + } + return self.seed; + } + + /// @dev Internal function to process the ticket result. + /// @param self The storage reference to the dataset auditor candidate. + /// @param _height The target block height. + /// @param _account The account address. + /// @param _numWinners The number of winners to be selected. + /// @return success A boolean indicating whether the ticket result is successfully processed. + function _processTicketResult( + DatasetType.DatasetAuditorElection storage self, + uint64 _height, + address _account, uint256 _numWinners - ) internal returns (address[] memory winners) { + ) internal returns (bool) { require( - _numWinners > 0 && _numWinners <= _candidates.length, - "Invalid number of winners" + _numWinners <= self.candidates.length, + "The number of candidates is insufficient" ); + bytes32 _seed = _electSeed(self, _height); + + bytes32[] memory weights = new bytes32[](self.candidates.length); + + for (uint256 i = 0; i < self.candidates.length; i++) { + weights[i] = keccak256(abi.encodePacked(_seed, self.candidates[i])); + } - winners = new address[](_numWinners); - - // Sort candidates by staked amount - for (uint256 i = 0; i < _candidates.length - 1; i++) { - for (uint256 j = 0; j < _candidates.length - i - 1; j++) { - (, , uint256 jEscrow, ) = _roles.finance().getAccountEscrow( - _datasetId, - 0, - _candidates[j], - _token, - FinanceType.Type.EscrowChallengeAuditCollateral - ); - (, , uint256 iEscrow, ) = _roles.finance().getAccountEscrow( - _datasetId, - 0, - _candidates[i], - _token, - FinanceType.Type.EscrowChallengeAuditCollateral - ); - - if (jEscrow < iEscrow) { - (_candidates[j], _candidates[j + 1]) = ( - _candidates[j + 1], - _candidates[j] - ); + for (uint256 i = 0; i < _numWinners; i++) { + bytes32 maxWeight = 0; + uint256 maxIndex = 0; + + for (uint256 j = 0; j < self.candidates.length; j++) { + if (weights[j] > maxWeight) { + maxWeight = weights[j]; + maxIndex = j; } } - } - for (uint256 i = 0; i < winners.length; i++) { - winners[i] = _candidates[i]; + if (self.candidates[maxIndex] == _account) { + return true; + } + + weights[maxIndex] = 0; } - return winners; + return false; } - function isElectionFailed() internal returns (bool) {} + /// @dev Retrieves the required collateral for challenge audits. + /// @param _roles The Roles contract instance. + /// @return The amount of collateral required for challenge audits. + function _getChallengeAuditCollateralRequirement( + IRoles _roles + ) internal view returns (uint256) { + return _roles.filplus().getProofAuditFee() * 3; + } } diff --git a/src/v0.8/types/DatasetType.sol b/src/v0.8/types/DatasetType.sol index 8a301a6a..1f1e8ff7 100644 --- a/src/v0.8/types/DatasetType.sol +++ b/src/v0.8/types/DatasetType.sol @@ -107,12 +107,17 @@ library DatasetType { Challenge[] challenges; // Merkle proof provided by the auditor to support their challenge. } + struct DatasetAuditorElection { + address[] candidates; // Records of candidates of auditors. + bytes32 seed; + } + struct DatasetChallengeProof { // challenges uint16 challengesCount; mapping(address => ChallengeProof) challengeProofs; // Address of the auditor who submits challenges. address[] auditors; // Records of auditors submitting verifications. - address[] candidates; // Records of candidates of auditors. + DatasetAuditorElection election; // Records of election of auditors. } /// @notice The struct describes the storage requirements specified by the client. diff --git a/test/v0.8/helpers/module/dataset/DatasetsHelpers.sol b/test/v0.8/helpers/module/dataset/DatasetsHelpers.sol index c5c787c6..921747fb 100644 --- a/test/v0.8/helpers/module/dataset/DatasetsHelpers.sol +++ b/test/v0.8/helpers/module/dataset/DatasetsHelpers.sol @@ -22,34 +22,24 @@ import {IDatasetsHelpers} from "test/v0.8/interfaces/helpers/module/IDatasetsHel import {RolesType} from "src/v0.8/types/RolesType.sol"; import {DatasetType} from "src/v0.8/types/DatasetType.sol"; -import {IDatasets} from "src/v0.8/interfaces/module/IDatasets.sol"; +import {IRoles} from "src/v0.8/interfaces/core/IRoles.sol"; import {IDatasetsRequirement} from "src/v0.8/interfaces/module/IDatasetsRequirement.sol"; -import {IDatasetsProof} from "src/v0.8/interfaces/module/IDatasetsProof.sol"; -import {IDatasetsChallenge} from "src/v0.8/interfaces/module/IDatasetsChallenge.sol"; import {Generator} from "test/v0.8/helpers/utils/Generator.sol"; import {IDatasetsAssertion} from "test/v0.8/interfaces/assertions/module/IDatasetsAssertion.sol"; +import {FinanceType} from "src/v0.8/types/FinanceType.sol"; // Contract definition for test helper functions contract DatasetsHelpers is Test, IDatasetsHelpers { - IDatasets public datasets; - IDatasetsRequirement public datasetsRequirement; - IDatasetsProof public datasetsProof; - IDatasetsChallenge public datasetsChallenge; + IRoles public roles; Generator private generator; IDatasetsAssertion private assertion; constructor( - IDatasets _datasets, - IDatasetsRequirement _datasetsRequirement, - IDatasetsProof _datasetsProof, - IDatasetsChallenge _datasetsChallenge, + IRoles _roles, Generator _generator, IDatasetsAssertion _assertion ) { - datasets = _datasets; - datasetsRequirement = _datasetsRequirement; - datasetsProof = _datasetsProof; - datasetsChallenge = _datasetsChallenge; + roles = _roles; generator = _generator; assertion = _assertion; } @@ -62,10 +52,10 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { address caller, string memory _accessMethod ) public returns (uint64 datasetId) { - uint64 datasetCount = datasets.datasetsCount(); - vm.prank(caller); + uint64 datasetCount = roles.datasets().datasetsCount(); vm.deal(caller, 10 ether); - datasets.submitDatasetMetadata( + vm.startPrank(caller); + roles.datasets().submitDatasetMetadata( 875, "title", "industry", @@ -77,6 +67,7 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { true, 1 ); + vm.stopPrank(); return datasetCount + 1; } @@ -186,7 +177,7 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { bytes32[] memory leavesHashes = new bytes32[](_leavesCount); uint64[] memory leavesIndexs = new uint64[](_leavesCount); uint64[] memory leavesSizes = new uint64[](_leavesCount); - uint64 count = datasetsProof.getDatasetProofCount( + uint64 count = roles.datasetsProof().getDatasetProofCount( _datasetId, _dataType ); @@ -196,7 +187,7 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { count ); vm.prank(caller); - datasetsProof.submitDatasetProofRoot( + roles.datasetsProof().submitDatasetProofRoot( _datasetId, _dataType, _accessMethod, @@ -204,7 +195,7 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { ); vm.prank(caller); - datasetsProof.submitDatasetProof( + roles.datasetsProof().submitDatasetProof( _datasetId, _dataType, leavesHashes, @@ -231,33 +222,33 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { ) public { bytes32 root = generateRoot(); vm.prank(caller); - datasetsProof.submitDatasetProofRoot( + roles.datasetsProof().submitDatasetProofRoot( _datasetId, _dataType, _accessMethod, root ); - uint64 count = datasets.roles().datasetsProof().getDatasetProofCount( + uint64 count = roles.datasetsProof().getDatasetProofCount( _associatedDatasetId, _dataType ); - bytes32[] memory hashs = datasetsProof.getDatasetProof( + bytes32[] memory hashs = roles.datasetsProof().getDatasetProof( _associatedDatasetId, _dataType, 0, count ); - uint64[] memory ids = datasets.roles().carstore().getCarsIds(hashs); + uint64[] memory ids = roles.carstore().getCarsIds(hashs); uint64[] memory starts = new uint64[](1); uint64[] memory ends = new uint64[](1); starts[0] = ids[0]; ends[0] = ids[count - 1]; vm.prank(caller); - datasetsProof.submitDatasetProofWithCarIds( + roles.datasetsProof().submitDatasetProofWithCarIds( _datasetId, _dataType, starts, @@ -286,9 +277,11 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { uint16 _duplicateCountrys, uint16 _duplicateCitys ) public { - vm.startPrank(caller); vm.deal(caller, 1000 ether); - datasetsRequirement.submitDatasetReplicaRequirements{value: 100 ether}( + vm.startPrank(caller); + roles.datasetsRequirement().submitDatasetReplicaRequirements{ + value: 100 ether + }( _datasetId, generator.generateGeolocationActors( _replicasCount, @@ -361,9 +354,9 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { uint64 _datasetId ) public { uint64 randomSeed = generator.generateNonce(); - uint64 challengeCount = datasetsChallenge.getChallengeSubmissionCount( - _datasetId - ); + uint64 challengeCount = roles + .datasetsChallenge() + .getChallengeSubmissionCount(_datasetId); assertion.getChallengeSubmissionCountAssertion( _datasetId, challengeCount @@ -378,14 +371,32 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { (siblings[i], ) = generator.generateLeaves(challengeCount, 0); paths[i] = i; } - vm.prank(caller); - datasetsChallenge.submitDatasetChallengeProofs( + + vm.startPrank(caller); + vm.deal(caller, 1000 ether); + roles.finance().deposit{value: 1000 ether}( + _datasetId, + 0, + caller, + FinanceType.FIL + ); + uint256 amount = roles + .datasetsChallenge() + .getChallengeAuditCollateralRequirement(); + roles.datasetsChallenge().auditorStake(_datasetId, amount); + uint64 delayBlocks = roles + .datasetsChallenge() + .getAuditorElectionEndHeight(_datasetId); + vm.roll(delayBlocks); + + roles.datasetsChallenge().submitDatasetChallengeProofs( _datasetId, randomSeed, leaves, siblings, paths ); + vm.stopPrank(); } /// @notice Complete the dataset workflow. @@ -430,10 +441,10 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { true ); vm.deal(address(9), 100 ether); - vm.prank(address(9)); - datasetsProof.completeEscrow(datasetId); - - datasetsProof.submitDatasetProofCompleted(datasetId); + vm.startPrank(address(9)); + roles.datasetsProof().completeEscrow(datasetId); + roles.datasetsProof().submitDatasetProofCompleted(datasetId); + vm.stopPrank(); // 3: Submit verification submitDatasetVerification(address(299), datasetId); assertion.getDatasetStateAssertion( @@ -442,8 +453,8 @@ contract DatasetsHelpers is Test, IDatasetsHelpers { ); } - /// @notice Get datasetsProof object - function getDatasetsProof() external view returns (IDatasetsProof) { - return datasetsProof; + /// @notice Get roles object + function getRoles() external view returns (IRoles) { + return roles; } } diff --git a/test/v0.8/helpers/module/matching/MatchingsHelpers.sol b/test/v0.8/helpers/module/matching/MatchingsHelpers.sol index 8809f2ef..2fb49e5b 100644 --- a/test/v0.8/helpers/module/matching/MatchingsHelpers.sol +++ b/test/v0.8/helpers/module/matching/MatchingsHelpers.sol @@ -150,13 +150,30 @@ contract MatchingsHelpers is Test, IMatchingsHelpers { true ); - vm.roll(101); + ( + , + uint64 biddingDelayBlockCount, + uint64 biddingPeriodBlockCount, + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(matchingId); + vm.roll(biddingDelayBlockCount + createdBlockNumber + pausedBlockCount); vm.prank(address(199)); vm.deal(address(199), 200 ether); matchingsBids.bidding{value: 200}(matchingId, 200); address initiator = matchings.getMatchingInitiator(matchingId); - vm.roll(201); + vm.roll( + biddingDelayBlockCount + + biddingPeriodBlockCount + + createdBlockNumber + + pausedBlockCount + ); + assertion.closeMatchingAssertion(initiator, matchingId, address(199)); return (datasetId, matchingId); diff --git a/test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol b/test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol index 9240db3d..53e021d9 100644 --- a/test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol +++ b/test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol @@ -19,7 +19,7 @@ pragma solidity ^0.8.21; import {DatasetType} from "src/v0.8/types/DatasetType.sol"; -import {IDatasetsProof} from "src/v0.8/interfaces/module/IDatasetsProof.sol"; +import {IRoles} from "src/v0.8/interfaces/core/IRoles.sol"; /// @title IDatasetsHelpers /// @dev Interface for managing dataset-related operations. @@ -175,6 +175,6 @@ interface IDatasetsHelpers { uint64 _mappingFilesLeavesCount ) external returns (uint64 datasetId); - /// @notice Get DatasetsProof object - function getDatasetsProof() external view returns (IDatasetsProof); + /// @notice Get roles object + function getRoles() external view returns (IRoles); } diff --git a/test/v0.8/testcases/module/dataset/SubmittChallengeProofsTestSuite.sol b/test/v0.8/testcases/module/dataset/SubmittChallengeProofsTestSuite.sol index 83d0a241..dec3b7b4 100644 --- a/test/v0.8/testcases/module/dataset/SubmittChallengeProofsTestSuite.sol +++ b/test/v0.8/testcases/module/dataset/SubmittChallengeProofsTestSuite.sol @@ -27,6 +27,7 @@ import {IDatasetsProof} from "src/v0.8/interfaces/module/IDatasetsProof.sol"; import {IDatasetsChallenge} from "src/v0.8/interfaces/module/IDatasetsChallenge.sol"; import {IDatasetsAssertion} from "test/v0.8/interfaces/assertions/module/IDatasetsAssertion.sol"; import {IDatasetsHelpers} from "test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol"; +import {FinanceType} from "src/v0.8/types/FinanceType.sol"; ///@notice submit dataset challenge proofs test case with success. contract SubmittChallengeProofsTestCaseWithSuccess is DatasetsTestBase { @@ -50,7 +51,11 @@ contract SubmittChallengeProofsTestCaseWithSuccess is DatasetsTestBase { function before() internal virtual override returns (uint64 id) { DatasetsTestSetup setup = new DatasetsTestSetup(); - return setup.verificationTestSetup(datasetsHelpers); + return + setup.completeAuditorElectionTestSetup( + datasetsHelpers, + address(199) + ); } function action(uint64 _id) internal virtual override { @@ -59,6 +64,7 @@ contract SubmittChallengeProofsTestCaseWithSuccess is DatasetsTestBase { bytes32[][] memory siblings = new bytes32[][](pointCount); uint32[] memory paths = new uint32[](pointCount); uint64 randomSeed; + (randomSeed, leaves, siblings, paths) = datasetsHelpers .generateVerification(pointCount); @@ -95,7 +101,11 @@ contract SubmittChallengeProofsTestCaseWithFail is DatasetsTestBase { function before() internal virtual override returns (uint64 id) { DatasetsTestSetup setup = new DatasetsTestSetup(); - return setup.verificationTestSetup(datasetsHelpers); + return + setup.completeAuditorElectionTestSetup( + datasetsHelpers, + address(200) + ); } function action(uint64 _id) internal virtual override { @@ -143,7 +153,11 @@ contract SubmittChallengeProofsTestCaseWithTimeout is DatasetsTestBase { function before() internal virtual override returns (uint64 id) { DatasetsTestSetup setup = new DatasetsTestSetup(); - return setup.verificationTestSetup(datasetsHelpers); + return + setup.completeAuditorElectionTestSetup( + datasetsHelpers, + address(199) + ); } function action(uint64 _id) internal virtual override { @@ -199,7 +213,6 @@ contract ResubmittDatasetChallengeProofsTestCaseWithSuccess is return setup.challengeTestForResubmitDatasetSetup( datasetsHelpers, - datasets, datasetsAssertion ); } @@ -213,6 +226,21 @@ contract ResubmittDatasetChallengeProofsTestCaseWithSuccess is (randomSeed, leaves, siblings, paths) = datasetsHelpers .generateVerification(pointCount); + vm.startPrank(address(199)); + vm.deal(address(199), 1000 ether); + datasets.roles().finance().deposit{value: 1000 ether}( + _id, + 0, + address(199), + FinanceType.FIL + ); + uint256 amount = datasetsChallenge + .getChallengeAuditCollateralRequirement(); + datasetsChallenge.auditorStake(_id, amount); + vm.stopPrank(); + uint64 delayBlocks = datasetsChallenge.getAuditorElectionEndHeight(_id); + vm.roll(delayBlocks); + datasetsAssertion.submitDatasetChallengeProofsAssertion( address(199), _id, diff --git a/test/v0.8/testcases/module/dataset/setup/DatasetsTestSetup.sol b/test/v0.8/testcases/module/dataset/setup/DatasetsTestSetup.sol index 01ef33cb..66827f41 100644 --- a/test/v0.8/testcases/module/dataset/setup/DatasetsTestSetup.sol +++ b/test/v0.8/testcases/module/dataset/setup/DatasetsTestSetup.sol @@ -24,6 +24,7 @@ import {IDatasets} from "src/v0.8/interfaces/module/IDatasets.sol"; import {IDatasetsProof} from "src/v0.8/interfaces/module/IDatasetsProof.sol"; import {IDatasetsHelpers} from "test/v0.8/interfaces/helpers/module/IDatasetsHelpers.sol"; import {IDatasetsAssertion} from "test/v0.8/interfaces/assertions/module/IDatasetsAssertion.sol"; +import {FinanceType} from "src/v0.8/types/FinanceType.sol"; /// @title DatasetsTestSetup /// @dev Preset conditions for datasets testing. @@ -88,9 +89,9 @@ contract DatasetsTestSetup is Test { ); vm.deal(address(9), 1000 ether); vm.startPrank(address(9)); - _datasetsHelpers.getDatasetsProof().completeEscrow(datasetId); + _datasetsHelpers.getRoles().datasetsProof().completeEscrow(datasetId); vm.stopPrank(); - _datasetsHelpers.getDatasetsProof().submitDatasetProofCompleted( + _datasetsHelpers.getRoles().datasetsProof().submitDatasetProofCompleted( datasetId ); _datasetsHelpers.submitDatasetVerification(address(99), datasetId); @@ -169,17 +170,46 @@ contract DatasetsTestSetup is Test { vm.deal(address(9), 1000 ether); vm.startPrank(address(9)); - _datasetsHelpers.getDatasetsProof().completeEscrow(datasetId); + _datasetsHelpers.getRoles().datasetsProof().completeEscrow(datasetId); vm.stopPrank(); - _datasetsHelpers.getDatasetsProof().submitDatasetProofCompleted( + _datasetsHelpers.getRoles().datasetsProof().submitDatasetProofCompleted( datasetId ); return datasetId; } + function completeAuditorElectionTestSetup( + IDatasetsHelpers _datasetsHelpers, + address _caller + ) public returns (uint64 id) { + id = verificationTestSetup(_datasetsHelpers); + vm.startPrank(_caller); + + vm.deal(_caller, 1000 ether); + _datasetsHelpers.getRoles().finance().deposit{value: 1000 ether}( + id, + 0, + _caller, + FinanceType.FIL + ); + uint256 amount = _datasetsHelpers + .getRoles() + .datasetsChallenge() + .getChallengeAuditCollateralRequirement(); + _datasetsHelpers.getRoles().datasetsChallenge().auditorStake( + id, + amount + ); + vm.stopPrank(); + uint64 delayBlocks = _datasetsHelpers + .getRoles() + .datasetsChallenge() + .getAuditorElectionEndHeight(id); + vm.roll(delayBlocks); + } + function challengeTestForResubmitDatasetSetup( IDatasetsHelpers _datasetsHelpers, - IDatasets _datasets, IDatasetsAssertion _datasetsAssertion ) public returns (uint64 id) { uint64 associatedDatasetId = _datasetsHelpers.submitDatasetMetadata( @@ -216,11 +246,13 @@ contract DatasetsTestSetup is Test { vm.roll(10000000); vm.prank(address(199)); - _datasetsHelpers.getDatasetsProof().submitDatasetProofCompleted( + _datasetsHelpers.getRoles().datasetsProof().submitDatasetProofCompleted( associatedDatasetId ); - (, , , , , string memory accessMethod, , , , , ) = _datasets + (, , , , , string memory accessMethod, , , , , ) = _datasetsHelpers + .getRoles() + .datasets() .getDatasetMetadata(associatedDatasetId); _datasetsAssertion.submitDatasetMetadataAssertion( @@ -231,7 +263,10 @@ contract DatasetsTestSetup is Test { associatedDatasetId ); - uint64 datasetId = _datasets.datasetsCount(); + uint64 datasetId = _datasetsHelpers + .getRoles() + .datasets() + .datasetsCount(); _datasetsHelpers.submitDatasetReplicaRequirements( address(9), datasetId, @@ -262,12 +297,11 @@ contract DatasetsTestSetup is Test { vm.deal(address(9), 1000 ether); vm.startPrank(address(9)); - _datasets.roles().datasetsProof().completeEscrow(datasetId); + _datasetsHelpers.getRoles().datasetsProof().completeEscrow(datasetId); vm.stopPrank(); - _datasetsHelpers.getDatasetsProof().submitDatasetProofCompleted( + _datasetsHelpers.getRoles().datasetsProof().submitDatasetProofCompleted( datasetId ); - _datasets.getDatasetState(datasetId); return datasetId; } } diff --git a/test/v0.8/testcases/module/matching/BiddingTestSuite.sol b/test/v0.8/testcases/module/matching/BiddingTestSuite.sol index 10e0ae4e..652d9620 100644 --- a/test/v0.8/testcases/module/matching/BiddingTestSuite.sol +++ b/test/v0.8/testcases/module/matching/BiddingTestSuite.sol @@ -59,8 +59,6 @@ contract BiddingTestCaseWithSuccess is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(101); - vm.expectEmit(true, true, true, true); emit MatchingsEvents.MatchingBidPlaced( _matchingId, @@ -109,7 +107,6 @@ contract BiddingTestCaseWithInvlalidAmount is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(101); vm.expectRevert(bytes("Invalid amount")); matchingsAssertion.biddingAssertion(address(199), _matchingId, _amount); } @@ -145,7 +142,6 @@ contract BiddingTestCaseWithInvlalidDuplicateBid is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(101); matchingsAssertion.biddingAssertion(address(199), _matchingId, _amount); vm.prank(address(199)); vm.deal(address(199), 200 ether); @@ -209,7 +205,6 @@ contract BiddingTestCaseWithInvlalidState is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(101); vm.expectRevert( abi.encodeWithSelector( Errors.InvalidMatchingState.selector, @@ -288,7 +283,23 @@ contract BiddingTestCaseWithBidIsEnd is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(300); + ( + , + uint64 biddingDelayBlockCount, + uint64 biddingPeriodBlockCount, + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll( + biddingDelayBlockCount + + biddingPeriodBlockCount + + createdBlockNumber + + pausedBlockCount + ); vm.expectRevert(bytes("Matching: Bidding is end")); matchingsAssertion.biddingAssertion(address(199), _matchingId, _amount); } @@ -324,7 +335,6 @@ contract BiddingTestCaseWithInvalidStorageProvider is ControlTestSuiteBase { uint64 _matchingId, uint64 _amount ) internal virtual override { - vm.roll(101); vm.expectRevert(bytes("Invalid SP submitter")); matchingsAssertion.biddingAssertion(address(200), _matchingId, _amount); } diff --git a/test/v0.8/testcases/module/matching/CancelTestSuite.sol b/test/v0.8/testcases/module/matching/CancelTestSuite.sol index 95d6485a..7281bfbf 100644 --- a/test/v0.8/testcases/module/matching/CancelTestSuite.sol +++ b/test/v0.8/testcases/module/matching/CancelTestSuite.sol @@ -52,6 +52,19 @@ contract CancelTestCaseWithSuccess is ControlTestSuiteBase { uint64 _matchingId, uint64 /*_amount*/ ) internal virtual override { + ( + , + , + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll(createdBlockNumber + pausedBlockCount); + address initiator = matchings.getMatchingInitiator(_matchingId); vm.expectEmit(true, false, false, true); emit MatchingsEvents.MatchingCancelled(_matchingId); @@ -82,7 +95,6 @@ contract CancelTestCaseWithAfterStarted is ControlTestSuiteBase { uint64 /*_amount*/ ) internal virtual override { address initiator = matchings.getMatchingInitiator(_matchingId); - vm.roll(150); vm.expectRevert(bytes("bid alreay start,can't cancel")); matchingsAssertion.cancelMatchingAssertion(initiator, _matchingId); } diff --git a/test/v0.8/testcases/module/matching/CloseTestSuite.sol b/test/v0.8/testcases/module/matching/CloseTestSuite.sol index 364af935..3a2e11d1 100644 --- a/test/v0.8/testcases/module/matching/CloseTestSuite.sol +++ b/test/v0.8/testcases/module/matching/CloseTestSuite.sol @@ -51,7 +51,6 @@ contract CloseTestCaseWithSuccess is ControlTestSuiteBase { uint64 _amount ) internal virtual override returns (uint64) { uint64 matchingId = super.before(_bidRule, _amount); - vm.roll(101); vm.prank(address(199)); vm.deal(address(199), 200 ether); matchingsBids.bidding{value: 200}(matchingId, 200); @@ -63,7 +62,23 @@ contract CloseTestCaseWithSuccess is ControlTestSuiteBase { uint64 /*_amount*/ ) internal virtual override { address initiator = matchings.getMatchingInitiator(_matchingId); - vm.roll(201); + ( + , + uint64 biddingDelayBlockCount, + uint64 biddingPeriodBlockCount, + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll( + biddingDelayBlockCount + + biddingPeriodBlockCount + + createdBlockNumber + + pausedBlockCount + ); matchingsAssertion.closeMatchingAssertion( initiator, _matchingId, diff --git a/test/v0.8/testcases/module/matching/PauseTestSuite.sol b/test/v0.8/testcases/module/matching/PauseTestSuite.sol index f4ec58cb..4a0057c3 100644 --- a/test/v0.8/testcases/module/matching/PauseTestSuite.sol +++ b/test/v0.8/testcases/module/matching/PauseTestSuite.sol @@ -51,7 +51,18 @@ contract PauseTestCaseWithSuccess is ControlTestSuiteBase { uint64 _matchingId, uint64 /*_amount*/ ) internal virtual override { - vm.roll(99); + ( + , + , + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll(createdBlockNumber + pausedBlockCount); address initiator = matchings.getMatchingInitiator(_matchingId); matchingsAssertion.pauseMatchingAssertion(initiator, _matchingId); } @@ -80,7 +91,18 @@ contract PauseTestCaseWithInvalidSender is ControlTestSuiteBase { uint64 /*_amount*/ ) internal virtual override { address initiator = matchings.getMatchingInitiator(_matchingId); - vm.roll(99); + ( + , + , + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll(createdBlockNumber + pausedBlockCount); vm.expectRevert( abi.encodeWithSelector( Errors.NotMatchingInitiator.selector, @@ -134,12 +156,23 @@ contract PauseTestCaseWithInvalidState is MatchingsTestBase { 0, 0 ); + ( + , + , + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(matchingId); + vm.roll(createdBlockNumber + pausedBlockCount); return matchingId; } function action(uint64 _matchingId) internal virtual override { address initiator = matchings.getMatchingInitiator(_matchingId); - vm.roll(99); vm.expectRevert(); matchingsAssertion.pauseMatchingAssertion(initiator, _matchingId); } @@ -167,7 +200,18 @@ contract PauseTestCaseWithAlreadyPaused is ControlTestSuiteBase { uint64 _matchingId, uint64 /*_amount*/ ) internal virtual override { - vm.roll(99); + ( + , + , + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(_matchingId); + vm.roll(createdBlockNumber + pausedBlockCount); address initiator = matchings.getMatchingInitiator(_matchingId); matchingsAssertion.pauseMatchingAssertion(initiator, _matchingId); vm.prank(initiator); @@ -198,7 +242,6 @@ contract PauseTestCaseWithAlreadyBidding is ControlTestSuiteBase { uint64 _matchingId, uint64 /*_amount*/ ) internal virtual override { - vm.roll(101); address initiator = matchings.getMatchingInitiator(_matchingId); vm.expectRevert(bytes("alreay bidding,can't pause.")); diff --git a/test/v0.8/testcases/module/matching/abstract/ControlTestSuiteBase.sol b/test/v0.8/testcases/module/matching/abstract/ControlTestSuiteBase.sol index 3a0ec6c9..02015cd1 100644 --- a/test/v0.8/testcases/module/matching/abstract/ControlTestSuiteBase.sol +++ b/test/v0.8/testcases/module/matching/abstract/ControlTestSuiteBase.sol @@ -105,6 +105,18 @@ abstract contract ControlTestSuiteBase is Test { cars, true ); + ( + , + uint64 biddingDelayBlockCount, + , + , + , + uint64 createdBlockNumber, + , + , + uint64 pausedBlockCount + ) = matchings.getMatchingMetadata(matchingId); + vm.roll(createdBlockNumber + biddingDelayBlockCount + pausedBlockCount); // Get the count of available matchings return matchingId; } diff --git a/test/v0.8/uinttests/module/dataset/setup/DatasetTestSetup.sol b/test/v0.8/uinttests/module/dataset/setup/DatasetTestSetup.sol index f504cfa5..518246d1 100644 --- a/test/v0.8/uinttests/module/dataset/setup/DatasetTestSetup.sol +++ b/test/v0.8/uinttests/module/dataset/setup/DatasetTestSetup.sol @@ -38,13 +38,6 @@ contract DatasetTestSetup is BaseTestSetup { datasetsChallenge() ); - helpers = new DatasetsHelpers( - datasets(), - datasetsRequirement(), - datasetsProof(), - datasetsChallenge(), - generator(), - assertion - ); + helpers = new DatasetsHelpers(role(), generator(), assertion); } } diff --git a/test/v0.8/uinttests/module/matching/setup/MatchingTestSetup.sol b/test/v0.8/uinttests/module/matching/setup/MatchingTestSetup.sol index 5ce08120..6ca70414 100644 --- a/test/v0.8/uinttests/module/matching/setup/MatchingTestSetup.sol +++ b/test/v0.8/uinttests/module/matching/setup/MatchingTestSetup.sol @@ -48,10 +48,7 @@ contract MatchingTestSetup is BaseTestSetup { ); DatasetsHelpers datasetsHelpers = new DatasetsHelpers( - datasets(), - datasetsRequirement(), - datasetsProof(), - datasetsChallenge(), + role(), generator(), datasetAssertion ); diff --git a/test/v0.8/uinttests/module/storage/setup/DatacapTestSetup.sol b/test/v0.8/uinttests/module/storage/setup/DatacapTestSetup.sol index 2eb49455..97c19dc9 100644 --- a/test/v0.8/uinttests/module/storage/setup/DatacapTestSetup.sol +++ b/test/v0.8/uinttests/module/storage/setup/DatacapTestSetup.sol @@ -49,10 +49,7 @@ contract DatacapTestSetup is BaseTestSetup { datasetsChallenge() ); DatasetsHelpers datasetsHelpers = new DatasetsHelpers( - datasets(), - datasetsRequirement(), - datasetsProof(), - datasetsChallenge(), + role(), generator(), datasetAssertion ); diff --git a/test/v0.8/uinttests/module/storage/setup/StorageTestSetup.sol b/test/v0.8/uinttests/module/storage/setup/StorageTestSetup.sol index 5a97c08c..8ff2093e 100644 --- a/test/v0.8/uinttests/module/storage/setup/StorageTestSetup.sol +++ b/test/v0.8/uinttests/module/storage/setup/StorageTestSetup.sol @@ -51,10 +51,7 @@ contract StorageTestSetup is BaseTestSetup { datasetsChallenge() ); DatasetsHelpers datasetsHelpers = new DatasetsHelpers( - datasets(), - datasetsRequirement(), - datasetsProof(), - datasetsChallenge(), + role(), generator(), datasetAssertion );