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

Get offchain Voting Anchor #1527

Closed
kderme opened this issue Oct 2, 2023 · 6 comments · Fixed by #1562
Closed

Get offchain Voting Anchor #1527

kderme opened this issue Oct 2, 2023 · 6 comments · Fixed by #1562
Assignees
Labels
conway Conway integration blockers or reauested feautures

Comments

@kderme
Copy link
Contributor

kderme commented Oct 2, 2023

This is similar to the off chain pool metadata that we already have.
A new thread needs to be added. The db schema is already in place, but may need adjustments.

@kderme kderme added the conway Conway integration blockers or reauested feautures label Oct 2, 2023
@kderme
Copy link
Contributor Author

kderme commented Oct 6, 2023

Some details that may be useful during the implementation:

Related tables are VotingAnchor, AnchorOfflineData and AnchorOfflineFetchError.
VotingAnchor is the on-chain part: it includes a url and a hash.
A new thread needs to be spawned which should periodically read entries from the anchor and do http requests to get the off-chain parts. If this request is succesful and the hash of the fetched data matches the expected hash, a new entry for the AnchorOfflineData should be prepared. The AnchorOfflineData includes a json text, however the specification in which this text should be parsed is not decided, so this can remain empty. If something goes wrong with the http request, a AnchorOfflineFetchError should be prepared.

@Cmdv
Copy link
Contributor

Cmdv commented Oct 9, 2023

Just a couple of questions for clarification:

  1. is there an example of an existing thread that checks "on-chain" with "off-chain" I could use as an example?
  2. "read entries from the anchor" is this the anchors on the database if so which one?
  3. "do http requests to get the off-chain parts." what url would I use? is this getting it from node or somewhere else?

@kderme
Copy link
Contributor Author

kderme commented Oct 9, 2023

  1. yes the pool metadata thread
  2. yes these are the anchors stored in voting_anchor table.
  3. the url is included in the VotingAnchor so it's part of the chain.

@Cmdv
Copy link
Contributor

Cmdv commented Oct 9, 2023

  1. do you have a name/link for the function for the "pool metadata thread"
  2. 👍
  3. So we're getting N VotingAnchors from db using the url in each to check the SHAs match with what is on the DB, then if valid put into AnchorOfflineData and if not then AnchorOfflineFetchError?

A new question: Once the VotingAnchor is checked/validate, do we "delete" the original or "store" somewhere the last VotingAnchor that was checked/validated so we know where to pick up from the next time the thread runs?

@kderme
Copy link
Contributor Author

kderme commented Oct 9, 2023

The thread name is runOfflineFetchThread. I suggest you take a look at how it works and it may give answers to your questions.

@Cmdv Cmdv self-assigned this Oct 16, 2023
@kderme
Copy link
Contributor Author

kderme commented Nov 14, 2023

Note: metadata should be populated only when --disable-gov is not on. Similar to --disable-offchain-pool-data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conway Conway integration blockers or reauested feautures
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants