github.com/decred/politeia@v1.4.0/politeiad/cmd/legacypoliteia/gitbe/gitbe.go (about)

     1  // Copyright (c) 2022 The Decred developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package gitbe contains the git backend types and filenames that are required
     6  // by the legacypoliteia tool.
     7  package gitbe
     8  
     9  const (
    10  	// Proposal sub-directory paths. These paths are relative to the proposal
    11  	// root directory.
    12  	RecordPayloadPath = "payload/"
    13  	DecredPluginPath  = "plugins/decred/"
    14  
    15  	// Record metadata filename. The record metadata file is located in the
    16  	// proposal root directory.
    17  	RecordMetadataFilename = "recordmetadata.json"
    18  
    19  	// Proposal file filenames. The proposal files are located in the payload
    20  	// directory.
    21  	IndexFilename            = "index.md"
    22  	ProposalMetadataFilename = "proposalmetadata.json"
    23  
    24  	// PublicKey is the git backend politeia public key. The public key changed
    25  	// when politeia migrated to tstore.
    26  	PublicKey = "a70134196c3cdf3f85f8af6abaa38c15feb7bccf5e6d3db6212358363465e502"
    27  )
    28  
    29  // RecordMetadata is the metadata of a record.
    30  type RecordMetadata struct {
    31  	Version   uint64    `json:"version"`   // Version of the scruture
    32  	Iteration uint64    `json:"iteration"` // Iteration count of record
    33  	Status    MDStatusT `json:"status"`    // Current status of the record
    34  	Merkle    string    `json:"merkle"`    // Merkle root of all files in record
    35  	Timestamp int64     `json:"timestamp"` // Last updated
    36  	Token     string    `json:"token"`     // Record authentication token
    37  }
    38  
    39  // MDStatusT represents a record metadata status.
    40  type MDStatusT int
    41  
    42  const (
    43  	MDStatusInvalid           MDStatusT = 0
    44  	MDStatusUnvetted          MDStatusT = 1
    45  	MDStatusVetted            MDStatusT = 2
    46  	MDStatusCensored          MDStatusT = 3
    47  	MDStatusIterationUnvetted MDStatusT = 4
    48  	MDStatusArchived          MDStatusT = 5
    49  )
    50  
    51  // ProposalMetadata contains metadata that is specified by the user on proposal
    52  // submission. It is attached to a proposal submission as a politeiawww
    53  // Metadata object and is saved to politeiad as a File, not as a
    54  // MetadataStream. The filename is defined by FilenameProposalMetadata.
    55  //
    56  // The reason it is saved to politeiad as a File is because politeiad only
    57  // includes Files in the merkle root calculation. This is user defined metadata
    58  // so it must be included in the proposal signature on submission. If it were
    59  // saved to politeiad as a MetadataStream then it would not be included in the
    60  // merkle root, thus causing an error where the client calculated merkle root
    61  // if different than the politeiad calculated merkle root.
    62  type ProposalMetadata struct {
    63  	Name   string `json:"name"`             // Proposal name
    64  	LinkTo string `json:"linkto,omitempty"` // Token of proposal to link to
    65  	LinkBy int64  `json:"linkby,omitempty"` // UNIX timestamp of RFP deadline
    66  }