near / near-cli-rs

near CLI is your human-friendly companion that helps to interact with NEAR Protocol from command line.
https://near.cli.rs
Apache License 2.0
86 stars 52 forks source link

"at-block-height" commands fail under some circumstances #351

Open nadahalli opened 1 week ago

nadahalli commented 1 week ago

I am trying to query balances of some accounts, and when I add the "at-block-height" to the CLI, the command fails. Example:

near contract call-function as-read-only figment.poolv1.near get_account_total_balance text-args '{"account_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.lockup.near"}' network-config mainnet at-block-height 115912864

Here is your console command if you need to script it or re-run:
    near contract call-function as-read-only figment.poolv1.near get_account_total_balance text-args '{"account_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.lockup.near"}' network-config mainnet at-block-height 115912864

Error: 
   0: Failed to fetch query for view method: 'get_account_total_balance' (contract <figment.poolv1.near> on network <mainnet>)
   1: Failed to make a view-function call
   2: internal error: [Some("Failed to serialize JsonRpcError")]

Location:
   src/common.rs:1996

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
frol commented 1 week ago

@nadahalli This usually indicates that the RPC returned something unexpected. Please, check which RPC you are using:

$ near config show-connections

And try using alternative RPCs: https://docs.near.org/api/rpc/providers

P.S. It works for me:

image
frol commented 1 week ago

I have just noticed that it is the same block reported here: https://github.com/near/near-cli-rs/issues/343#issuecomment-2124851751. I will bring it up to the team that operates the archival RPC so that they can fix it.

nadahalli commented 1 week ago

That's just a placeholder block. Please don't report it. I will check and change the RPC providers and see if it helps. Thanks again.

nadahalli commented 1 week ago

I am using "https://archival-rpc.mainnet.near.org/" as my RPC endpoint, and it works fine for most commands. But it fails for this command, for example (with an example real account):

near contract call-function as-read-only figment.poolv1.near get_account_total_balance text-args '{"account_id": "8099235f83b5a160a1c9cf95ecad95fd7a24cd9a.lockup.near"}' network-config mainnet at-block-height 115912864

I have tried all the endpoints listed here: https://docs.near.org/api/rpc/providers - and none of them work.