indexer
indexer copied to clipboard
Use contract calls when confirming `allocate` action
Currently when confirming an allocate action the network subgraph is queried to get the subgraph deployment. If the process of publishing the subgraph to the network and allocating happened very quickly in sequence the subgraph deployment may not be searchable on the network subgraph yet, leading to the following error SHOULD BE UNREACHABLE: No matching subgraphDeployment (${subgraphDeploymentID.ipfsHash}) found on the network. Code here
To improve robustness of this step we should update the matchingRuleExists function to get this data from the contracts directly (or fall back to the contracts if not available on the network subgraph), so we are not relying on the network subgraph being instantly updated to get this information. Additionally let's take a minute to audit any other confirmation data and update to this more robust method to avoid similar race conditions.
I ended up searching through the contract interface, and I didn't find an extant method for retrieving this.
The motivation is to eliminate a race condition where we are looking to query for a subgraph when it may not yet have been synced. The work changed and was directed towards waiting for the block in which that subgraph had been deployed, instead of querying contracts.