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

--dry-run flag returns an error #13202

Closed
iTiky opened this issue Sep 8, 2022 · 6 comments
Closed

--dry-run flag returns an error #13202

iTiky opened this issue Sep 8, 2022 · 6 comments
Assignees

Comments

@iTiky
Copy link

iTiky commented Sep 8, 2022

Summary of Bug

In order to estimate a transaction gas usage, I'm using the --dry-run flag. This flag leads to creating the keyring.BackendMemory Keyring in the clientCtx. In-memory Keyring returns an error in the client.GetFromFields call because it can't get an account info 🤷‍♂️. That being said, I can't simulate a transaction.

May be I'm doing smth wrong and there is an other method of Tx simulation without an actual Keyring (os / file).

Version

v0.45.8

Steps to Reproduce

Input:

gaiad tx --chain-id ${chainID} --node ${nodeURL} bank send ${accountA_addr} ${accountB_addr} 100stake --dry-run

Output:

Error: key with addressB0CE2842C0F7F3BB12CF0E93F2F968DF09868DC0not found: key not found
@alexanderbez
Copy link
Contributor

That error output doesn't seem right...you should be providing a --from flag. Have you tried that?

@iTiky
Copy link
Author

iTiky commented Sep 8, 2022

The x/bank module sets the --from auto-magically 😁
I guess the problem is here, it creates an in-memory Keyring which (of course) has no idea about keys and address.

@alexanderbez
Copy link
Contributor

Ahh yes, you're right. That makes sense. Now the question is, why is the key not found error happening. Somewhere in the dry run flow, it's trying to get the key.

@facundomedica any chance you have the ability to look into this?

@julienrbrt
Copy link
Member

Have it ever worked in prior version? In v0.46 we've updated the flags to explain that dry-run cannot access the keyring: https://github.com/cosmos/cosmos-sdk/blob/main/client/flags/flags.go#L118

@alexanderbez
Copy link
Contributor

Yes, --dry-run doesn't need access to the keyring because it simulates the tx and thus uses a dummy pubkey. It should still work as it doesn't need access to the keyring.

@julienrbrt
Copy link
Member

Fixed by #13673

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

No branches or pull requests

5 participants