Skip to content

politeia v1.0.0

Compare
Choose a tag to compare
@lukebp lukebp released this 20 Apr 17:59
· 194 commits to master since this release
b4b89de

politeia v1.0.0

This release of politeia introduces a large number of structural changes to politeia and deprecates many of the existing politeiawww API routes. Listed below are a summary of the changes.

  • Adds a new politeiad backend called tstore.
  • Adds a politeiad v2 API.
  • Formalizes a politeiad plugin architecture.
  • Adds the following politeiad plugins: comments, ticketvote, dcrdata, usermd, pi.
  • Support has been removed for the politeiawww www/v1 API routes that handle proposals, comments, and dcr ticket votes. Routes that are used by decred clients (decrediton, dcrdata) have only been deprecated and will have support removed in the future.
  • Adds the following politeiawww APIs: records/v1, comments/v1, ticketvote/v1.

politeiad tstore backend

A new backend was added to politeiad that is referred to as the tstore backend. It combines a trillian log, commonly referred to as a tlog, and a key-value store. The tstore backend differs from the git backend in three main ways.

  1. Scalability
    The git backend relied on git repos saved to the file system to store data. This approach cannot be scaled out since it is constrained to the file system of a single politeiad instances. The tstore backend moves the data into an actual database, allowing for much greater scalability.

  2. Separate the timestamps and the data blobs
    The git backend would timestamp the git commit hashes onto the decred blockchain. These commit hashes are merkle roots of all the files in the commit. The timestamp and the data blobs in this setup are interconnected. If you delete a data blob from the commit history, such as if you need to censor a public comment, you destroy the ability to recreate the merkle path for other data blobs included in that commit merkle root, thus destroying the ability to prove inclusion of data in a decred timestamp. Your only option is to remove the data from the git repo in a new commit, but the censored data remains in the git history. The tstore backend seperates out the timestamps from the data blobs. A merkle tree of the data is stored in a tlog instance while the data itself is stored in a key-value database. This allows for the deletion of data from the database, such as if you need to censor a public comment, without impacting any of the timestamps or our ability to prove the inclusion of a piece of data in a timestamp.

  3. Ability to retrieve timestamp inclusion proofs
    The tstore backend gives us the ability to retrieve an inclusion proof for any piece of data in the backend, providing cryptographic proof that the data blob was included in a dcr timestamp. There was no easy way to do this in the git backend.

politeiad v2 API

A politeiad v2 API was added. This API is a simplified version of the politeiad v1 API. The tstore backend relies solely on the politeiad v2 API.

politeiad plugin architecture

A formalized plugin architecture was added to politeiad.

A politeiad plugin extends a record with additional functionality. Some examples of this include adding comments to a record, adding the ability to run a dcr ticket vote on a record, and adding record validation that is specific to the decred proposal system.

This plugin architecture allows politeiad to become a configurable system. If a user wants to runs a politeiad instance that allows for specific file types and record comments, they can do so by simply adjusting the politeiad configuration. No new code is required unless they want to add in more granular, application specific validation.

The end goal is to eventually allow plugin code to exist outside of the politeia repository that can be dynamically loaded at runtime. While this is not possible yet, this release lays the foundation for doing so in the future.

politeiad plugins

The following plugins have been added to politeiad:

  • comments - extends a record with comment functionality.
  • ticketvote - extends a record with dcr ticket vote functionality.
  • dcrdata - provides an API that plugins can use to retreive data from dcrdata.
  • usermd - extends a record with user metadata (ex. user signatures).
  • pi - extends a record with functionality specific to the decred proposal system.

politeiawww APIs

The following politeiawww APIs have been added:

  • records/v1
  • comments/v1
  • ticketvote/v1

The politeiawww APIs have been rewritten to be generic, application agnostic APIs. These APIs were formally tied to specific politeia applications such as the decred proposal system and the decred contractor management system. You would use a proposal route to submit new proposals and a separate invoice route to submit cms invoices. These application specific routes have been replaced with more generic APIs. For example, there now exists a single set of routes for submitting all records, regardless of whether that record is a proposal or an invoice. The application specific validation has been pushed into the politeiad plugins. The validation that is specific to proposals is now performed in the pi politeiad plugin.

The politeiawww APIs now map to the politeiad plugins. For example, the politeiad comments plugin has a corresponding politeiawww API that can be used for submitting comments on any record, regardless of whether its a proposal comment or invoice comment.

These application agnostic APIs allow politeia to become a configurable system. You configure the politeiad plugins for your specific use case and you automatically get the corresponding politeiawww API routes.

Changelog

This release consists of 21 commits with a total of 368 files changed, 48,410 additional lines of code, and 39,948 deleted lines of code.

Add tstore backend and plugin architecture. (decred/politeia#1180)
multi: Break comment timestamps up. (decred/politeia#1374)
multi: Return comment del signature. (decred/politeia#1375)
politeiaverify: Verify comment and vote bundles. (decred/politeia#1377)
Add last error code verification. (decred/politeia#1376)
politeiavoter: Add temp dir to tests. (decred/politeia#1378)
ticketvote: Del ballots channel. (decred/politeia#1379)
tstore: Delete vetted record content bug. (decred/politeia#1384)
ticketvote: Remove testnet linkby path. (decred/politeia#1385)
politeiawww: Fix login reply bug. (decred/politeia#1386)
politeiawww: Fix legacy vote results bug. (decred/politeia#1387)
ticketvote: Fix active votes cache bug. (decred/politeia#1388)
multi: Add receipt to vote details. (decred/politeia#1380)
politeiawww: Fix legacy active votes bug. (decred/politeia#1389)
pictl: Fix various minor issues. (decred/politeia#1390)
build: Test against Go 1.16. (decred/politeia#1366)
multi: Add timestamp to ticket vote. (decred/politeia#1395)
politeiavoter: Fix password bug. (decred/politeia#1396)
politeiawww: Fix legacy pagination bug. (decred/politeia#1397)
ticketvote: Fix json typo. (decred/politeia#1399)
ticketvote: Fix summary best block bug. (decred/politeia#1402)