non-party node must refund gas for private transactions #739
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Gas pool subtracts transaction gas limit initially prior to processing the transaction.
For private transactions, only intrinsic gas are used.
The remaining (transaction gas limit - intrinsic gas) is refunded to the gas pool.
This logic is supposed to be applied for both party and non-party nodes.
This PR is to make sure non-party node following the above logic.
Root cause
Under load, non-party node may see bad blocks due to
gas limit reached
. This happens when intrinsic gas is reasonably smaller than transaction gas limit. In this case, party node (as a miner) may include lots of transactions to fill up the block gas limit. However, when non-party node inserts the block into its chain, the gas pool gets exhausted quickly due to only subtracting transaction gas limit and not refunding the remaining gas. This causesbad block
withgas limit reached
error being reported.