Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unused errors, use LegacyAllocationAlreadyMigrated to prevent migrating a legacy allocation twice (OZ N-02) #1029

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ interface IDataService {
*/
event ServiceProviderSlashed(address indexed serviceProvider, uint256 tokens);

/**
* @notice Thrown to signal that a feature is not implemented by a data service.
*/
error DataServiceFeatureNotImplemented();

/**
* @notice Registers a service provider with the data service. The service provider can now
* start providing the service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,20 @@ library LegacyAllocation {
/**
* @notice Migrate a legacy allocation
* @dev Requirements:
* - The allocation must not exist
* - The allocation must not have been previously migrated
* @param self The legacy allocation list mapping
* @param indexer The indexer that owns the allocation
* @param allocationId The allocation id
* @param subgraphDeploymentId The subgraph deployment id the allocation is for
* @custom:error LegacyAllocationAlreadyMigrated if the allocation has already been migrated
*/
function migrate(
mapping(address => State) storage self,
address indexer,
address allocationId,
bytes32 subgraphDeploymentId
) internal {
require(!self[allocationId].exists(), LegacyAllocationExists(allocationId));
require(!self[allocationId].exists(), LegacyAllocationAlreadyMigrated(allocationId));

State memory allocation = State({ indexer: indexer, subgraphDeploymentId: subgraphDeploymentId });
self[allocationId] = allocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
*/
error AllocationManagerInvalidZeroAllocationId();

/**
* @notice Thrown when attempting to create an allocation with zero tokens
* @param allocationId The id of the allocation
*/
error AllocationManagerZeroTokensAllocation(address allocationId);

/**
* @notice Thrown when attempting to collect indexing rewards on a closed allocationl
* @param allocationId The id of the allocation
Expand Down Expand Up @@ -175,7 +169,7 @@ abstract contract AllocationManager is EIP712Upgradeable, GraphDirectory, Alloca
/**
* @notice Imports a legacy allocation id into the subgraph service
* This is a governor only action that is required to prevent indexers from re-using allocation ids from the
* legacy staking contract.
* legacy staking contract. It will revert with LegacyAllocationAlreadyMigrated if the allocation has already been migrated.
* @param _indexer The address of the indexer
* @param _allocationId The id of the allocation
* @param _subgraphDeploymentId The id of the subgraph deployment
Expand Down
Loading