multi: Add metadata to proposal submissions. #1175
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This diff seperates out proposal metadata from the proposal files when
submitting a proposal. The
NewProposal
andEditProposal
routes nowcontain a
Metadata
field that allows the client to submit userspecified metadata about the proposal. The metadata is included in the
signed merkle root of the proposal.
Issue Background
The only user defined proposal metadata up to this point has been the
proposal name. It is inserted into the
index.md
file as the first lineof the file and parsed out by the server. This is a very hacky way to
accomplish passing in user defined metadata.
The politeia RFP work adds additional user defined metadata fields
(
LinkTo
,LinkBy
) to a proposal and cms is also getting to the pointwhere additional user defined metadata fields are required in an
invoice. We didn't want to keep building on the hacky method that was
originally used, so this diff adds a way for user defined metadata to be
passed in correctly.
The main issue with passing in proposal metadata seperate from the
proposal files is that the metadata provided to politeaid is not
currently included in the merkle root calculation. Updating the merkle
root to include the metadata on record submission is problematic because
the metadata passed in to politeiawww from the user is not the same
metadata that is passed in to politeiad. An additional metadata stream
has to be created by politeiawww in order to store the user's signature
and public key. Adding this additional metadata stream to the politeaid
request means that the merkle root calculated and signed by the user
will not be the same merkle root calculated by politeiad. This is the
reason that the proposal title was originally inserted in the index.md
file itself. There has to be a layer violation somewhere and up until
this point, we had the layer violation in the user facing api. This diff
essentially moves the layer violation into the backend and has
politeiawww deal with the addittional complexity rather than push it
onto the user.
Changes
Metadata
field to the v1NewProposal
andEditProposal
routes that can be used to pass in artibrary
Metadata
objects. Thismetadata is not stored as metadata streams in politeiad. They are
stored as files so that they are included in the merkle root that
politeiad calculates and signs.
ProposalMetadata
thatspecifies the proposal's name. This metadata is encoded and passed in
as a generic
Metadata
object on proposal submission.ProposalGeneralV2
mdstream that removes theName
from themdstream. The proposal name, and any other user defined metadata, is
now stored using the methods defined above.