Skip to content

Commit fb2183d

Browse files
HACK: remove extension - 22.884
1 parent ebb38aa commit fb2183d

File tree

14 files changed

+132
-250
lines changed

14 files changed

+132
-250
lines changed

packages/horizon/contracts/data-service/libraries/ProvisionManagerLib.sol

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/horizon/contracts/data-service/utilities/ProvisionManager.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { PPMMath } from "../../libraries/PPMMath.sol";
99
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
1010
import { GraphDirectory } from "../../utilities/GraphDirectory.sol";
1111
import { ProvisionManagerV1Storage } from "./ProvisionManagerStorage.sol";
12-
import { ProvisionManagerLib } from "../libraries/ProvisionManagerLib.sol";
1312

1413
/**
1514
* @title ProvisionManager contract
@@ -112,7 +111,10 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
112111
* @param serviceProvider The address of the service provider.
113112
*/
114113
modifier onlyAuthorizedForProvision(address serviceProvider) {
115-
ProvisionManagerLib.requireAuthorizedForProvision(_graphStaking(), serviceProvider, address(this), msg.sender);
114+
require(
115+
_graphStaking().isAuthorized(serviceProvider, address(this), msg.sender),
116+
ProvisionManagerNotAuthorized(serviceProvider, msg.sender)
117+
);
116118
_;
117119
}
118120

@@ -126,10 +128,6 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
126128
_;
127129
}
128130

129-
function requireValidProvision(address serviceProvider) external view {
130-
_requireValidProvision(serviceProvider);
131-
}
132-
133131
/**
134132
* @notice Initializes the contract and any parent contracts.
135133
*/

packages/subgraph-service/contracts/DisputeManager.sol

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { IGraphToken } from "@graphprotocol/contracts/contracts/token/IGraphToke
55
import { IHorizonStaking } from "@graphprotocol/horizon/contracts/interfaces/IHorizonStaking.sol";
66
import { IDisputeManager } from "./interfaces/IDisputeManager.sol";
77
import { ISubgraphService } from "./interfaces/ISubgraphService.sol";
8-
import { ISubgraphServiceExtended } from "./interfaces/ISubgraphServiceExtended.sol";
98

109
import { TokenUtils } from "@graphprotocol/contracts/contracts/utils/TokenUtils.sol";
1110
import { PPMMath } from "@graphprotocol/horizon/contracts/libraries/PPMMath.sol";
@@ -536,9 +535,7 @@ contract DisputeManager is
536535
uint256 _entities,
537536
uint256 _blockNumber
538537
) private returns (bytes32) {
539-
IndexingAgreement.AgreementWrapper memory wrapper = _getSubgraphServiceExtended().getIndexingAgreement(
540-
_agreementId
541-
);
538+
IndexingAgreement.AgreementWrapper memory wrapper = _getSubgraphService().getIndexingAgreement(_agreementId);
542539

543540
// Agreement must have been collected on and be a version 1
544541
require(
@@ -768,16 +765,6 @@ contract DisputeManager is
768765
return subgraphService;
769766
}
770767

771-
/**
772-
* @notice Get the address of the extended subgraph service
773-
* @dev Will revert if the subgraph service is not set
774-
* @return The extended subgraph service address
775-
*/
776-
function _getSubgraphServiceExtended() private view returns (ISubgraphServiceExtended) {
777-
require(address(subgraphService) != address(0), DisputeManagerSubgraphServiceNotSet());
778-
return ISubgraphServiceExtended(address(subgraphService));
779-
}
780-
781768
/**
782769
* @notice Returns whether the dispute is for a conflicting attestation or not.
783770
* @param _dispute Dispute

packages/subgraph-service/contracts/SubgraphService.sol

Lines changed: 73 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ contract SubgraphService is
7373
address disputeManager,
7474
address graphTallyCollector,
7575
address curation,
76-
address recurringCollector,
77-
address extension
76+
address recurringCollector
7877
)
7978
DataService(graphController)
80-
Directory(address(this), disputeManager, graphTallyCollector, curation, recurringCollector, extension)
79+
Directory(address(this), disputeManager, graphTallyCollector, curation, recurringCollector)
8180
{
8281
_disableInitializers();
8382
}
@@ -100,35 +99,6 @@ contract SubgraphService is
10099
_setStakeToFeesRatio(stakeToFeesRatio_);
101100
}
102101

103-
/**
104-
* @notice Delegates the call to the SubgraphServiceExtension implementation.
105-
* @dev This function does not return to its internal call site, it will return directly to the
106-
* external caller.
107-
*/
108-
// solhint-disable-next-line payable-fallback, no-complex-fallback
109-
fallback() external {
110-
address extImpl = _subgraphServiceExtensionImpl();
111-
require(extImpl != address(0), "only through proxy");
112-
113-
// solhint-disable-next-line no-inline-assembly
114-
assembly {
115-
// copy function selector and any arguments
116-
calldatacopy(0, 0, calldatasize())
117-
// execute function call using the extension implementation
118-
let result := delegatecall(gas(), extImpl, 0, calldatasize(), 0, 0)
119-
// get any return value
120-
returndatacopy(0, 0, returndatasize())
121-
// return any return value or error back to the caller
122-
switch result
123-
case 0 {
124-
revert(0, returndatasize())
125-
}
126-
default {
127-
return(0, returndatasize())
128-
}
129-
}
130-
}
131-
132102
/**
133103
* @notice
134104
* @dev Implements {IDataService.register}
@@ -420,7 +390,7 @@ contract SubgraphService is
420390

421391
/**
422392
* @notice Accept an indexing agreement.
423-
* See {ISubgraphServiceExtended.acceptIndexingAgreement}.
393+
* See {ISubgraphService.acceptIndexingAgreement}.
424394
*
425395
* Requirements:
426396
* - The agreement's indexer must be registered
@@ -452,8 +422,76 @@ contract SubgraphService is
452422
IndexingAgreement._getManager().accept(_allocations, allocationId, signedRCA);
453423
}
454424

455-
function requireRegisteredIndexer(address indexer) external view {
456-
_requireRegisteredIndexer(indexer);
425+
/**
426+
* @notice Update an indexing agreement.
427+
* See {IndexingAgreement.update}.
428+
*
429+
* Requirements:
430+
* - The contract must not be paused
431+
* - The indexer must be valid
432+
*
433+
* @param indexer The indexer address
434+
* @param signedRCAU The signed Recurring Collection Agreement Update
435+
*/
436+
function updateIndexingAgreement(
437+
address indexer,
438+
IRecurringCollector.SignedRCAU calldata signedRCAU
439+
)
440+
external
441+
whenNotPaused
442+
onlyAuthorizedForProvision(indexer)
443+
onlyValidProvision(indexer)
444+
onlyRegisteredIndexer(indexer)
445+
{
446+
IndexingAgreement._getManager().update(indexer, signedRCAU);
447+
}
448+
449+
/**
450+
* @notice Cancel an indexing agreement by indexer / operator.
451+
* See {IndexingAgreement.cancel}.
452+
*
453+
* @dev Can only be canceled on behalf of a valid indexer.
454+
*
455+
* Requirements:
456+
* - The contract must not be paused
457+
* - The indexer must be valid
458+
*
459+
* @param indexer The indexer address
460+
* @param agreementId The id of the agreement
461+
*/
462+
function cancelIndexingAgreement(
463+
address indexer,
464+
bytes16 agreementId
465+
)
466+
external
467+
whenNotPaused
468+
onlyAuthorizedForProvision(indexer)
469+
onlyValidProvision(indexer)
470+
onlyRegisteredIndexer(indexer)
471+
{
472+
IndexingAgreement._getManager().cancel(indexer, agreementId);
473+
}
474+
475+
/**
476+
* @notice Cancel an indexing agreement by payer / signer.
477+
* See {ISubgraphService.cancelIndexingAgreementByPayer}.
478+
*
479+
* Requirements:
480+
* - The caller must be authorized by the payer
481+
* - The agreement must be active
482+
*
483+
* Emits {IndexingAgreementCanceled} event
484+
*
485+
* @param agreementId The id of the agreement
486+
*/
487+
function cancelIndexingAgreementByPayer(bytes16 agreementId) external whenNotPaused {
488+
IndexingAgreement._getManager().cancelByPayer(agreementId);
489+
}
490+
491+
function getIndexingAgreement(
492+
bytes16 agreementId
493+
) external view returns (IndexingAgreement.AgreementWrapper memory) {
494+
return IndexingAgreement._getManager().get(agreementId);
457495
}
458496

459497
/// @inheritdoc ISubgraphService

packages/subgraph-service/contracts/SubgraphServiceExtension.sol

Lines changed: 0 additions & 102 deletions
This file was deleted.

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.27;
44
import { IDataServiceFees } from "@graphprotocol/horizon/contracts/data-service/interfaces/IDataServiceFees.sol";
55
import { IGraphPayments } from "@graphprotocol/horizon/contracts/interfaces/IGraphPayments.sol";
66

7+
import { IndexingAgreement } from "../libraries/IndexingAgreement.sol";
78
import { Allocation } from "../libraries/Allocation.sol";
89
import { LegacyAllocation } from "../libraries/LegacyAllocation.sol";
910

@@ -266,6 +267,34 @@ interface ISubgraphService is IDataServiceFees {
266267
*/
267268
function acceptIndexingAgreement(address allocationId, IRecurringCollector.SignedRCA calldata signedRCA) external;
268269

270+
/**
271+
* @notice Update an indexing agreement.
272+
* @param indexer The address of the indexer
273+
* @param signedRCAU The signed recurring collector agreement update (RCAU) that the indexer accepts
274+
*/
275+
function updateIndexingAgreement(address indexer, IRecurringCollector.SignedRCAU calldata signedRCAU) external;
276+
277+
/**
278+
* @notice Cancel an indexing agreement by indexer / operator.
279+
* @param indexer The address of the indexer
280+
* @param agreementId The id of the indexing agreement
281+
*/
282+
function cancelIndexingAgreement(address indexer, bytes16 agreementId) external;
283+
284+
/**
285+
* @notice Cancel an indexing agreement by payer / signer.
286+
* @param agreementId The id of the indexing agreement
287+
*/
288+
function cancelIndexingAgreementByPayer(bytes16 agreementId) external;
289+
290+
/**
291+
* @notice Get the indexing agreement for a given agreement ID.
292+
* @param agreementId The id of the indexing agreement
293+
*/
294+
function getIndexingAgreement(
295+
bytes16 agreementId
296+
) external view returns (IndexingAgreement.AgreementWrapper memory);
297+
269298
/**
270299
* @notice Gets the details of an allocation
271300
* For legacy allocations use {getLegacyAllocation}

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

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)