From fe032c0c0ae70a91ed93df3a7b77aa7b4877c139 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 19 Jun 2025 10:21:37 -0400 Subject: [PATCH 1/2] chore: remove unused token meta schema and references --- .../meta_schemas/token/v0/token-meta.json | 245 ------------------ .../schema/enrich_with_base_schema/v0/mod.rs | 2 - .../src/validation/meta_validators/mod.rs | 57 ---- 3 files changed, 304 deletions(-) delete mode 100644 packages/rs-dpp/schema/meta_schemas/token/v0/token-meta.json diff --git a/packages/rs-dpp/schema/meta_schemas/token/v0/token-meta.json b/packages/rs-dpp/schema/meta_schemas/token/v0/token-meta.json deleted file mode 100644 index 7e5d833fc8b..00000000000 --- a/packages/rs-dpp/schema/meta_schemas/token/v0/token-meta.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/dashpay/platform/blob/master/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json", - "type": "object", - "$defs": { - "localization": { - "type": "string", - "pattern": "^[\\p{L}\\p{N}]*$", - "minLength": 1, - "maxLength": 64, - "$comment": "Allow only alphanumeric characters" - }, - "identifier": { - "type": "string", - "contentMediaType": "application/x.dash.dpp.identifier", - "byteArray": true, - "minLength": 32, - "maxLength": 32, - "description": "A 32-byte identifier" - }, - "optionalIdentifier": { - "type": ["string", "null"], - "contentMediaType": "application/x.dash.dpp.identifier", - "byteArray": true, - "minLength": 32, - "maxLength": 32, - "description": "A 32-byte identifier" - }, - "authorizedActionTakers": { - "description": "Specifies who is authorized to take certain actions", - "oneOf": [ - { - "type": "object", - "properties": { - "type": { "const": "noOne" } - }, - "required": ["type"], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { "const": "contractOwner" } - }, - "required": ["type"], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { "const": "mainGroup" } - }, - "required": ["type"], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "type": { "const": "specifiedIdentities" }, - "identifiers": { - "type": "array", - "description": "An array of authorized identifiers", - "items": { - "$ref": "#/$defs/identifier" - }, - "uniqueItems": true - }, - "requiredSignersCount": { - "$ref": "#/$defs/requiredSignersCount", - "description": "Rules for required signers within these specified identities" - } - }, - "required": ["type", "identifiers", "requiredSignersCount"], - "additionalProperties": false - } - ] - }, - "changeControlRules": { - "type": "object", - "description": "Defines who can make changes to certain parameters and who can change that ability", - "properties": { - "authorizedToMakeChange": { - "$ref": "#/$defs/authorizedActionTakers", - "description": "Who is authorized to make the relevant change" - }, - "authorizedToChangeAuthorizedActionTakers": { - "$ref": "#/$defs/authorizedActionTakers", - "description": "Who is authorized to modify the list of people who can make the change" - }, - "changingAuthorizedActionTakersToNoOneAllowed": { - "type": "boolean", - "description": "Whether it is allowed to change the authorized action takers to no one in the future" - }, - "changingAuthorizedActionTakersToContractOwnerAllowed": { - "type": "boolean", - "description": "Whether it is allowed to change the authorized action takers to contract owner in the future" - } - }, - "required": [ - "authorizedToMakeChange", - "authorizedToChangeAuthorizedActionTakers", - "changingAuthorizedActionTakersToNoOneAllowed", - "changingAuthorizedActionTakersToContractOwnerAllowed" - ], - "additionalProperties": false - }, - "requiredSignersCount": { - "type": "integer", - "description": "How many signers are required to authorize actions", - "minimum": 1, - "maximum": 255 - } - }, - "properties": { - "description": { - "type": "string", - "maxLength": 1024, - "description": "Token description" - }, - "displayConventions": { - "type": "object", - "description": "Token display conventions including capitalization and localization", - "properties": { - "capitalize": { - "type": "boolean", - "description": "Indicates whether token names should be capitalized" - }, - "localizations": { - "type": "object", - "description": "A map of locale keys to their corresponding singular/plural forms", - "additionalProperties": { - "type": "object", - "description": "Localization forms for a given locale key", - "properties": { - "singularForm": { - "$ref": "#/$defs/localization" - }, - "pluralForm": { - "$ref": "#/$defs/localization" - } - }, - "required": [ - "singularForm", - "pluralForm" - ], - "additionalProperties": false - }, - "maxProperties": 255, - "minProperties": 1, - "propertyNames": { - "type": "string", - "minLength": 1, - "maxLength": 255 - } - }, - "decimals": { - "type": "integer", - "minimum": 0, - "description": "The number of decimal places the token supports" - } - }, - "required": ["capitalize", "localizations", "decimals"], - "additionalProperties": false - }, - "initialSupply": { - "type": "integer", - "minimum": 0, - "description": "The initial (base) supply of the token at creation time" - }, - "initialSupplyDestinationIdentityId": { - "$ref": "#/$defs/optionalIdentifier", - "description": "Optional identity where initial supply tokens are sent. If not set, the data contract owner identity is used" - }, - "maxSupply": { - "type": ["integer", "null"], - "minimum": 1, - "description": "The maximum supply the token can ever have, or null if there is no maximum" - }, - "maxSupplyChangeRules": { - "$ref": "#/$defs/changeControlRules", - "description": "Rules governing who can change the max supply and under what conditions" - }, - "mintedTokensDestinationIdentityId": { - "$ref": "#/$defs/optionalIdentifier", - "description": "Optional identity where newly minted tokens are sent. If set then minted tokens can be sent only to this identity" - }, - "mintedTokensDestinationIdentityRules": { - "$ref": "#/$defs/changeControlRules", - "description": "Rules for changing the new tokens destination identity" - }, - "mintingRules": { - "$ref": "#/$defs/changeControlRules", - "description": "Rules governing who and how new tokens can be minted manually" - }, - "burningRules": { - "$ref": "#/$defs/changeControlRules", - "description": "Rules governing who and how tokens can be burned manually" - }, - "mainControlGroup": { - "type": "array", - "description": "The main control group, if present", - "items": { - "type": "object", - "properties": { - "identifiers": { - "type": "array", - "description": "A set of identities representing members of the control group", - "items": { - "$ref": "#/$defs/identifier" - }, - "uniqueItems": true - }, - "requiredSignersCount": { - "$ref": "#/$defs/requiredSignersCount" - } - }, - "required": ["identifiers", "requiredSignersCount"], - "additionalProperties": false - } - }, - "mainControlGroupCanBeModified": { - "$ref": "#/$defs/authorizedActionTakers", - "description": "Specifies which entities are authorized to modify the main control group" - }, - "metadata": { - "type": "object", - "propertyNames": { - "type": "string", - "maxLength": 255 - }, - "additionalProperties": { - "type": "string", - "maxLength": 1024 - }, - "minProperties": 1, - "maxProperties": 255, - "description": "Token arbitrary metadata" - } - }, - "required": [ - "displayConventions", - "initialSupply" - ], - "additionalProperties": false -} diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs index 620fb154974..a60529162c7 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs @@ -6,8 +6,6 @@ use platform_value::{Value, ValueMapHelper}; pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = "https://github.com/dashpay/platform/blob/master/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json"; -pub const TOKEN_SCHEMA_URI_V0: &str = - "https://github.com/dashpay/platform/blob/master/packages/rs-dpp/schema/meta_schemas/document/v0/token-meta.json"; pub const PROPERTY_SCHEMA: &str = "$schema"; diff --git a/packages/rs-dpp/src/validation/meta_validators/mod.rs b/packages/rs-dpp/src/validation/meta_validators/mod.rs index 05e1024a526..fd161724f20 100644 --- a/packages/rs-dpp/src/validation/meta_validators/mod.rs +++ b/packages/rs-dpp/src/validation/meta_validators/mod.rs @@ -40,10 +40,6 @@ lazy_static! { "../../../schema/meta_schemas/document/v0/document-meta.json" )) .unwrap(); - static ref TOKEN_META_JSON_V0: Value = serde_json::from_str::(include_str!( - "../../../schema/meta_schemas/token/v0/token-meta.json" - )) - .unwrap(); pub static ref DRAFT_202012_META_SCHEMA: JSONSchema = JSONSchema::options() .with_draft(Draft::Draft202012) @@ -143,57 +139,4 @@ lazy_static! { .compile(&DOCUMENT_META_JSON_V0) .expect("Invalid data contract schema"); - // Compiled version of token meta schema - pub static ref TOKEN_META_SCHEMA_V0: JSONSchema = JSONSchema::options() - .with_keyword( - "byteArray", - |_, _, _| Ok(Box::new(ByteArrayKeyword)), - ) - .with_patterns_regex_engine(RegexEngine::Regex(RegexOptions { - size_limit: Some(5 * (1 << 20)), - ..Default::default() - })) - .should_ignore_unknown_formats(false) - .should_validate_formats(true) - .with_patterns_regex_engine(RegexEngine::Regex(Default::default())) - .with_draft(Draft::Draft202012) - .with_document( - "https://json-schema.org/draft/2020-12/meta/applicator".to_string(), - DRAFT202012_APPLICATOR.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/core".to_string(), - DRAFT202012_CORE.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/applicator".to_string(), - DRAFT202012_APPLICATOR.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/unevaluated".to_string(), - DRAFT202012_UNEVALUATED.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/validation".to_string(), - DRAFT202012_VALIDATION.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/meta-data".to_string(), - DRAFT202012_META_DATA.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/format-annotation".to_string(), - DRAFT202012_FORMAT_ANNOTATION.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/meta/content".to_string(), - DRAFT202012_CONTENT.clone(), - ) - .with_document( - "https://json-schema.org/draft/2020-12/schema".to_string(), - DRAFT202012.clone(), - ) - .to_owned() - .compile(&TOKEN_META_JSON_V0) - .expect("Invalid data contract schema"); } From e24f03868310fe1a5bfeef71d4a671a886ed0702 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 19 Jun 2025 11:07:04 -0400 Subject: [PATCH 2/2] chore: cargo fmt --- .../document_type/schema/enrich_with_base_schema/v0/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs index a60529162c7..e483d0ff6ac 100644 --- a/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/document_type/schema/enrich_with_base_schema/v0/mod.rs @@ -6,7 +6,6 @@ use platform_value::{Value, ValueMapHelper}; pub const DATA_CONTRACT_SCHEMA_URI_V0: &str = "https://github.com/dashpay/platform/blob/master/packages/rs-dpp/schema/meta_schemas/document/v0/document-meta.json"; - pub const PROPERTY_SCHEMA: &str = "$schema"; const SYSTEM_GENERATED_FIELDS: [&str; 9] = [