Skip to content

Commit 0e203bc

Browse files
f: rename upgrade to update
1 parent 4c6eebf commit 0e203bc

File tree

12 files changed

+107
-107
lines changed

12 files changed

+107
-107
lines changed

packages/horizon/contracts/interfaces/IRecurringCollector.sol

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
6161
bytes metadata;
6262
}
6363

64-
/// @notice A representation of a signed Recurring Collection Agreement Upgrade (RCAU)
64+
/// @notice A representation of a signed Recurring Collection Agreement Update (RCAU)
6565
struct SignedRCAU {
6666
// The RCAU
67-
RecurringCollectionAgreementUpgrade rcau;
67+
RecurringCollectionAgreementUpdate rcau;
6868
// Signature - 65 bytes: r (32 Bytes) || s (32 Bytes) || v (1 Byte)
6969
bytes signature;
7070
}
7171

72-
struct RecurringCollectionAgreementUpgrade {
72+
struct RecurringCollectionAgreementUpdate {
7373
// The agreement ID
7474
bytes16 agreementId;
7575
// The deadline for upgrading
@@ -176,24 +176,24 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
176176
);
177177

178178
/**
179-
* @notice Emitted when an agreement is upgraded
179+
* @notice Emitted when an agreement is updated
180180
* @param dataService The address of the data service
181181
* @param payer The address of the payer
182182
* @param serviceProvider The address of the service provider
183183
* @param agreementId The agreement ID
184-
* @param upgradedAt The timestamp when the agreement was upgraded
184+
* @param updatedAt The timestamp when the agreement was updated
185185
* @param endsAt The timestamp when the agreement ends
186186
* @param maxInitialTokens The maximum amount of tokens that can be collected in the first collection
187187
* @param maxOngoingTokensPerSecond The maximum amount of tokens that can be collected per second
188188
* @param minSecondsPerCollection The minimum amount of seconds that must pass between collections
189189
* @param maxSecondsPerCollection The maximum amount of seconds that can pass between collections
190190
*/
191-
event AgreementUpgraded(
191+
event AgreementUpdated(
192192
address indexed dataService,
193193
address indexed payer,
194194
address indexed serviceProvider,
195195
bytes16 agreementId,
196-
uint64 upgradedAt,
196+
uint64 updatedAt,
197197
uint64 endsAt,
198198
uint256 maxInitialTokens,
199199
uint256 maxOngoingTokensPerSecond,
@@ -308,9 +308,9 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
308308
function cancel(bytes16 agreementId, CancelAgreementBy by) external;
309309

310310
/**
311-
* @dev Upgrade an indexing agreement.
311+
* @dev Update an indexing agreement.
312312
*/
313-
function upgrade(SignedRCAU calldata signedRCAU) external;
313+
function update(SignedRCAU calldata signedRCAU) external;
314314

315315
/**
316316
* @dev Computes the hash of a RecurringCollectionAgreement (RCA).
@@ -320,11 +320,11 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
320320
function encodeRCA(RecurringCollectionAgreement calldata rca) external view returns (bytes32);
321321

322322
/**
323-
* @dev Computes the hash of a RecurringCollectionAgreementUpgrade (RCAU).
323+
* @dev Computes the hash of a RecurringCollectionAgreementUpdate (RCAU).
324324
* @param rcau The RCAU for which to compute the hash.
325325
* @return The hash of the RCAU.
326326
*/
327-
function encodeRCAU(RecurringCollectionAgreementUpgrade calldata rcau) external view returns (bytes32);
327+
function encodeRCAU(RecurringCollectionAgreementUpdate calldata rcau) external view returns (bytes32);
328328

329329
/**
330330
* @dev Recovers the signer address of a signed RecurringCollectionAgreement (RCA).
@@ -334,7 +334,7 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
334334
function recoverRCASigner(SignedRCA calldata signedRCA) external view returns (address);
335335

336336
/**
337-
* @dev Recovers the signer address of a signed RecurringCollectionAgreementUpgrade (RCAU).
337+
* @dev Recovers the signer address of a signed RecurringCollectionAgreementUpdate (RCAU).
338338
* @param signedRCAU The SignedRCAU containing the RCAU and its signature.
339339
* @return The address of the signer.
340340
*/

packages/horizon/contracts/payments/collectors/RecurringCollector.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
2727
"RecurringCollectionAgreement(bytes16 agreementId,uint256 deadline,uint256 endsAt,address payer,address dataService,address serviceProvider,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata)"
2828
);
2929

30-
/// @notice The EIP712 typehash for the RecurringCollectionAgreementUpgrade struct
30+
/// @notice The EIP712 typehash for the RecurringCollectionAgreementUpdate struct
3131
bytes32 public constant EIP712_RCAU_TYPEHASH =
3232
keccak256(
33-
"RecurringCollectionAgreementUpgrade(bytes16 agreementId,uint256 deadline,uint256 endsAt,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata)"
33+
"RecurringCollectionAgreementUpdate(bytes16 agreementId,uint256 deadline,uint256 endsAt,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata)"
3434
);
3535

3636
/// @notice Tracks agreements
@@ -151,11 +151,11 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
151151
}
152152

153153
/**
154-
* @notice Upgrade an indexing agreement.
155-
* See {IRecurringCollector.upgrade}.
154+
* @notice Update an indexing agreement.
155+
* See {IRecurringCollector.update}.
156156
* @dev Caller must be the data service for the agreement.
157157
*/
158-
function upgrade(SignedRCAU calldata signedRCAU) external {
158+
function update(SignedRCAU calldata signedRCAU) external {
159159
require(
160160
signedRCAU.rcau.deadline >= block.timestamp,
161161
RecurringCollectorAgreementDeadlineElapsed(signedRCAU.rcau.deadline)
@@ -174,15 +174,15 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
174174
// check that the voucher is signed by the payer (or proxy)
175175
_requireAuthorizedRCAUSigner(signedRCAU, agreement.payer);
176176

177-
// upgrade the agreement
177+
// update the agreement
178178
agreement.endsAt = signedRCAU.rcau.endsAt;
179179
agreement.maxInitialTokens = signedRCAU.rcau.maxInitialTokens;
180180
agreement.maxOngoingTokensPerSecond = signedRCAU.rcau.maxOngoingTokensPerSecond;
181181
agreement.minSecondsPerCollection = signedRCAU.rcau.minSecondsPerCollection;
182182
agreement.maxSecondsPerCollection = signedRCAU.rcau.maxSecondsPerCollection;
183183
_requireValidAgreement(agreement);
184184

185-
emit AgreementUpgraded(
185+
emit AgreementUpdated(
186186
agreement.dataService,
187187
agreement.payer,
188188
agreement.serviceProvider,
@@ -220,7 +220,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
220220
/**
221221
* @notice See {IRecurringCollector.encodeRCAU}
222222
*/
223-
function encodeRCAU(RecurringCollectionAgreementUpgrade calldata rcau) external view returns (bytes32) {
223+
function encodeRCAU(RecurringCollectionAgreementUpdate calldata rcau) external view returns (bytes32) {
224224
return _encodeRCAU(rcau);
225225
}
226226

@@ -409,7 +409,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
409409
/**
410410
* @notice See {IRecurringCollector.encodeRCAU}
411411
*/
412-
function _encodeRCAU(RecurringCollectionAgreementUpgrade memory _rcau) private view returns (bytes32) {
412+
function _encodeRCAU(RecurringCollectionAgreementUpdate memory _rcau) private view returns (bytes32) {
413413
return
414414
_hashTypedDataV4(
415415
keccak256(

packages/horizon/test/unit/payments/recurring-collector/RecurringCollectorHelper.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ contract RecurringCollectorHelper is AuthorizableHelper, Bounder {
3131
}
3232

3333
function generateSignedRCAU(
34-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau,
34+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau,
3535
uint256 signerPrivateKey
3636
) public view returns (IRecurringCollector.SignedRCAU memory) {
3737
bytes32 messageHash = collector.encodeRCAU(rcau);
@@ -86,8 +86,8 @@ contract RecurringCollectorHelper is AuthorizableHelper, Bounder {
8686
}
8787

8888
function sensibleRCAU(
89-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau
90-
) public view returns (IRecurringCollector.RecurringCollectionAgreementUpgrade memory) {
89+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau
90+
) public view returns (IRecurringCollector.RecurringCollectionAgreementUpdate memory) {
9191
rcau.minSecondsPerCollection = _sensibleMinSecondsPerCollection(rcau.minSecondsPerCollection);
9292
rcau.maxSecondsPerCollection = _sensibleMaxSecondsPerCollection(
9393
rcau.maxSecondsPerCollection,

packages/horizon/test/unit/payments/recurring-collector/shared.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ contract RecurringCollectorSharedTest is Test, Bounder {
2424
uint256 unboundedSignerKey;
2525
}
2626

27-
struct FuzzyTestUpgrade {
27+
struct FuzzyTestUpdate {
2828
FuzzyTestAccept fuzzyTestAccept;
29-
IRecurringCollector.RecurringCollectionAgreementUpgrade rcau;
29+
IRecurringCollector.RecurringCollectionAgreementUpdate rcau;
3030
}
3131

3232
RecurringCollector internal _recurringCollector;

packages/horizon/test/unit/payments/recurring-collector/upgrade.t.sol renamed to packages/horizon/test/unit/payments/recurring-collector/update.t.sol

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import { IRecurringCollector } from "../../../../contracts/interfaces/IRecurring
55

66
import { RecurringCollectorSharedTest } from "./shared.t.sol";
77

8-
contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
8+
contract RecurringCollectorUpdateTest is RecurringCollectorSharedTest {
99
/*
1010
* TESTS
1111
*/
1212

1313
/* solhint-disable graph/func-name-mixedcase */
1414

15-
function test_Upgrade_Revert_WhenUpgradeElapsed(
15+
function test_Update_Revert_WhenUpdateElapsed(
1616
IRecurringCollector.RecurringCollectionAgreement memory rca,
17-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau,
18-
uint256 unboundedUpgradeSkip
17+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau,
18+
uint256 unboundedUpdateSkip
1919
) public {
2020
rca = _recurringCollectorHelper.sensibleRCA(rca);
2121
rcau = _recurringCollectorHelper.sensibleRCAU(rcau);
2222
rcau.agreementId = rca.agreementId;
2323

24-
boundSkipCeil(unboundedUpgradeSkip, type(uint64).max);
24+
boundSkipCeil(unboundedUpdateSkip, type(uint64).max);
2525
rcau.deadline = uint64(bound(rcau.deadline, 0, block.timestamp - 1));
2626
IRecurringCollector.SignedRCAU memory signedRCAU = IRecurringCollector.SignedRCAU({
2727
rcau: rcau,
@@ -34,12 +34,12 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
3434
);
3535
vm.expectRevert(expectedErr);
3636
vm.prank(rca.dataService);
37-
_recurringCollector.upgrade(signedRCAU);
37+
_recurringCollector.update(signedRCAU);
3838
}
3939

40-
function test_Upgrade_Revert_WhenNeverAccepted(
40+
function test_Update_Revert_WhenNeverAccepted(
4141
IRecurringCollector.RecurringCollectionAgreement memory rca,
42-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau
42+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau
4343
) public {
4444
rca = _recurringCollectorHelper.sensibleRCA(rca);
4545
rcau = _recurringCollectorHelper.sensibleRCAU(rcau);
@@ -58,20 +58,20 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
5858
);
5959
vm.expectRevert(expectedErr);
6060
vm.prank(rca.dataService);
61-
_recurringCollector.upgrade(signedRCAU);
61+
_recurringCollector.update(signedRCAU);
6262
}
6363

64-
function test_Upgrade_Revert_WhenDataServiceNotAuthorized(
65-
FuzzyTestUpgrade calldata fuzzyTestUpgrade,
64+
function test_Update_Revert_WhenDataServiceNotAuthorized(
65+
FuzzyTestUpdate calldata fuzzyTestUpdate,
6666
address notDataService
6767
) public {
68-
vm.assume(fuzzyTestUpgrade.fuzzyTestAccept.rca.dataService != notDataService);
68+
vm.assume(fuzzyTestUpdate.fuzzyTestAccept.rca.dataService != notDataService);
6969
(IRecurringCollector.SignedRCA memory accepted, uint256 signerKey) = _sensibleAuthorizeAndAccept(
70-
fuzzyTestUpgrade.fuzzyTestAccept
70+
fuzzyTestUpdate.fuzzyTestAccept
7171
);
7272

73-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau = _recurringCollectorHelper.sensibleRCAU(
74-
fuzzyTestUpgrade.rcau
73+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau = _recurringCollectorHelper.sensibleRCAU(
74+
fuzzyTestUpdate.rcau
7575
);
7676
rcau.agreementId = accepted.rca.agreementId;
7777

@@ -87,21 +87,21 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
8787
);
8888
vm.expectRevert(expectedErr);
8989
vm.prank(notDataService);
90-
_recurringCollector.upgrade(signedRCAU);
90+
_recurringCollector.update(signedRCAU);
9191
}
9292

93-
function test_Upgrade_Revert_WhenInvalidSigner(
94-
FuzzyTestUpgrade calldata fuzzyTestUpgrade,
93+
function test_Update_Revert_WhenInvalidSigner(
94+
FuzzyTestUpdate calldata fuzzyTestUpdate,
9595
uint256 unboundedInvalidSignerKey
9696
) public {
9797
(IRecurringCollector.SignedRCA memory accepted, uint256 signerKey) = _sensibleAuthorizeAndAccept(
98-
fuzzyTestUpgrade.fuzzyTestAccept
98+
fuzzyTestUpdate.fuzzyTestAccept
9999
);
100100
uint256 invalidSignerKey = boundKey(unboundedInvalidSignerKey);
101101
vm.assume(signerKey != invalidSignerKey);
102102

103-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau = _recurringCollectorHelper.sensibleRCAU(
104-
fuzzyTestUpgrade.rcau
103+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau = _recurringCollectorHelper.sensibleRCAU(
104+
fuzzyTestUpdate.rcau
105105
);
106106
rcau.agreementId = accepted.rca.agreementId;
107107

@@ -112,15 +112,15 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
112112

113113
vm.expectRevert(IRecurringCollector.RecurringCollectorInvalidSigner.selector);
114114
vm.prank(accepted.rca.dataService);
115-
_recurringCollector.upgrade(signedRCAU);
115+
_recurringCollector.update(signedRCAU);
116116
}
117117

118-
function test_Upgrade_OK(FuzzyTestUpgrade calldata fuzzyTestUpgrade) public {
118+
function test_Update_OK(FuzzyTestUpdate calldata fuzzyTestUpdate) public {
119119
(IRecurringCollector.SignedRCA memory accepted, uint256 signerKey) = _sensibleAuthorizeAndAccept(
120-
fuzzyTestUpgrade.fuzzyTestAccept
120+
fuzzyTestUpdate.fuzzyTestAccept
121121
);
122-
IRecurringCollector.RecurringCollectionAgreementUpgrade memory rcau = _recurringCollectorHelper.sensibleRCAU(
123-
fuzzyTestUpgrade.rcau
122+
IRecurringCollector.RecurringCollectionAgreementUpdate memory rcau = _recurringCollectorHelper.sensibleRCAU(
123+
fuzzyTestUpdate.rcau
124124
);
125125
rcau.agreementId = accepted.rca.agreementId;
126126
IRecurringCollector.SignedRCAU memory signedRCAU = _recurringCollectorHelper.generateSignedRCAU(
@@ -129,7 +129,7 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
129129
);
130130

131131
vm.expectEmit(address(_recurringCollector));
132-
emit IRecurringCollector.AgreementUpgraded(
132+
emit IRecurringCollector.AgreementUpdated(
133133
accepted.rca.dataService,
134134
accepted.rca.payer,
135135
accepted.rca.serviceProvider,
@@ -142,7 +142,7 @@ contract RecurringCollectorUpgradeTest is RecurringCollectorSharedTest {
142142
rcau.maxSecondsPerCollection
143143
);
144144
vm.prank(accepted.rca.dataService);
145-
_recurringCollector.upgrade(signedRCAU);
145+
_recurringCollector.update(signedRCAU);
146146

147147
IRecurringCollector.AgreementData memory agreement = _recurringCollector.getAgreement(accepted.rca.agreementId);
148148
assertEq(rcau.endsAt, agreement.endsAt);

packages/subgraph-service/contracts/SubgraphServiceExtension.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ contract SubgraphServiceExtension is PausableUpgradeable {
1515
_;
1616
}
1717

18-
function upgradeIndexingAgreement(
18+
function updateIndexingAgreement(
1919
address indexer,
2020
IRecurringCollector.SignedRCAU calldata signedRCAU
2121
) external modifiersHack(indexer) {
22-
IndexingAgreement._getManager().upgrade(indexer, signedRCAU);
22+
IndexingAgreement._getManager().update(indexer, signedRCAU);
2323
}
2424

2525
/**

packages/subgraph-service/contracts/interfaces/ISubgraphServiceExtension.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ interface ISubgraphServiceExtension {
1212
// function acceptIndexingAgreement(address allocationId, IRecurringCollector.SignedRCA calldata signedRCA) external;
1313

1414
/**
15-
* @notice Upgrade an indexing agreement.
15+
* @notice Update an indexing agreement.
1616
*/
17-
function upgradeIndexingAgreement(address indexer, IRecurringCollector.SignedRCAU calldata signedRCAU) external;
17+
function updateIndexingAgreement(address indexer, IRecurringCollector.SignedRCAU calldata signedRCAU) external;
1818

1919
/**
2020
* @notice Cancel an indexing agreement by indexer / operator.

packages/subgraph-service/contracts/libraries/Decoder.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ library Decoder {
4747
/**
4848
* @notice Decodes the RCAU metadata.
4949
*
50-
* @param data The data to decode. See {IndexingAgreement.UpgradeIndexingAgreementMetadata}
50+
* @param data The data to decode. See {IndexingAgreement.UpdateIndexingAgreementMetadata}
5151
* @return The decoded data
5252
*/
5353
function decodeRCAUMetadata(
5454
bytes memory data
55-
) public pure returns (IndexingAgreement.UpgradeIndexingAgreementMetadata memory) {
55+
) public pure returns (IndexingAgreement.UpdateIndexingAgreementMetadata memory) {
5656
try UnsafeDecoder.decodeRCAUMetadata_(data) returns (
57-
IndexingAgreement.UpgradeIndexingAgreementMetadata memory metadata
57+
IndexingAgreement.UpdateIndexingAgreementMetadata memory metadata
5858
) {
5959
return metadata;
6060
} catch {

0 commit comments

Comments
 (0)