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

multi: Add metadata to proposal submissions. #1175

Merged
merged 7 commits into from
Apr 30, 2020
Merged

Conversation

lukebp
Copy link
Member

@lukebp lukebp commented Apr 24, 2020

This diff seperates out proposal metadata from the proposal files when
submitting a proposal. The NewProposal and EditProposal routes now
contain a Metadata field that allows the client to submit user
specified 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 line
of 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 point
where 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

  • Added a Metadata field to the v1 NewProposal and EditProposal
    routes that can be used to pass in artibrary Metadata objects. This
    metadata 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.
  • Proposals are now required to contain a ProposalMetadata that
    specifies the proposal's name. This metadata is encoded and passed in
    as a generic Metadata object on proposal submission.
  • Added a ProposalGeneralV2 mdstream that removes the Name from the
    mdstream. The proposal name, and any other user defined metadata, is
    now stored using the methods defined above.

@lukebp lukebp changed the title [wip] politeiawww: Add metadata to proposal submissions. multi: Add metadata to proposal submissions. Apr 29, 2020
marcopeereboom
marcopeereboom approved these changes Apr 30, 2020
@lukebp lukebp merged commit 05c1d7b into decred:master Apr 30, 2020
@lukebp lukebp deleted the newproposal branch June 16, 2020 23:10
vibros68 pushed a commit to vibros68/politeia that referenced this pull request Aug 17, 2021
* Fix "Community" typo

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

Successfully merging this pull request may close these issues.

2 participants