streamingfast / substreams

Powerful Blockchain streaming data engine, based on StreamingFast Firehose technology.
Apache License 2.0
166 stars 46 forks source link

Substreams RPC should return `InvalidArgument` error gRPC code when cursor is after stop block num #556

Open maoueh opened 1 month ago

maoueh commented 1 month ago

If you have a cursor misconfigured and you try to start a request with it but with less blocks, you receive such error:

2024-10-23T10:20:28.010-0400 ERRO (substreams-sink-files) substreams encountered a retryable error {"error": "rpc error: code = Internal desc = build request details: invalid_argument: StartCursor \"c1:17:20999999:215f1fa046ff46999f1a91973d7cc39c6d4e7aa64d3de3a40d31591f543c3386:20999999:215f1fa046ff46999f1a91973d7cc39c6d4e7aa64d3de3a40d31591f543c3386\" is after StopBlockNum 12426741"}

However, the rpc error code returned is Internal, this indicates potential retry. The code here should have been InvalidArgument, the substreams-sink library does not retry in InvalidArgument error as it indicates operator error.