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

add Poet service abstraction #5865

Open
poszu opened this issue Apr 19, 2024 · 0 comments
Open

add Poet service abstraction #5865

poszu opened this issue Apr 19, 2024 · 0 comments

Comments

@poszu
Copy link
Contributor

poszu commented Apr 19, 2024

Description

Currently, the nipostBuilder is bloated with logic related to Poet (submitting challenges, certifying or doing PoW, querying for proofs etc.). It could be extracted to a specialized "poet service" that would cover all the details and unclutter the nipostBuilder code. It could also hide the fact that there are multiple poet servers "behind the scenes". I.e. it should expose an API like:

type poetService interface {
    // Submit the `challenge` to all poets, expecting to get the proof by the `deadline`.
    // takes care of PoW / certification and retries.
    Submit(challenge type.Hash32, nodeID types.NodeID, deadline time.Time) error

    // Get the best poet proof for the given challenge (previously submitted via `Submit`).
    // blocks until the proofs are available and selects the best one.
    Proof(challenge type.Hash32, nodeID types.NodeID) (*PoetProof, error)
}

The implementation could be scraped from the code existing in nipostBuilder already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant