graph-tooling icon indicating copy to clipboard operation
graph-tooling copied to clipboard

[request] Add `stopBlock` to manifest.

Open Benjythebee opened this issue 4 years ago • 1 comments

Heya, let me know if this is a good feature or not. Essentially I think we should have the ability to set a stopBlock to a subgraph when listening to a contract. Similarly to the startBlock the stopblock would tell us when to stop listening to a contract.

Example use case:

  • you have a contract lottery-v1 and a subgraph.
  • for some reason you have to create a lottery-v2.
  • you successfully copy today's data (current holders of tickets for example) from lottery-v1 to lottery-v2 (lottery-v1 becomes deprecated).
  • The issue you have now is that you completely lost all the past transactions of lottery-v1 in the subgraph.

Adding both contracts to the subgraph will end up with a period where both contracts are being listened to and both would end up re-writing the same Entities in the subgraph.

Therefore I suggest adding a stopblock so it's possible to listen to contract lottery-v1 until the block number where lottery-v2 takes over. This way we keep the entities created by lottery-v1 and we keep going with the new contract.

Obviously this scenario is specific, but I believe there are more use-cases to this feature.

Benjythebee avatar Jul 19 '21 04:07 Benjythebee

I think this is supported now?

https://github.com/graphprotocol/graph-node/issues/3504

PaulRBerg avatar May 18 '25 10:05 PaulRBerg