Skip to content

Commit

Permalink
refactor: make cliff time strictly greater than start time
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Feb 8, 2024
1 parent 2c85e19 commit 8ebf8d8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libraries/Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ library Helpers {
}

// Checks: the start time is less than or equal to the cliff time.
if (range.cliff != 0 && range.start > range.cliff) {
if (range.cliff != 0 && range.start >= range.cliff) {
revert Errors.SablierV2LockupLinear_StartTimeNotLessThanCliffTime(range.start, range.cliff);
}

Expand Down
2 changes: 1 addition & 1 deletion test/fork/LockupLinear.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ abstract contract LockupLinear_Fork_Test is Fork_Test {
params.broker.fee = _bound(params.broker.fee, 0, MAX_FEE);
params.protocolFee = _bound(params.protocolFee, 0, MAX_FEE);
params.range.start = boundUint40(params.range.start, currentTime - 1000 seconds, currentTime + 10_000 seconds);
params.range.cliff = boundUint40(params.range.cliff, params.range.start, params.range.start + 52 weeks);
params.range.cliff = boundUint40(params.range.cliff, params.range.start + 1, params.range.start + 52 weeks);
params.totalAmount = boundUint128(params.totalAmount, 1, uint128(initialHolderBalance));
params.transferable = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Fuzz_Test is
vm.assume(params.totalAmount != 0);
params.range.start =
boundUint40(params.range.start, defaults.START_TIME(), defaults.START_TIME() + 10_000 seconds);
params.range.cliff = boundUint40(params.range.cliff, params.range.start, params.range.start + 52 weeks);
params.range.cliff = boundUint40(params.range.cliff, params.range.start + 1, params.range.start + 52 weeks);
params.range.end = boundUint40(params.range.end, params.range.cliff + 1 seconds, MAX_UNIX_TIMESTAMP);
params.broker.fee = _bound(params.broker.fee, 0, MAX_FEE);
protocolFee = _bound(protocolFee, 0, MAX_FEE);
Expand Down
2 changes: 1 addition & 1 deletion test/invariant/LockupLinear.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract LockupLinear_Invariant_Test is Lockup_Invariant_Test {
for (uint256 i = 0; i < lastStreamId; ++i) {
uint256 streamId = lockupStore.streamIds(i);
if (lockupLinear.getCliffTime(streamId) > 0) {
assertGte(
assertGt(
lockupLinear.getCliffTime(streamId),
lockupLinear.getStartTime(streamId),
"Invariant violated: cliff time < start time"
Expand Down
2 changes: 1 addition & 1 deletion test/invariant/handlers/LockupLinearCreateHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ contract LockupLinearCreateHandler is BaseHandler {
uint40 currentTime = getBlockTimestamp();
params.broker.fee = _bound(params.broker.fee, 0, MAX_FEE);
params.range.start = boundUint40(params.range.start, 1, currentTime);
params.range.cliff = boundUint40(params.range.cliff, params.range.start, params.range.start + 52 weeks);
params.range.cliff = boundUint40(params.range.cliff, params.range.start + 1, params.range.start + 52 weeks);
params.totalAmount = boundUint128(params.totalAmount, 1, 1_000_000_000e18);

// Bound the end time so that it is always greater than both the current time and the cliff time (this is
Expand Down

0 comments on commit 8ebf8d8

Please sign in to comment.