Skip to content

fix: prevent indexer lockout in subgraph service (OZ CR-02) #1127

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

Open
wants to merge 1 commit into
base: horizon-oz2/cr01-collection-id-typehash
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ contract SubgraphService is
function acceptProvisionPendingParameters(
address indexer,
bytes calldata
) external override onlyAuthorizedForProvision(indexer) onlyRegisteredIndexer(indexer) whenNotPaused {
) external override onlyAuthorizedForProvision(indexer) whenNotPaused {
_checkProvisionTokens(indexer);
_acceptProvisionParameters(indexer);
emit ProvisionPendingParametersAccepted(indexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,24 @@ contract SubgraphServiceProvisionAcceptTest is SubgraphServiceTest {
_acceptProvision(users.indexer, "");
}

function test_SubgraphService_Provision_Accept_RevertWhen_NotRegistered() public useIndexer {
vm.expectRevert(
abi.encodeWithSelector(ISubgraphService.SubgraphServiceIndexerNotRegistered.selector, users.indexer)
);
subgraphService.acceptProvisionPendingParameters(users.indexer, "");
function test_SubgraphService_Provision_Accept_When_NotRegistered(
uint256 tokens,
uint32 newVerifierCut,
uint64 newDisputePeriod
) public useIndexer {
tokens = bound(tokens, minimumProvisionTokens, MAX_TOKENS);
vm.assume(newVerifierCut >= fishermanRewardPercentage);
vm.assume(newVerifierCut <= MAX_PPM);
newDisputePeriod = uint64(bound(newDisputePeriod, disputePeriod, MAX_WAIT_PERIOD));

// Setup indexer but dont register
_createProvision(users.indexer, tokens, fishermanRewardPercentage, disputePeriod);

// Update parameters with new values
_setProvisionParameters(users.indexer, address(subgraphService), newVerifierCut, newDisputePeriod);

// Accept provision and check parameters
_acceptProvision(users.indexer, "");
}

function test_SubgraphService_Provision_Accept_RevertWhen_NotAuthorized() public {
Expand Down