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

[Bug]: /cosmos/auth/v1beta1/account_info/{address} returns 13 if public key is unknown to the account object on-chain #17204

Closed
eckelj opened this issue Jul 31, 2023 · 1 comment · Fixed by #17209
Assignees
Labels

Comments

@eckelj
Copy link

eckelj commented Jul 31, 2023

Summary of Bug

The call to
/cosmos/auth/v1beta1/account_info/{address}
with a valid/legit and already funded address fails with the following error message:

{
  "code": 13,
  "message": "Expecting non nil value to create a new Any: failed packing protobuf message to Any",
  "details": []
}

This happens to addresses derived from randomly generated public/private key pairs prior not known to the chain (e.g. in the case of HW wallet usage).

A workaround is to call /cosmos/auth/v1beta1/accounts and filter for the requested address. This call can resolve the account information without knowing the corresponding public key to the requested address.
After creating and broadcasting one transaction, the public key is known to the chain, and the issue no longer appears on the /cosmos/auth/v1beta1/account_info/{address} API call.

Version

Cosmos SDK 0.47.3

Steps to Reproduce

  1. Create a random public/private key pair so that the public key is unknown to the chain, and derive the address from the public key.
  2. fund the address (via a faucet or other transaction) so that this funding transaction will implicitly create the account of the address on-chain.
  3. query /cosmos/auth/v1beta1/account_info/{address}.
@eckelj eckelj added the T:Bug label Jul 31, 2023
@eckelj eckelj changed the title [Bug]: /cosmos/auth/v1beta1/account_info/{address} returns 13 if public key is not known to the account object on-chain [Bug]: /cosmos/auth/v1beta1/account_info/{address} returns 13 if public key is unknown to the account object on-chain Jul 31, 2023
@facundomedica
Copy link
Member

Thanks for opening this issue, it looks like a problem in the query server.

        pkAny, err := codectypes.NewAnyWithValue(account.GetPubKey())
	if err != nil {
		return nil, status.Errorf(codes.Internal, err.Error())
	}

account.GetPubKey() can return nil, so we shouldn't try to pack it if so.

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

Successfully merging a pull request may close this issue.

2 participants