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

[Access] Getting account from local storage returns not found error #4824

Closed
Tracked by #4637
peterargue opened this issue Oct 16, 2023 · 3 comments · Fixed by #4862
Closed
Tracked by #4637

[Access] Getting account from local storage returns not found error #4824

peterargue opened this issue Oct 16, 2023 · 3 comments · Fixed by #4862
Assignees
Labels
Bug Something isn't working Execution Cadence Execution Team

Comments

@peterargue
Copy link
Contributor

When getting an account from local storage on an Access node, a NotFound error is returned for accounts with no contracts deployed. e.g.

rpc error: code = NotFound desc = account with address 232f1bc00d90a1c2 not found: failed to get account (232f1bc00d90a1c2) at block (18644be942ea58275cfc9523bcf359816dd72559c0c3c793c1e930f68689980e): cannot get account, this error usually happens if the reference block for this query is not set to a recent block: cannot get deployed contract names: failed to read 232f1bc00d90a1c2/#636f6e74726163745f6e616d6573: [Failure Code: 2002] ledger returns unsuccessful: get register failed: key not found

This points to an error at this line:

encContractNames, err := a.GetValue(flow.ContractNamesRegisterID(address))
if err != nil {
return nil, fmt.Errorf("cannot get deployed contract names: %w", err)
}

@peterargue peterargue added Bug Something isn't working Execution Cadence Execution Team labels Oct 16, 2023
@sideninja sideninja self-assigned this Oct 20, 2023
@janezpodhostnik
Copy link
Contributor

janezpodhostnik commented Oct 20, 2023

This is a ledger failure... something in the ledger returned an error.
for accounts with no contracts, the ledger should return an empty payload (because nothing was saved to the contracts register yet) but the ledger returns an error instead.

Are we returning an error when a key is not found? That is not the current behaviour of the ledger...

@sideninja
Copy link
Contributor

Yes we are, will change that behavior after I can confirm it's not expected somewhere else.
I guess with that PR I should also update the comment defining this behaviour on ledger?

// Get returns values for the given slice of keys at specific state
or you think that's no the right place?

@sideninja
Copy link
Contributor

Actually it's already commented here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Execution Cadence Execution Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants