Summary
For the full voting experience with the Representatives and Delegations need to define a special document type as Contest Parameters with its own specific validation logic.
Description
- Define a new Rust type
struct ContestParameters.
- Add a necessary methods to expose data according to the
Contest Parameters document type. All these data should be taken from the payload. For the first version lets assume that the JSON payload would always has all necessary data we need.
- contest timeline (start and end date).
- election public key (???)
#[derive(serde::Deserialise)]
struct ContestPrarametersPayload {
voting_start: chrono::Datetime<Utc>,
voting_end: chrono::Datetime<Utc>,
election_pk: String,
}
- Add a new
ContestParametersRule with the corresponding CatalystSignedDocumentValidationRule trait implementation.
- Add a constructor
pub async fn new<Provider>(
doc: &CatalystSignedDocument,
provider: &Provider,
) -> anyhow::Result<Self>
where
Provider: CatalystSignedDocumentProvider,
{
if doc.report().is_problematic() {
anyhow::bail!("Provided document is not valid {:?}", doc.report())
}
anyhow::ensure!(
doc.doc_type()? == &CONTEST_PARAMETERS,
"Document must be Contest Ballot type"
);
// perform the same set of validation as for the `CatalystSignedDocumentValidationRule`
...
}
- Add a corresponding test cases
Summary
For the full voting experience with the Representatives and Delegations need to define a special document type as
Contest Parameterswith its own specific validation logic.Description
struct ContestParameters.Contest Parametersdocument type. All these data should be taken from the payload. For the first version lets assume that the JSON payload would always has all necessary data we need.ContestParametersRulewith the correspondingCatalystSignedDocumentValidationRuletrait implementation.