Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got Not found for exist key #668

Open
ilyar opened this issue Dec 8, 2023 · 1 comment
Open

Got Not found for exist key #668

ilyar opened this issue Dec 8, 2023 · 1 comment

Comments

@ilyar
Copy link

ilyar commented Dec 8, 2023

Step 1: Alice has received the public key from her mnemonic phrase and wants to find out her account: ed25519:3fJb5T7zAB7eysUoUyXnhA5cALdQ2GF8vuYZwmiMp16u

Step 2: Alice uses the helper to get her account:

curl -s https://helper.mainnet.near.org/publicKey/ed25519:3fJb5T7zAB7eysUoUyXnhA5cALdQ2GF8vuYZwmiMp16u/accounts

Receives the answer: Not found

Omniscient Bob knows Alice's account and can verify that the public key exists:

curl -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": "dontcare", "method": "query", "params": {"request_type": "view_access_key", "finality": "final", "account_id": "ilyar42.near", "public_key": "ed25519:3fJb5T7zAB7eysUoUyXnhA5cALdQ2GF8vuYZwmiMp16u"}}' https://rpc.mainnet.near.org

got:

{
  "jsonrpc": "2.0",
  "result": {
    "block_hash": "6B3GLFhnCj7zEPyVCZBuDnbmNmgnvMezbANq9KHo2gNj",
    "block_height": 107428409,
    "nonce": 96776901000001,
    "permission": "FullAccess"
  },
  "id": "dontcare"
}

Bob sees that the key exists, but cannot explain to Alice why she cannot get the account name using the public key using the service and assumes that there is an error in the service.

@andy-haynes
Copy link
Collaborator

As a consumer of indexer DB replicas, Contract Helper relies on those upstream databases being up to date. When those databases fall behind, Contract Helper continues to serve old data with no way to indicate its age.

One potential workaround would be to determine the most recent block height from the data available to Contract Helper. If this height is insufficiently recent, the veracity of data returned from Contract Helper endpoints could be challenged. This opens up some potential implementations, if viable:

  • upon receiving empty data, query a new Contract Helper endpoint for its indexer replica block height and determine whether it is recent enough
  • query Contract Helper with a minimum block height, returning an error (rather than empty data) if the indexer replicas are behind it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants