Skip to content

Commit b3e3a26

Browse files
committed
chore: rename misleading vars (OZ N-11)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 9e7cc99 commit b3e3a26

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

packages/horizon/contracts/interfaces/internal/IHorizonStakingTypes.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ interface IHorizonStakingTypes {
151151
* ordered by creation timestamp.
152152
* @param shares Shares that represent the tokens being thawed
153153
* @param thawingUntil The timestamp when the thawed funds can be removed from the provision
154-
* @param next Id of the next thaw request in the linked list
154+
* @param nextRequest Id of the next thaw request in the linked list
155155
* @param thawingNonce Used to invalidate unfulfilled thaw requests
156156
*/
157157
struct ThawRequest {
158158
uint256 shares;
159159
uint64 thawingUntil;
160-
bytes32 next;
160+
bytes32 nextRequest;
161161
uint256 thawingNonce;
162162
}
163163

packages/horizon/contracts/staking/HorizonStaking.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,10 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
10451045
ThawRequest storage thawRequest = _getThawRequest(_requestType, thawRequestId);
10461046
thawRequest.shares = _shares;
10471047
thawRequest.thawingUntil = _thawingUntil;
1048-
thawRequest.next = bytes32(0);
1048+
thawRequest.nextRequest = bytes32(0);
10491049
thawRequest.thawingNonce = _thawingNonce;
10501050

1051-
if (thawRequestList.count != 0) _getThawRequest(_requestType, thawRequestList.tail).next = thawRequestId;
1051+
if (thawRequestList.count != 0) _getThawRequest(_requestType, thawRequestList.tail).nextRequest = thawRequestId;
10521052
thawRequestList.addTail(thawRequestId);
10531053

10541054
emit ThawRequestCreated(

packages/horizon/contracts/staking/HorizonStakingBase.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ abstract contract HorizonStakingBase is
194194
}
195195
}
196196

197-
thawRequestId = thawRequest.next;
197+
thawRequestId = thawRequest.nextRequest;
198198
}
199199
return thawedTokens;
200200
}
@@ -280,7 +280,7 @@ abstract contract HorizonStakingBase is
280280
* @return The ID of the next thaw request in the list.
281281
*/
282282
function _getNextProvisionThawRequest(bytes32 _thawRequestId) internal view returns (bytes32) {
283-
return _thawRequests[ThawRequestType.Provision][_thawRequestId].next;
283+
return _thawRequests[ThawRequestType.Provision][_thawRequestId].nextRequest;
284284
}
285285

286286
/**
@@ -289,7 +289,7 @@ abstract contract HorizonStakingBase is
289289
* @return The ID of the next thaw request in the list.
290290
*/
291291
function _getNextDelegationThawRequest(bytes32 _thawRequestId) internal view returns (bytes32) {
292-
return _thawRequests[ThawRequestType.Delegation][_thawRequestId].next;
292+
return _thawRequests[ThawRequestType.Delegation][_thawRequestId].nextRequest;
293293
}
294294

295295
/**

packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol

+12-12
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
525525
assertEq(thawRequestId, expectedThawRequestId);
526526
assertEq(afterThawRequest.shares, thawingShares);
527527
assertEq(afterThawRequest.thawingUntil, block.timestamp + beforeProvision.thawingPeriod);
528-
assertEq(afterThawRequest.next, bytes32(0));
528+
assertEq(afterThawRequest.nextRequest, bytes32(0));
529529
assertEq(
530530
afterThawRequestList.head,
531531
beforeThawRequestList.count == 0 ? thawRequestId : beforeThawRequestList.head
@@ -534,7 +534,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
534534
assertEq(afterThawRequestList.count, beforeThawRequestList.count + 1);
535535
assertEq(afterThawRequestList.nonce, beforeThawRequestList.nonce + 1);
536536
if (beforeThawRequestList.count != 0) {
537-
assertEq(afterPreviousTailThawRequest.next, thawRequestId);
537+
assertEq(afterPreviousTailThawRequest.nextRequest, thawRequestId);
538538
}
539539

540540
return thawRequestId;
@@ -626,7 +626,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
626626
);
627627
assertEq(thawRequest.shares, 0);
628628
assertEq(thawRequest.thawingUntil, 0);
629-
assertEq(thawRequest.next, bytes32(0));
629+
assertEq(thawRequest.nextRequest, bytes32(0));
630630
}
631631
if (calcValues.thawRequestsFulfilledList.length == 0) {
632632
assertEq(afterThawRequestList.head, beforeThawRequestList.head);
@@ -635,7 +635,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
635635
afterThawRequestList.head,
636636
calcValues.thawRequestsFulfilledList.length == beforeThawRequestList.count
637637
? bytes32(0)
638-
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].next
638+
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].nextRequest
639639
);
640640
}
641641
assertEq(
@@ -780,7 +780,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
780780
);
781781
assertEq(thawRequest.shares, 0);
782782
assertEq(thawRequest.thawingUntil, 0);
783-
assertEq(thawRequest.next, bytes32(0));
783+
assertEq(thawRequest.nextRequest, bytes32(0));
784784
}
785785
if (calcValues.thawRequestsFulfilledList.length == 0) {
786786
assertEq(afterThawRequestList.head, beforeValues.thawRequestList.head);
@@ -789,7 +789,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
789789
afterThawRequestList.head,
790790
calcValues.thawRequestsFulfilledList.length == beforeValues.thawRequestList.count
791791
? bytes32(0)
792-
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].next
792+
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].nextRequest
793793
);
794794
}
795795
assertEq(
@@ -1124,7 +1124,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
11241124
assertEq(beforeValues.delegation.shares - shares, afterDelegation.shares);
11251125
assertEq(afterThawRequest.shares, calcValues.thawingShares);
11261126
assertEq(afterThawRequest.thawingUntil, calcValues.thawingUntil);
1127-
assertEq(afterThawRequest.next, bytes32(0));
1127+
assertEq(afterThawRequest.nextRequest, bytes32(0));
11281128
assertEq(calcValues.thawRequestId, afterThawRequestList.tail);
11291129
assertEq(beforeValues.thawRequestList.nonce + 1, afterThawRequestList.nonce);
11301130
assertEq(beforeValues.thawRequestList.count + 1, afterThawRequestList.count);
@@ -1329,7 +1329,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
13291329
);
13301330
assertEq(thawRequest.shares, 0);
13311331
assertEq(thawRequest.thawingUntil, 0);
1332-
assertEq(thawRequest.next, bytes32(0));
1332+
assertEq(thawRequest.nextRequest, bytes32(0));
13331333
}
13341334
if (calcValues.thawRequestsFulfilledList.length == 0) {
13351335
assertEq(afterValues.thawRequestList.head, beforeValues.thawRequestList.head);
@@ -1338,7 +1338,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
13381338
afterValues.thawRequestList.head,
13391339
calcValues.thawRequestsFulfilledList.length == beforeValues.thawRequestList.count
13401340
? bytes32(0)
1341-
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].next
1341+
: calcValues.thawRequestsFulfilledList[calcValues.thawRequestsFulfilledList.length - 1].nextRequest
13421342
);
13431343
}
13441344
assertEq(
@@ -2437,7 +2437,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
24372437
} else {
24382438
break;
24392439
}
2440-
thawRequestId = thawRequest.next;
2440+
thawRequestId = thawRequest.nextRequest;
24412441
}
24422442

24432443
// we need to do a second pass because solidity doesnt allow dynamic arrays on memory
@@ -2464,12 +2464,12 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
24642464
}
24652465
thawRequestData.thawRequestsFulfilledListIds[i] = thawRequestId;
24662466
thawRequestData.thawRequestsFulfilledList[i] = _getThawRequest(params.thawRequestType, thawRequestId);
2467-
thawRequestId = thawRequestData.thawRequestsFulfilledList[i].next;
2467+
thawRequestId = thawRequestData.thawRequestsFulfilledList[i].nextRequest;
24682468
i++;
24692469
} else {
24702470
break;
24712471
}
2472-
thawRequestId = thawRequest.next;
2472+
thawRequestId = thawRequest.nextRequest;
24732473
}
24742474

24752475
assertEq(thawRequestsFulfilled, thawRequestData.thawRequestsFulfilledList.length);

packages/subgraph-service/contracts/utilities/AllocationManager.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
3232
using PPMMath for uint256;
3333
using TokenUtils for IGraphToken;
3434

35-
///@dev EIP712 typehash for allocation proof
36-
bytes32 private constant EIP712_ALLOCATION_PROOF_TYPEHASH =
35+
///@dev EIP712 typehash for allocation id proof
36+
bytes32 private constant EIP712_ALLOCATION_ID_PROOF_TYPEHASH =
3737
keccak256("AllocationIdProof(address indexer,address allocationId)");
3838

3939
/**
@@ -465,7 +465,7 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
465465
* @return The encoded allocation proof
466466
*/
467467
function _encodeAllocationProof(address _indexer, address _allocationId) internal view returns (bytes32) {
468-
return _hashTypedDataV4(keccak256(abi.encode(EIP712_ALLOCATION_PROOF_TYPEHASH, _indexer, _allocationId)));
468+
return _hashTypedDataV4(keccak256(abi.encode(EIP712_ALLOCATION_ID_PROOF_TYPEHASH, _indexer, _allocationId)));
469469
}
470470

471471
/**

0 commit comments

Comments
 (0)