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

Generate_only doesn't respect gas #3430

Closed
4 tasks
faboweb opened this issue Jan 29, 2019 · 5 comments
Closed
4 tasks

Generate_only doesn't respect gas #3430

faboweb opened this issue Jan 29, 2019 · 5 comments
Assignees
Labels

Comments

@faboweb
Copy link
Contributor

faboweb commented Jan 29, 2019

Summary of Bug

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.

Steps to Reproduce


For Admin Use

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

Correct, @faboweb this is expected behavior. You cannot estimate gas for generate only as stated in #3396 because there is no pubkey attached.

@faboweb
Copy link
Contributor Author

faboweb commented Jan 29, 2019

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?

@alexanderbez
Copy link
Contributor

alexanderbez commented Jan 29, 2019

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.

@alexanderbez
Copy link
Contributor

Assigning this to myself as I already had the logic implemented.

@fedekunze
Copy link
Collaborator

closing this. Please reopen if you can reproduce it

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

No branches or pull requests

3 participants