Skip to content

Commit a53c1b8

Browse files
committed
fix: removed debugging bug from contract
1 parent c8d9848 commit a53c1b8

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ yarn-debug.log*
66
yarn-error.log*
77
lerna-debug.log*
88

9+
# Truffle build
10+
block/build/
11+
912
# Diagnostic reports (https://nodejs.org/api/report.html)
1013
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1114

block/contracts/GithubVerification.sol

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,16 @@ contract GithubVerification is SignatureHelper {
159159
}
160160

161161
uint64 verifyDayThreshold = thresholdHistory[currentTimestampIndex].threshold;
162-
assert(verifyDayThreshold == 60);
163162

164-
bool found = false;
165163
// Reverse for loop, because more recent dates are at the end of the array
166164
for (uint j = verifiedAt.length; j > 0; j--) {
167-
// require(j - 1 == 1, "j==1");
168-
// !(verifiedAt[j - 1] + verifyDayThreshold * 1 days > uint64(_timestamp))) {
169-
// revert Bababooey(uint64(_timestamp));
170-
// }
171-
172165
// If the stamp is valid at _timestamp, add it to the stampsAt array
173166
if (verifiedAt[j - 1] + (verifyDayThreshold * 1 days) > _timestamp && verifiedAt[j - 1] < _timestamp) {
174-
if (!found) {
175-
stampsAt[count] = stamps[_toCheck][i];
176-
count++;
177-
found = true;
178-
}
167+
stampsAt[count] = stamps[_toCheck][i];
168+
count++;
169+
break;
179170
} else if (verifiedAt[j - 1] + (verifyDayThreshold * 1 days) < _timestamp) {
180-
found = true;
171+
break;
181172
}
182173
}
183174
}

block/test/GithubVerification.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ contract("GithubVerification", async (accounts) => {
377377
* OOOOOO_____OOO_____
378378
*
379379
*/
380-
xit("Should give correct validity at given timestamp even after verifyDayThreshold change", async () => {
380+
it("Should give correct validity at given timestamp even after verifyDayThreshold change", async () => {
381381
// Create a snapshot we can return to after manually increasing time on the chain
382382
const snapshotA = await snapshot();
383383
try {
@@ -428,12 +428,12 @@ contract("GithubVerification", async (accounts) => {
428428
stamps = await contractInstance.getStampsAt(alice, timestamp + days(VERIFY_DAY_THRESHOLD));
429429
assert(stamps.length === 0, "Expected address to be invalid at this timestamp; length of stamps array is not equal to 0");
430430

431-
// stamps = await contractInstance.getStampsAt(alice, newTimestamp + 60);
432-
// assert(stamps.length === 1, "Length of stamps array is not equal to 1");
433-
// assert(stamps[0][0] === "github", "Provider id should be github");
434-
// assert(stamps[0][1] === userHash, "Userhashes not equal");
435-
// assert(stamps[0][2][0] == timestamp, "Old timestamps not equal");
436-
// assert(stamps[0][2][1] == newTimestamp, "New timestamps not equal");
431+
stamps = await contractInstance.getStampsAt(alice, newTimestamp + 60);
432+
assert(stamps.length === 1, "Length of stamps array is not equal to 1");
433+
assert(stamps[0][0] === "github", "Provider id should be github");
434+
assert(stamps[0][1] === userHash, "Userhashes not equal");
435+
assert(stamps[0][2][0] == timestamp, "Old timestamps not equal");
436+
assert(stamps[0][2][1] == newTimestamp, "New timestamps not equal");
437437

438438
// stamps = await contractInstance.getStampsAt(alice, newTimestamp + VERIFY_DAY_THRESHOLD / 2)
439439
// assert(stamps.length === 0, "Expected address to be invalid at this timestamp; length of stamps array is not equal to 0");

0 commit comments

Comments
 (0)