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

Some SyncPeerStatus messages were not published #1320

Merged

Conversation

stana-miric
Copy link
Contributor

@stana-miric stana-miric commented Mar 21, 2023

The problem fixed in this PR is related to publishing SyncPeerStatus. Some messages were not published because of the bug in startNewBlockProcess fn of syncPeerClient where each time after the notification is dispatched on block insertions the new channel is created for the same syncPeerClient subscription. This could be noticed on non validator nodes since they are not producing block but instead receiving them upon SyncPeerStatus is published (when syncer's newStatusCh is set). On those nodes as reproduced on the test system as well, blocks were not arriving one by one.
-The main fix is in syncer/client.go
-Unit test is written and for that purpose, mocked subscriber is adjusted to look more like real subscriber in order to be able to test this scenario (it does not affect other test, the previous version was more simplified because it was sufficient for existing tests).
-blockchain.go is changed because source of the block is added to the log since we have that data and it can be useful

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@stana-miric stana-miric added the bug fix Functionality that fixes a bug label Mar 21, 2023
@stana-miric stana-miric self-assigned this Mar 21, 2023
@stana-miric stana-miric force-pushed the EVM-530-two-blocks-are-possibly-written-simultaneously branch from 7c1be6c to 73541bf Compare March 21, 2023 13:32
Copy link
Contributor

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

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

🎩 LGTM

Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal left a comment

Choose a reason for hiding this comment

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

Aside from nitpicks, LGTM. Nice one

syncer/client_test.go Outdated Show resolved Hide resolved
syncer/client_test.go Outdated Show resolved Hide resolved
@stana-miric stana-miric merged commit 15deea1 into develop Mar 23, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2023
@Stefan-Ethernal Stefan-Ethernal deleted the EVM-530-two-blocks-are-possibly-written-simultaneously branch March 24, 2023 08:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants