-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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]: Gas simulation uses incorrect key #17711
Comments
Taking a key from the keystore for gas simulation doesn't seem correct to me. Unless something changed, gas estimation used a fake sentinel public key: https://github.com/cosmos/cosmos-sdk/blob/main/x/auth/ante/sigverify.go#L85-L91 |
But the code I linked does exactly that - it takes the key from the keystore |
Interesting. I had no idea we did that and it seems new-ish. On the original v0.45 version we didn't do that: https://github.com/cosmos/cosmos-sdk/blob/v0.45.0/client/tx/tx.go#L264 I'd have to defer to the author or someone who's more familiar. It seems to have been added in this PR: #11282 |
Agree that approach taken there is "intriguing" |
could you look into this @alexanderbez otherwise this will sit and never get closed until Julien or I have time. |
Yeah sure. My proposal is to revert #11282 (sorry @fedekunze). This isn't a clean solution IMO. You shouldn't have to rely on the keyring to do this (hence this issue!). I instead propose we add a |
@tac0turtle can we take this issue? |
That would be 🔥 @educlerici-zondax |
hey! @alexanderbez would adding a |
TBH, I'm not sure, but possibly, yes. I didn't spend a ton of time looking into the specifics of my proposed solution, but the general idea should work, yeah. |
Is there an existing issue for this?
What happened?
According to what I've found here:
cosmos-sdk/client/tx/factory.go
Line 446 in 1a62d77
When gas is simulated (using
--gas=auto
) the first public key found in the keystore is used.This behavior might break the simulation process giving this or similar error:
I was able to trigger this by:
aaa
to the keystorebbb
to the keystore`bbb
(multisig account)In this case transaction is simulated using
aaa
public key, which is wrong because the node expects multisig public key.Same things applies the other way:
aaa
keybbb
keybbb
(normal account)This time multisig key
aaa
is used for simulation, which is wrong again, because node expects normal public key.How to solve it:
Instead of taking the first key from the store, put the right empty signature there.
I've already implemented possible fix in the past, it's available here: https://github.com/CoreumFoundation/coreum/blob/3634317320c464f3eae766929952ae943205cce2/pkg/client/tx.go#L145
Cosmos SDK Version
0.47
How to reproduce?
No response
The text was updated successfully, but these errors were encountered: