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 output and gas extraction in JS tracer for Geth #1869

Merged
merged 5 commits into from
May 2, 2019

Conversation

goodsoft
Copy link
Contributor

@goodsoft goodsoft commented Apr 30, 2019

JS tracer of internal transactions had two problems:

  1. output field wasn't derived correctly due to typo in field names used.
  2. gas and gasUsed didn't match the output from built-in callTracer due to weird calculation method.

Typo is fixed now, and gas/gasUsed fields use a more robust method: gas is taken from the first opcode trace in the scope of a call, while gasUsed is calculated using the remaining gas in the last opcode trace.

Upgrading

Internal transactions previously fetched on Geth-based deployments contain wrong data and should be discarded:

UPDATE transactions SET internal_transactions_indexed_at = NULL;

Checklist for your PR

  • I added an entry to CHANGELOG.md with this PR
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • I checked whether I should update the docs and did so if necessary

goodsoft added 2 commits May 1, 2019 00:40
That was most probably a typo.
Now `gas` is the gas available in the first opcode of a call, while
`gas_used` is the gas available _after_ the last opcode of the call.
@ghost ghost assigned goodsoft Apr 30, 2019
@ghost ghost added the in progress label Apr 30, 2019
@goodsoft goodsoft added ready for review This PR is ready for reviews. and removed in progress labels Apr 30, 2019
@coveralls
Copy link

coveralls commented Apr 30, 2019

Pull Request Test Coverage Report for Build 4b999ef0-e0f7-466d-a792-7715b86cc7cc

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 82.455%

Totals Coverage Status
Change from base Build 7cefe622-f206-463b-ab38-d5da6c0ac6a5: 0.3%
Covered Lines: 4488
Relevant Lines: 5443

💛 - Coveralls

@ghost ghost assigned vbaranov May 1, 2019
@ghost ghost added the in progress label May 1, 2019
@vbaranov
Copy link
Member

vbaranov commented May 1, 2019

The number of affected chains:

  • Goerli
  • Rinkeby
  • Aerum
  • Callisto

@vbaranov vbaranov merged commit 902b57f into master May 2, 2019
@ghost ghost removed the in progress label May 2, 2019
@vbaranov vbaranov deleted the gs-fix-js-tracer branch May 12, 2019 17:30
@vbaranov
Copy link
Member

Actually, a query to initiate retrace of internal transactions should be corrected to this version:

UPDATE transactions SET internal_transactions_indexed_at = NULL where error is null;

because of "error" constraint violation

UPDATE transactions SET internal_transactions_indexed_at = NULL;
ERROR:  new row for relation "transactions" violates check constraint "error"
DETAIL:  Failing row contains (100047, execution reverted, 300000, 20000000000, 22085, \xb8b59b9b51825280c54c60c1ad5432004d3675b26783eb5bf00d5b4853cb41..., 1, \xcd948855, null, 10, 1124540488372167723265742229195508469373525774133861352876470151..., 3194088922991522124357912292974446783935472125024873699554090371..., 0, 28, 0, 2019-04-25 10:56:15.766357, 2019-04-25 10:56:15.766357, \x3a0ab33f75af0ca7bfe8b44a053044963fc4e8f66cae91c2493c5580ccce16..., 2504081, \x8ee7d8bf9b722dfd003146a242bd975a1c524d1c, \xd813419749b3c2cdc94a2f9cfcf154113264a9d6, null, null, null, null).

And also we need to increase timeout for geth indexers, because after implementing this update to half of the geth-based instances of Blockscout, fetcher of internal transactions cannot process 10 internal transactions because of 1-minute timeout. I will add an increase of timeout in a separate PR.

@vbaranov vbaranov mentioned this pull request May 29, 2019
4 tasks
@goodsoft
Copy link
Contributor Author

goodsoft commented May 29, 2019

Rather, it should set error = NULL as well, because otherwise transactions with non-null error won't be refetched at all, but their gas numbers might be as wrong as the rest.

@vbaranov
Copy link
Member

I was actually unsure, that the error status will be refetched if I clear it. Since it will be updated finally, thus, I will update transactions table with:

UPDATE transactions SET internal_transactions_indexed_at = NULL, error = NULL;

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants