solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.05k stars 4.21k forks source link

rpc: Account parser treats any allocated system account as uninitialized nonce #16569

Closed jstarry closed 3 years ago

jstarry commented 3 years ago

Problem

When requesting parsed account info for an allocated system account, the RPC response always indicates that the account is an uninitialized nonce regardless of size as long as allocated data is greater than zero

curl http://devnet.solana.com -X POST -H "Content-Type: application/json" -d '  
  {"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["56UXxC5viVZqHRsqVb1jCpmZ2aX2TcgDuj7CgDt8Rhz8", {"encoding": "jsonParsed"}]}
' | jq .            
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 49887288
    },
    "value": {
      "data": {
        "parsed": {
          "type": "uninitialized"
        },
        "program": "nonce",
        "space": 93
      },
      "executable": false,
      "lamports": 1538160,
      "owner": "11111111111111111111111111111111",
      "rentEpoch": 115
    }
  },
  "id": 1
}

Proposed Solution

Only parse initialized nonce accounts, treat all other allocated accounts as un-parseable system accounts

tag @CriesofCarrots

jstarry commented 3 years ago

Thanks for jumping on this @CriesofCarrots!