-
Notifications
You must be signed in to change notification settings - Fork 75
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
Import legacy git proposals into tstore. #1425
Comments
politeia changes
politeia legacy import tool Here are some additional details on what is likely the easiest way to accomplish this task.
This tool is only going to need to be used once. Once the legacy data has been migrated, the tool can be deleted from the politeia repo. Since this is a one off tool you can do things the quick and dirty way. The code should still be clean and readable, but things like hardcoding certain values or writings local structs to decode data into is fine. |
As expected, this has turned out to be quite a difficult and complex task. One of the main issues that we're encounting is the fact that the record token will not be the same. The tlog backend derives the record token from the tlog tree ID. This tree ID is a random int64 that is set by tlog on tree creation. We do not have the ability to set custom tree IDs, which means that legacy proposals will be assigned new tokens when they're imported into the tlog backend. This is problematic because the token is part of the message that clients sign when submitting data like comments and votes. This leaves us with a decision to make. We can either:
There are also instances where the data format, and thus the message being signed, changed between the git backend and tlog backend. In these cases, even if you use the legacy token the client signature will still be invalid because of the data format changes. The We decided to go with option 1. There will be various bugs and edge cases that will need to be fixed, but since this is only for reads and not writes, the impact of such bugs will be minimal and can be fixed as they are found. If we went with option 2, hardcoding in everything required to skip the signature validation checks for these legacy proposals would be just as much, if not more of a headache. Unfortunately, we will still need to hardcode in the signature validation skips for the small number of invalid signatures that will still be present due to data format changes, like with the |
Another large challenge with this is the cast vote timestamps. The git backend did not include the timestamp of when a vote was cast due to privacy concerns. The tlog backend does since they are included in the tlog tree anyway and adding the timestamp to the cast vote struct makes it much easier for dcrdata to build their vote graphs. In order to get the cast vote timestamp for the legacy votes, we'll need to pull the timestamp of the git commit from when the vote was added. These commits occurred every hour. This is how dcrdata built their vote graphs for the legacy proposal votes, so the code already exists to do this, but porting it over to this import tool and making sure it still works is another big pain point. |
For documentation sake, we found a bug on the votes cache of the legacy www api, which makes the vote count returned from the api differ from when counting it directly from the ballot journal. This will not be a concern anymore once we complete the legacy import to tstore, and further deprecate the legacy www api. |
The proposals that were submitted to the git backend are currenlty hosted on
proposals-archive.decred.org
, while all new proposals are hosted onproposals.decred.org
. This creates a fragmentation that diminishes the ability to find older proposals.The legacy proposals are currently hard coded into the gui and displayed in the list views, but this approach is suboptimal since the proposals are not included in politeia functionality such as searching for proposals by user ID. A better approach would be to import the git backend proposals directly into the tstore backend.
There's two main issues with importing the git backend proposals into the tstore backend.
Solution
Import the legacy git backend proposals using the format required by the tstore backend while also keeping the
proposals-archive
site up. There would be an additionalLegacyToken
field in the proposal metadata. When set, the gui will indicate that the proposal is a legacy proposal and you must go to the[proposals-archive link]
if you want to see the proposal in its original form with valid timestamps.This would solve the UX issues of legacy proposals not showing up on the
proposals.decred.org
site while also sidestepping the timestamp and incompatible format issues.Implementation
LegacyToken
field to the proposal metadata.The text was updated successfully, but these errors were encountered: