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

Automatic gas calculation doesn't work with generate_only #3423

Closed
4 tasks
faboweb opened this issue Jan 29, 2019 · 8 comments · Fixed by #3467
Closed
4 tasks

Automatic gas calculation doesn't work with generate_only #3423

faboweb opened this issue Jan 29, 2019 · 8 comments · Fixed by #3467
Assignees

Comments

@faboweb
Copy link
Contributor

faboweb commented Jan 29, 2019

Summary of Bug

If I try to generate a tx to be signed outside gaia and want to set gas = auto I get an error: Key anonymous not found.

Replicate:

POST /bank/accounts/cosmos1am86ggjvxyesmgr9famzau5k7u8h43hnkyaet3/transfers
Body:

{"amount":[{"denom":"photino","amount":"10"}],"base_req":{"sequence":"7","name":"anonymous","from":"cosmos1am86ggjvxyesmgr9famzau5k7u8h43hnkyaet3","account_number":"0","chain_id":"local-testnet","gas":"auto","generate_only":true}}

Steps to Reproduce


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

Cannot reproduce this, at least in #3396

@faboweb
Copy link
Contributor Author

faboweb commented Jan 29, 2019

Sending

{  
   "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 gas is now "0". So this was probably the issue.

@faboweb faboweb closed this as completed Jan 29, 2019
@faboweb
Copy link
Contributor Author

faboweb commented Jan 29, 2019

{  
   "tx":{  
      "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":"auto"
      },
      "signatures":[  
         {  
            "pub_key":{  
               "type":"tendermint/PubKeySecp256k1",
               "value":"A+4lzuXXM4OJNHnIytTositlLomevcE9dw4JVO4IZaB6"
            },
            "signature":"Z5UaGpawpTFnAVuK4WDvcUIa+Wi0vw0QLgqALaZRZR5NEUqT1mwYk6j9fqQtym1o7uMYLQJpeZgvcYCs9tliUg==",
            "account_number":"0",
            "sequence":"6"
         }
      ],
      "memo":""
   },
   "return":"block"
}

Broadcasting this returns:

invalid character 'a' looking for beginning of value

@faboweb faboweb reopened this Jan 29, 2019
@alexanderbez
Copy link
Contributor

@faboweb what exact steps and payloads are you running? The fees looks invalid.

@faboweb
Copy link
Contributor Author

faboweb commented Jan 29, 2019

I am posting against /bank/accounts/cosmos1am86ggjvxyesmgr9famzau5k7u8h43hnkyaet3/transfers

Check payload and response at #3423 (comment)

Then I am broadcasting the response plus the signature: #3423 (comment)

This all works when using a fixed gas amount.

@alexanderbez
Copy link
Contributor

Thanks @faboweb -- I'll take a deeper look into this shortly.

@alexanderbez
Copy link
Contributor

@jackzampolin do you deem this needed for the next milestone RC?

@jackzampolin
Copy link
Member

@alexanderbez I think it would be nice. Since we are trying to not have too many breaking state machine changes these small UX improvements would be good to get in that release.

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

Successfully merging a pull request may close this issue.

3 participants