Search code examples
nearprotocol

State too large to be viewed


I am trying to debug the gas usage of the following transaction: https://explorer.near.org/transactions/HLCCBGUQLE1jUPJ7cSeaH9VPt4AAGhBLehB2F6zrx58H by requesting the state from the archival node with intention to patch it on the sandbox, however, RPC is returning the following error:

{
  code: -32000,
  message: "Server error",
  data: "State of contract jerry.zest.near is too large to be viewed",
}

I was not able to find the option of paginating the state. Is there a suggestion on what should be done?


Solution

  • I do not believe it can be done with existing RPC nodes.

    Moreover, to the best of my knowledge the limit for the state request is not configurable. So the solution is to patch nearcore:

    @@ -318,7 +318,7 @@ fn default_view_client_throttle_period() -> Duration {
     }
     
     fn default_trie_viewer_state_size_limit() -> Option<u64> {
    -    Some(50_000)
    +    Some(50_000_000)
     }
    

    And run your own RPC node compiled with such a patch.