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

Fix transaction failed to buy gas #810

Closed
annakaz opened this issue Jan 15, 2020 · 1 comment
Closed

Fix transaction failed to buy gas #810

annakaz opened this issue Jan 15, 2020 · 1 comment
Assignees
Milestone

Comments

@annakaz
Copy link

annakaz commented Jan 15, 2020

Created issue from #809 (comment)

So this is an error because if a transaction is being processed here, it is assumed that it was already validated by the transaction pool, in which case this should never happen. We are breaking that assumption in the EstimateGas function. I think the best way to handle this would be to run the transaction through transaction pool validation, either in its entirety or just to validate that the transaction can pay its fees, before applying the state transition.
Here is the validateTx function on TxPool, which you obviously can't call directly as it stands

func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {

And here is the part that validates balances to ensure fees can be paid
func ValidateTransactorBalanceCoversTx(tx *types.Transaction, from common.Address, currentState *state.StateDB) error {

Two courses of action would either be to export the former, or just call the latter if that turns out to be inappropriate. The call should probably occur here-ish

If this seems onerous, please leave this log statement as is and copy the above into an issue to address later. And feel free to assign me to it.

@gastonponti
Copy link
Contributor

Issue already fixed with the PR #825

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

Successfully merging a pull request may close this issue.

4 participants