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

Split poet into registration and worker services #364

Merged
merged 29 commits into from
Sep 12, 2023
Merged

Conversation

poszu
Copy link
Contributor

@poszu poszu commented Aug 31, 2023

Closes #355
Closes #373
Closes #380

Refactored Service by splitting it into 2 entities:

  • Registration
  • Worker (still named Service in the code)

And two interfaces that they communicate with:

  • WorkerService
  • RegistrationService

obraz

Registration

It's the front-end service that the node talks to. It is responsible for:

  • scheduling poet rounds according to round config
  • registering new challenges
  • persisting rounds' database
  • persisting proofs' database
  • serving proofs

When a time comes, it atomically closes the open round, builds a membership tree, and opens a new round. The root of the membership tree is passed to the worker service via the WorkerService interface.

Registration asynchronously waits for proofs coming from the Worker and stores them in the DB.

Worker

It's the backend responsible for executing rounds scheduled by Registration. It registers at the RegistrationService interface for closed rounds and listens for rounds to execute on the returned channel. When a round is finished, it passes the proof back to the RegistrationService.

inMemory transport

It's an entity implementing both WorkerService and RegistrationService to connect the Registration with the Worker. It's very simple and uses 2 channels to pass data between them.

@poszu poszu requested a review from fasmat August 31, 2023 14:41
@poszu poszu force-pushed the 355-registration-svc branch 2 times, most recently from 11fef9f to 9a4e41c Compare August 31, 2023 14:57
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #364 (5d92ff8) into develop (b651e0d) will decrease coverage by 0.1%.
Report is 10 commits behind head on develop.
The diff coverage is 78.2%.

@@            Coverage Diff            @@
##           develop    #364     +/-   ##
=========================================
- Coverage     73.7%   73.6%   -0.1%     
=========================================
  Files           19      23      +4     
  Lines         1833    1954    +121     
=========================================
+ Hits          1351    1439     +88     
- Misses         358     388     +30     
- Partials       124     127      +3     
Files Changed Coverage Δ
registration/pow_verifier.go 96.1% <ø> (ø)
shared/shared.go 71.5% <ø> (-4.0%) ⬇️
db/migrate.go 64.0% <25.0%> (ø)
registration/db.go 54.2% <54.2%> (ø)
state/state.go 60.8% <60.8%> (ø)
server/config.go 67.6% <64.8%> (ø)
registration/registration.go 75.8% <75.8%> (ø)
server/server.go 79.6% <76.5%> (+3.7%) ⬆️
rpc/rpcserver.go 85.1% <78.2%> (+6.3%) ⬆️
service/service.go 75.6% <78.3%> (-1.1%) ⬇️
... and 7 more

... and 1 file with indirect coverage changes

@poszu poszu marked this pull request as ready for review September 7, 2023 10:56
server/state.go Outdated Show resolved Hide resolved
util/persistance.go Outdated Show resolved Hide resolved
util/persistance.go Outdated Show resolved Hide resolved
util/persistance.go Outdated Show resolved Hide resolved
server/state.go Outdated Show resolved Hide resolved
registration/round.go Outdated Show resolved Hide resolved
registration/registration.go Outdated Show resolved Hide resolved
registration/round.go Outdated Show resolved Hide resolved
service/round.go Outdated Show resolved Hide resolved
service/service.go Outdated Show resolved Hide resolved
poszu and others added 2 commits September 11, 2023 10:05
Co-authored-by: Matthias Fasching <[email protected]>
Co-authored-by: Matthias Fasching <[email protected]>
@poszu poszu requested a review from fasmat September 11, 2023 11:57
@fasmat fasmat self-requested a review September 11, 2023 15:15
@poszu poszu added this pull request to the merge queue Sep 12, 2023
Merged via the queue into develop with commit 00a5521 Sep 12, 2023
11 checks passed
@fasmat fasmat deleted the 355-registration-svc branch September 15, 2023 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants