Skip to content

Conversation

SADfronov
Copy link

This commit implements the TODO comment "add test case for finality" in block_sync_test.go.

The new TestBlockSyncFinality function covers all the finality logic scenarios
from the updateEventFeed() method in block_sync.go:

  • Test case 1: No finality update available - should not emit chain head event
  • Test case 2: Finality update available, same epoch - should emit chain head event with finalized hash
  • Test case 3: Finality update available, attested epoch < finalized epoch - should not emit event
  • Test case 4: Finality update available, attested epoch == finalized epoch + 1, head at first slot of next epoch - should wait for finality update
  • Test case 5: Finality update available, attested epoch == finalized epoch + 1, parent block not in finalized epoch - should emit chain head event
  • Test case 6: Finality update available, attested epoch == finalized epoch + 1, parent block in finalized epoch - should not emit event

The test validates the complex epoch comparison logic and parent block availability
checks that determine when finalized hash information is included in ChainHeadEvent.

This ensures the finality functionality is properly tested and maintains code quality
standards for the beacon light client synchronization module.

@lightclient
Copy link
Member

duplicate of #32228 and #32196

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