Backwards compatible patch for bug with market map antehandler gas usage. #2178
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.
Changelist
The market map antehandler has a bug where an in-memory cache will affect the gas used when executing upsert/update transactions on the market map module. This breaks nodes that are sync-ing and don't populate the cache from a
CheckTx
call on the transaction as the gas used when executing the transaction will be different from a node that had a populated cache.This patch ensures that the gas used when executing the antehandler is always the same as the gas used with a fully populated cache, which matches the gas used for a node that had ran the ante handler during
CheckTx
for the upsert/update transaction by running the logic to populate the cache twice and discounting the gas usage from the first run.See #2176 for the permanent fix that will go into the official release, this bug fix is intended only for the test-net.
Test Plan
Tested sync-ing using this patch on the test-net with a block that could not be successfully sync'd w/ the bugged version of the application.
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.