-
Notifications
You must be signed in to change notification settings - Fork 9
feat(cat-gateway): Updated Catalyst Signed Document validation #3466
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
Changes from 14 commits
42d920d
7409f28
f1ab466
5cfd9f7
4aca6b6
434749b
2c7e612
9d5cde7
23d8448
f0f315e
55778a2
baa08a9
0822cbc
1517bd1
8c8a6d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| //! F15 Document templates hardcoded data. | ||
|
|
||
| use super::SignedDocData; | ||
|
|
||
| /// Fund 15 Campaign ID. | ||
| const CAMPAIGN_ID: &str = "0199802c-21b4-7d91-986d-0e913cd81391"; | ||
|
|
||
| /// An empty JSON object bytes slice | ||
| const EMPTY_JSON_OBJECT_BYTES: &[u8] = b"{}"; | ||
| /// A definition of Category document hardcoded data | ||
| pub(crate) struct CategoryDocData( | ||
| /// ID and Version | ||
| &'static str, | ||
| /// Campaign ID | ||
| &'static str, | ||
| ); | ||
| /// List of category documents. | ||
| #[rustfmt::skip] | ||
| pub(crate) const CATEGORY_DOCUMENTS: [CategoryDocData; 4] = [ | ||
| CategoryDocData("0199802c-21b4-721f-aa1d-5123b006879e", CAMPAIGN_ID), | ||
| CategoryDocData("0199802c-21b4-7dc8-8537-7eae5ea4c4d3", CAMPAIGN_ID), | ||
| CategoryDocData("0199802c-21b4-7c84-873c-f55119cdc811", CAMPAIGN_ID), | ||
| CategoryDocData("0199802c-21b4-7161-a16e-a77af492780f", CAMPAIGN_ID), | ||
| ]; | ||
|
|
||
| impl From<CategoryDocData> for SignedDocData { | ||
| fn from(value: CategoryDocData) -> Self { | ||
| Self { | ||
| id: value.0, | ||
| ver: value.0, | ||
| doc_type: catalyst_signed_doc::doc_types::CATEGORY_DOCUMENT_UUID_TYPE, | ||
| content: EMPTY_JSON_OBJECT_BYTES, | ||
| category_id: Some(value.1), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// A definition of Proposal Template document hardcoded data | ||
| pub(crate) struct ProposalTemplateDocData( | ||
| /// ID and Version | ||
| &'static str, | ||
| /// Category ID | ||
| &'static str, | ||
| /// Content bytes | ||
| &'static [u8], | ||
| ); | ||
|
|
||
| /// List of proposal templates, proposals each of which is uniquely associated with one of the predefined categories. | ||
| #[rustfmt::skip] | ||
| pub(crate) const PROPOSAL_TEMPLATES: [ProposalTemplateDocData; 4] = [ | ||
| ProposalTemplateDocData("0199802c-21b4-717d-9619-11357877f471", CATEGORY_DOCUMENTS[0].0, include_bytes!("../../../../../../../docs/src/architecture/08_concepts/document_templates/proposal/F14-Generic/0194d492-1daa-75b5-b4a4-5cf331cd8d1a.schema.json")), | ||
| ProposalTemplateDocData("0199802c-21b4-7982-ba3f-ec0cd0207b11", CATEGORY_DOCUMENTS[1].0, include_bytes!("../../../../../../../docs/src/architecture/08_concepts/document_templates/proposal/F14-Generic/0194d492-1daa-7371-8bd3-c15811b2b063.schema.json")), | ||
| ProposalTemplateDocData("0199802c-21b4-7f75-b14a-331cd1605f74", CATEGORY_DOCUMENTS[2].0, include_bytes!("../../../../../../../docs/src/architecture/08_concepts/document_templates/proposal/F14-Generic/0194d492-1daa-79c7-a222-2c3b581443a8.schema.json")), | ||
| ProposalTemplateDocData("0199802c-21b4-7d6c-aacd-54aa31fe1e4c", CATEGORY_DOCUMENTS[3].0, include_bytes!("../../../../../../../docs/src/architecture/08_concepts/document_templates/proposal/F14-Generic/0194d492-1daa-716f-a04e-f422f08a99dc.schema.json")), | ||
| ]; | ||
|
|
||
| impl From<ProposalTemplateDocData> for SignedDocData { | ||
| fn from(value: ProposalTemplateDocData) -> Self { | ||
| Self { | ||
| id: value.0, | ||
| ver: value.0, | ||
| doc_type: catalyst_signed_doc::doc_types::PROPOSAL_TEMPLATE_UUID_TYPE, | ||
| content: value.2, | ||
| category_id: Some(value.1), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// A definition of Comment Template document hardcoded data | ||
| pub(crate) struct CommentTemplateDocData( | ||
| /// ID and Version | ||
| &'static str, | ||
| /// Category ID | ||
| &'static str, | ||
| ); | ||
| /// List of comment templates, comments each of which is uniquely associated with one of the predefined categories. | ||
| #[rustfmt::skip] | ||
| pub(crate) const COMMENT_TEMPLATES: [CommentTemplateDocData; 4] = [ | ||
| CommentTemplateDocData("0199802c-21b4-7b2c-aafd-0af557e8408c", CATEGORY_DOCUMENTS[0].0), | ||
| CommentTemplateDocData("0199802c-21b4-78d8-a1df-2e4bd2e73507", CATEGORY_DOCUMENTS[1].0), | ||
| CommentTemplateDocData("0199802c-21b4-76da-9384-4dc1e2dc3d51", CATEGORY_DOCUMENTS[2].0), | ||
| CommentTemplateDocData("0199802c-21b4-7884-84cb-0bdf6c08e690", CATEGORY_DOCUMENTS[3].0), | ||
| ]; | ||
|
|
||
| impl From<CommentTemplateDocData> for SignedDocData { | ||
| fn from(value: CommentTemplateDocData) -> Self { | ||
| Self { | ||
| id: value.0, | ||
| ver: value.0, | ||
| doc_type: catalyst_signed_doc::doc_types::COMMENT_TEMPLATE_UUID_TYPE, | ||
| content: include_bytes!("../../../../../../../docs/src/architecture/08_concepts/document_templates/F14-Comments/0b8424d4-ebfd-46e3-9577-1775a69d290c.schema.json"), | ||
| category_id: Some(value.1), | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious and checked that: as far as I can see, the rustfmt::skip does nothing here. Perhaps it was useful before we made some of the formatting changes, but unless I'm missing something it can be removed now.