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

(OraklNode) sync roundId based on max suggested id #1099

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

nick-bisonai
Copy link
Collaborator

@nick-bisonai nick-bisonai commented Feb 1, 2024

Description

RoundId generation

AS - IS

Each peer was generating roundId based on timestamp from each machine. Since each machine could have difference with its generated timestamp, they could've been submitting to different roundId at same tick

TO - BE

This update adds publishing & subscribing layer to synchronize roundId

  1. Generates roundId based on timestamp from each peer
  2. Publish generated roundId
  3. Collects roundIds from subscribed messages
  4. Once collected roundIds exceeds number of subscribers, select max value among collected roundIds and proceed

Other updates

  • Now receive message also from itself and updates data only from subscription. If data update happens both from subscription and publish, it's difficult to handle conditional execution
  • Limited length of roundID string to 6
  • Refactoring based on phase of communication. (function extraction, type separation)

Is it okay?

What if there's a disconnected peer?

I assume that condition checking as followed will also be affected as # of subscribers will decrease.
len(n.Data.SuggestedRounds) > n.getSubscribersCount()

What if there's a disconnected peer but still running?

Currently, node is running(publishing) conditionally only if there's 1 or more connected peers.

What about other fallbacks?

Please list down all edge cases that should be handled
It'll be updated in further PRs
Please help 🥹

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Deployment

  • Should publish npm package
  • Should publish Docker image

@nick-bisonai nick-bisonai requested review from martinkersner, KelvinThai and a user February 1, 2024 12:47
@nick-bisonai nick-bisonai self-assigned this Feb 1, 2024
@nick-bisonai nick-bisonai force-pushed the feat/orakl-node-round-id-setup branch from 816d0d2 to b4cfa9d Compare February 3, 2024 12:26
Copy link
Member

@martinkersner martinkersner left a comment

Choose a reason for hiding this comment

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

LGTM!

@nick-bisonai nick-bisonai merged commit 1655b26 into master Feb 5, 2024
7 checks passed
@nick-bisonai nick-bisonai deleted the feat/orakl-node-round-id-setup branch February 5, 2024 04:05
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.

2 participants