Skip to content

Commit

Permalink
Increase the challenge timeout period
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-kaufman committed Oct 17, 2023
1 parent d10747e commit 98f5157
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions contracts/HATVaultsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ contract HATVaultsRegistry is IHATVaultsRegistry, Ownable {
defaultBountyHackerHATVested = _bountyHackerHATVested;
defaultArbitrator = _defaultArbitrator;
defaultChallengePeriod = 3 days;
defaultChallengeTimeOutPeriod = 5 weeks;
defaultChallengeTimeOutPeriod = 125 days;
emit RegistryCreated(
_hatVaultImplementation,
_hatClaimsManagerImplementation,
Expand Down Expand Up @@ -420,7 +420,7 @@ contract HATVaultsRegistry is IHATVaultsRegistry, Ownable {
/** @notice See {IHATVaultsRegistry-validateChallengeTimeOutPeriod}. */
function validateChallengeTimeOutPeriod(uint32 _challengeTimeOutPeriod) public pure {
if (_challengeTimeOutPeriod < 2 days) revert ChallengeTimeOutPeriodTooShort();
if (_challengeTimeOutPeriod > 85 days) revert ChallengeTimeOutPeriodTooLong();
if (_challengeTimeOutPeriod > 125 days) revert ChallengeTimeOutPeriodTooLong();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IHATVaultsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ interface IHATVaultsRegistry {

/**
* @notice Raised on {setDefaultChallengeTimeOutPeriod} if the challenge
* timeout period to be set is longer than 85 days
* timeout period to be set is longer than 125 days
*/
error ChallengeTimeOutPeriodTooLong();

Expand Down Expand Up @@ -426,7 +426,7 @@ interface IHATVaultsRegistry {

/**
* @notice Check that the given challenge timeout period is legal, meaning
* that it is greater than 2 days and less than 85 days.
* that it is greater than 2 days and less than 125 days.
* @param _challengeTimeOutPeriod The challenge timeout period to check
*/
function validateChallengeTimeOutPeriod(uint32 _challengeTimeOutPeriod) external pure;
Expand Down
2 changes: 1 addition & 1 deletion docs/dodoc/HATVaultsRegistry.md
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ Raised on {setDefaultChallengePeriod} if the challenge period to be set is shor
error ChallengeTimeOutPeriodTooLong()
```

Raised on {setDefaultChallengeTimeOutPeriod} if the challenge timeout period to be set is longer than 85 days
Raised on {setDefaultChallengeTimeOutPeriod} if the challenge timeout period to be set is longer than 125 days



Expand Down
4 changes: 2 additions & 2 deletions docs/dodoc/interfaces/IHATVaultsRegistry.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ Check that the given challenge period is legal, meaning that it is greater than
function validateChallengeTimeOutPeriod(uint32 _challengeTimeOutPeriod) external pure
```

Check that the given challenge timeout period is legal, meaning that it is greater than 2 days and less than 85 days.
Check that the given challenge timeout period is legal, meaning that it is greater than 2 days and less than 125 days.



Expand Down Expand Up @@ -990,7 +990,7 @@ Raised on {setDefaultChallengePeriod} if the challenge period to be set is shor
error ChallengeTimeOutPeriodTooLong()
```

Raised on {setDefaultChallengeTimeOutPeriod} if the challenge timeout period to be set is longer than 85 days
Raised on {setDefaultChallengeTimeOutPeriod} if the challenge timeout period to be set is longer than 125 days



Expand Down
34 changes: 17 additions & 17 deletions test/arbitrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ contract("Registry Arbitrator", (accounts) => {
it("Set default challengeTimeOutPeriod", async () => {
const { registry, claimsManager } = await setup(accounts);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);

await assertFunctionRaisesException(
registry.setDefaultChallengeTimeOutPeriod(60 * 60 * 24 * 2, { from: accounts[1] }),
Expand All @@ -87,7 +87,7 @@ contract("Registry Arbitrator", (accounts) => {
);

await assertFunctionRaisesException(
registry.setDefaultChallengeTimeOutPeriod(60 * 60 * 24 * 85 + 1),
registry.setDefaultChallengeTimeOutPeriod(60 * 60 * 24 * 125 + 1),
"ChallengeTimeOutPeriodTooLong"
);

Expand All @@ -98,12 +98,12 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal(tx.logs[0].event, "SetDefaultChallengeTimeOutPeriod");
assert.equal(tx.logs[0].args._defaultChallengeTimeOutPeriod, 60 * 60 * 24 * 2);

tx = await registry.setDefaultChallengeTimeOutPeriod(60 * 60 * 24 * 85);
tx = await registry.setDefaultChallengeTimeOutPeriod(60 * 60 * 24 * 125);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 85);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 85);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(tx.logs[0].event, "SetDefaultChallengeTimeOutPeriod");
assert.equal(tx.logs[0].args._defaultChallengeTimeOutPeriod, 60 * 60 * 24 * 85);
assert.equal(tx.logs[0].args._defaultChallengeTimeOutPeriod, 60 * 60 * 24 * 125);
});

it("Set vault arbitration parameters", async () => {
Expand All @@ -117,8 +117,8 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal((await registry.defaultChallengePeriod()).toString(), 60 * 60 * 24 * 3);
assert.equal(await claimsManager.getChallengePeriod(), 60 * 60 * 24 * 3);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);

assert.equal(await claimsManager.arbitratorCanChangeBounty(), true);
assert.equal(await claimsManager.arbitratorCanChangeBeneficiary(), false);
Expand Down Expand Up @@ -172,7 +172,7 @@ contract("Registry Arbitrator", (accounts) => {
);

await assertFunctionRaisesException(
claimsManager.setChallengeTimeOutPeriod(60 * 60 * 24 * 85 + 1),
claimsManager.setChallengeTimeOutPeriod(60 * 60 * 24 * 125 + 1),
"ChallengeTimeOutPeriodTooLong"
);

Expand Down Expand Up @@ -200,7 +200,7 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal(await registry.defaultChallengePeriod(), 60 * 60 * 24 * 3);
assert.equal(await claimsManager.getChallengePeriod(), 60 * 60 * 24);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 2);

assert.equal(await claimsManager.arbitratorCanChangeBounty(), false);
Expand All @@ -217,9 +217,9 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal(tx.logs[0].event, "SetChallengePeriod");
assert.equal(tx.logs[0].args._challengePeriod, 60 * 60 * 24 * 5);

tx = await claimsManager.setChallengeTimeOutPeriod(60 * 60 * 24 * 85);
tx = await claimsManager.setChallengeTimeOutPeriod(60 * 60 * 24 * 125);
assert.equal(tx.logs[0].event, "SetChallengeTimeOutPeriod");
assert.equal(tx.logs[0].args._challengeTimeOutPeriod, 60 * 60 * 24 * 85);
assert.equal(tx.logs[0].args._challengeTimeOutPeriod, 60 * 60 * 24 * 125);

tx = await claimsManager.setArbitratorOptions(true, false, false);
assert.equal(tx.logs[0].event, "SetArbitratorOptions");
Expand All @@ -233,8 +233,8 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal(await registry.defaultChallengePeriod(), 60 * 60 * 24 * 3);
assert.equal(await claimsManager.getChallengePeriod(), 60 * 60 * 24 * 5);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 85);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);

assert.equal(await claimsManager.arbitratorCanChangeBounty(), true);

Expand Down Expand Up @@ -266,8 +266,8 @@ contract("Registry Arbitrator", (accounts) => {
assert.equal(await registry.defaultChallengePeriod(), 60 * 60 * 24 * 3);
assert.equal(await claimsManager.getChallengePeriod(), 60 * 60 * 24 * 3);

assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 35);
assert.equal(await registry.defaultChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);
assert.equal(await claimsManager.getChallengeTimeOutPeriod(), 60 * 60 * 24 * 125);

assert.equal(await claimsManager.arbitratorCanChangeBounty(), true);

Expand Down
6 changes: 3 additions & 3 deletions test/hatvaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ contract("HatVaults", (accounts) => {
assert.equal(activeClaim.bountyHackerHATVested, "500");
assert.equal(activeClaim.arbitrator, accounts[0]);
assert.equal(activeClaim.challengePeriod, "86400");
assert.equal(activeClaim.challengeTimeOutPeriod, "3024000");
assert.equal(activeClaim.challengeTimeOutPeriod, "10800000");
assert.equal(activeClaim.arbitratorCanChangeBounty, true);
assert.equal(activeClaim.arbitratorCanChangeBeneficiary, false);
});
Expand Down Expand Up @@ -981,7 +981,7 @@ contract("HatVaults", (accounts) => {
await newClaimsManager.setCommittee(accounts[1], { from: accounts[2] });
});

it("dismiss can be called by anyone after 5 weeks delay", async () => {
it("dismiss can be called by anyone after 125 days delay", async () => {
var staker = accounts[1];
await setUpGlobalVars(accounts, 0, 9000, [9000, 0, 1000], [1000, 500], 10, 0, 100, false, 2500000, 60 * 60 * 24 * 3);

Expand Down Expand Up @@ -1013,7 +1013,7 @@ contract("HatVaults", (accounts) => {
);
}
await utils.increaseTime(1);
await utils.increaseTime(5 * 7 * 24 * 60 * 60);
await utils.increaseTime(125 * 24 * 60 * 60);
tx = await claimsManager.dismissClaim(claimId, { from: accounts[1] });
assert.equal(tx.logs[0].event, "DismissClaim");
});
Expand Down

0 comments on commit 98f5157

Please sign in to comment.