Sending to POST /bank/accounts/cosmos1am86ggjvxyesmgr9famzau5k7u8h43hnkyaet3/transfers
{
"submitType":"local",
"password":"1234567890",
"amount":[
{
"denom":"photino",
"amount":"10"
}
],
"base_req":{
"sequence":"6",
"from":"cosmos1w2y9602gnz0xd5c73jwyffnlkdkgzj23vaympz",
"account_number":"0",
"chain_id":"local-testnet",
"gas":"auto",
"generate_only":true
}
}
Returns
{
"type":"auth/StdTx",
"value":{
"msg":[
{
"type":"cosmos-sdk/Send",
"value":{
"inputs":[
{
"address":"cosmos1w2y9602gnz0xd5c73jwyffnlkdkgzj23vaympz",
"coins":[
{
"denom":"photino",
"amount":"10"
}
]
}
],
"outputs":[
{
"address":"cosmos1w2y9602gnz0xd5c73jwyffnlkdkgzj23vaympz",
"coins":[
{
"denom":"photino",
"amount":"10"
}
]
}
]
}
}
],
"fee":{
"amount":null,
"gas":"0"
},
"signatures":null,
"memo":""
}
}
See the gas difference.
Correct, @faboweb this is expected behavior. You cannot estimate gas for generate only as stated in #3396 because there is no pubkey attached.
This is why I opened this issue as I think it should be possible and the pubkey should not be requirement to do the simulation as for the sake of a simulation the pubkey could be any, am I wrong?
The public key is needed because without it the estimated gas value will be essentially useless -- a bulk of the gas costs come from signature verification.
You'll notice when you don't generate-only, a pubkey is added w/o a signature because you have access to the keybase.
UPDATE:
@faboweb Ok, I believe we can accomplish this by adding an empty array of StdSignature to bypass ValidateBasic.
Assigning this to myself as I already had the logic implemented.
closing this. Please reopen if you can reproduce it
Most helpful comment
Assigning this to myself as I already had the logic implemented.