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

remove non-consensus data when inserting new consensus blocks #2687

Merged
merged 11 commits into from
Sep 11, 2019

Conversation

ayrat555
Copy link
Contributor

@ayrat555 ayrat555 commented Sep 10, 2019

In this PR (#1657) we started invalidating a large number of blocks.

Imagine a situation when we just imported a non-consensus block. Logic in this PR sets consensus to false for this block in the DB to make Catchup.Fetcher re-fetch this block. But we already imported logs and token transfers for this non-consensus block. the second time we will import correct logs and transfers but invalid data is not deleted.

fixes #2645
fixes #2627

Changelog

  • remove non-consensus data when inserting new consensus blocks

@ayrat555 ayrat555 changed the title remove non non-consensus data when inserting new consensus blocks remove non-consensus data when inserting new consensus blocks Sep 10, 2019
@coveralls
Copy link

coveralls commented Sep 10, 2019

Pull Request Test Coverage Report for Build 328f20a3-9a4d-48b7-b00c-f97c33be5ca8

  • 16 of 18 (88.89%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 78.394%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/explorer/lib/explorer/chain/import/runner/blocks.ex 16 18 88.89%
Totals Coverage Status
Change from base Build b236cd4d-2a4b-448b-ae47-0656bf85e837: 0.05%
Covered Lines: 5174
Relevant Lines: 6600

💛 - Coveralls

Copy link
Contributor

@pasqu4le pasqu4le left a comment

Choose a reason for hiding this comment

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

One necessary change.

Also, CHANGELOG entry is missing.

} ->
nonconsensus_block_numbers =
lost_consensus_blocks
|> Kernel.++(lost_consensus_neighbours)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a nitpick, but I don't think credo will complain if you start the pipe with lost_consensus_blocks ++ lost_consensus_neighbours

@vbaranov vbaranov merged commit 84737b1 into master Sep 11, 2019
@vbaranov vbaranov deleted the ab-remove-non-conconsensus-data branch November 28, 2019 14:55
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.

Exceeded (doubled) token transfer in tx Görli Testnet: Duplicate Token Transfer Events
4 participants