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

trie/database: fix overflow in parent tracking (cherrypicking go-ethereum#18165 pull) #876

Merged
merged 2 commits into from
Nov 13, 2019

Conversation

SatpalSandhu61
Copy link
Contributor

@SatpalSandhu61 SatpalSandhu61 commented Nov 8, 2019

We had an issue on an IBFT network whereby we were seeing some nodes fail with 'BAD BLOCK' due to the error 'invalid gas used'. These nodes would then be unable to recover unless their chain was deleted and fast resync performed.

Analysis showed the following was occurring:

  • User was creating a contract which was being repetitively called during perf testing.
  • Multiple successive contracts were created.
  • After some time, due to node.parent being int16, it was overflowing to value zero. This causes the contract to be flushed from the in-memory trie.
  • Any further calls to the contract would fail, resulting in gas consumption of 21272 (intrinsic gas).

However, on another node (which had been restarted at some point):

  • The contract was still available in the in-memory trie, so the contract call succeeded and consumed much higher gas value.
  • This meant that the block gas usage was higher on this node than the value stamped in the header, and the block was rejected.

Note that this issue does not occur if the nodes are set up as ‘archive’ nodes, as this disables pruning.

Cherrypicking go-ethereum#18165 pull.

@jbhurat jbhurat self-requested a review November 12, 2019 17:01
Copy link
Contributor

@jbhurat jbhurat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jpmsam jpmsam merged commit f809144 into master Nov 13, 2019
@SatpalSandhu61 SatpalSandhu61 deleted the fix-bad-block-due-to-trie-node-parent-overflow branch November 13, 2019 16:47
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 this pull request may close these issues.

4 participants