3

I am getting follwing error while fetching Grandpa authority from Validator node:-

[2022-09-12T12:06:27Z INFO  ws] Queuing connection to wss://blockchain/
[2022-09-12T12:06:27Z INFO  substrate_api_client::std::rpc::ws_client] sending request: {"id":"1","jsonrpc":"2.0","method":"state_getStorage","params":["0x3a6772616e6470615f617574686f726974696573","0x922f7b81c4f8b8375a861d879808b9bd3afa557f9ad25401beea9420905ee005"]}
[2022-09-12T12:06:27Z INFO  substrate_api_client::std::rpc::ws_client] Got get_request_msg {"jsonrpc":"2.0","error":{"code":-32000,"message":"Client error: UnknownBlock: State already discarded for BlockId::Hash(0x922f7b81c4f8b8375a861d879808b9bd3afa557f9ad25401beea9420905ee005)"},"id":"1"}
Error: Unable to get grandpa_authorities

Not sure why I am getting the above error?

2
  • "But I guess Validator always runs with pruning mode." Yes they are. What is your question now? Sep 12, 2022 at 13:09
  • why I am getting the above error? :)
    – ZKT
    Sep 12, 2022 at 13:57

1 Answer 1

4

(repost from here, since your title should be easier to find):

Polkadot nodes are configured to prune old blocks to save disk space.
The default configuration is set to 256 past blocks (wiki link).
If you try to query the state of an older block, you will see the error that you experienced:

State already discarded for BlockId::Hash ...

One solution is to configure the node in --pruning=archive mode, which will keep all blocks but requires much more disk space. Or tune it more finely with the --pruning flag, which reads:

--pruning <PRUNING_MODE>
            Specify the state pruning mode, a number of blocks to keep or 'archive'.
            
            Default is to keep only the last 256 blocks, otherwise, the state can be kept for all of
            the blocks (i.e 'archive'), or for all of the canonical blocks (i.e
            'archive-canonical').

Another way is to use an indexer, which is an external application that ingests block data and makes it query-able.
This has the additional advantage that its normally faster since the Polkadot node itself is not build for massive RPC requests into past blocks.

3
  • Just one more question ... if validators are not running in archival mode. Then won't there be an issue of data availability? As there is no incentive to run the validator in archival mode?
    – ZKT
    Sep 13, 2022 at 3:04
  • 1
    No there is no issue. There is no incentive to keep validators running in archive mode. It is not their job to keep the entire chain history. This isn't really needed.
    – bkchr
    Sep 13, 2022 at 10:53
  • 1
    How is that not an issue? Who's job is it?
    – shredding
    Feb 2, 2023 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.