Skip to content

Commit

Permalink
fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpisreddevil committed Oct 16, 2023
1 parent 42a7aaa commit 7cedae4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public void fallback() {
public void migrateOldHashToNewHash(String oldHash, String newHash){
validateCpsScore();
int size = proposalsKeys.size();
for (int i = 0; i < size - 1; i++) {
for (int i = 0; i < size; i++) {
if (proposalsKeys.get(i).equals(oldHash)) {
proposalsKeys.set(i, newHash);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,7 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i
String newHash = newProposal.ipfs_hash;
Context.require(proposalKeyExists(oldHash), TAG + ": Proposal key should exist on proposal db.");
Context.require(!proposalKeyExists(newHash), TAG + ": Proposal key already exists.");

Address caller = Context.getCaller();
Context.require(!caller.isContract(), TAG + ": Contract Address not supported.");

Expand Down Expand Up @@ -2696,14 +2697,14 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i

ArrayDB<String> progReports = ProposalDataDb.progressReports.at(oldIpfsHashPrefix);
List<String> progressReportsList = ArrayDBUtils.arrayDBtoList(progReports);
for (int i = 0; i < progressReportsList.size() - 1; i++) {
for (int i = 0; i < progressReportsList.size(); i++) {
String report = progressReportsList.get(i);
String progressHashPrefix = progressReportPrefix(report);
ProgressReportDataDb.ipfsHash.at(progressHashPrefix).set(newHash);

// add to milestone db
String milestonePrefix = mileStonePrefix(newHash,milestones[i]);
MilestoneDb.id.at(milestonePrefix).set(i);
MilestoneDb.id.at(milestonePrefix).set(milestones[i]);
MilestoneDb.status.at(milestonePrefix).set(MILESTONE_REPORT_COMPLETED);
MilestoneDb.progressReportHash.at(milestonePrefix).set(report);

Expand All @@ -2730,7 +2731,7 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i
MilestoneDb.votersList.at(milestonePrefix).add(voter);
}

BranchDB<Address, DictDB<String, Integer>> votersListIndex = ProgressReportDataDb.votersListIndices.at(oldIpfsHashPrefix);
BranchDB<Address, DictDB<String, Integer>> votersListIndex = ProgressReportDataDb.votersListIndices.at(progressHashPrefix);
List<Address> preps = arrayDBtoList(votersList);
for (Address prep : preps) {
DictDB<String, Integer> votersVote = votersListIndex.at(prep);
Expand All @@ -2740,7 +2741,7 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i

MilestoneDb.votersListIndices.at(milestonePrefix).at(prep).set(VOTE, voteData);
MilestoneDb.votersListIndices.at(milestonePrefix).at(prep).set(INDEX, indexData);
MilestoneDb.votersListIndices.at(milestonePrefix).at(prep).set(CHANGE_VOTE, changeVoteData);
MilestoneDb.votersListIndices.at(milestonePrefix).at(prep).set(CHANGE_VOTE, changeVoteData); // TODO: Update to progressReportDB
}

ProposalDataDb.progressReports.at(newIpfsHashPrefix).add(report);
Expand Down Expand Up @@ -2775,6 +2776,7 @@ public void submitProposalMock(ProposalAttributes newProposal, String oldHash, i
ProposalSubmitted(caller, "Successfully submitted a Proposal.");
}

@External
public void updateProposalKeyIndex(String oldHash, String newHash) {
validateAdmins();
String oldIpfsHashPrefix = proposalPrefix(oldHash);
Expand All @@ -2794,7 +2796,6 @@ public void updateProposalKeyIndex(String oldHash, String newHash) {

callScore(getCpfTreasuryScore(), "migrateOldHashToNewHash", oldHash,newHash);
callScore(getCpsTreasuryScore(), "updateNewProjects", oldHash, newHash);

}


Expand Down

0 comments on commit 7cedae4

Please sign in to comment.