diff --git a/packages/rs-dpp/src/data_contract/accessors/mod.rs b/packages/rs-dpp/src/data_contract/accessors/mod.rs index 846b6752282..8557931c81e 100644 --- a/packages/rs-dpp/src/data_contract/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/mod.rs @@ -284,6 +284,20 @@ impl DataContractV1Getters for DataContract { } } + fn description(&self) -> Option<&String> { + match self { + DataContract::V0(_) => None, + DataContract::V1(v1) => v1.description.as_ref(), + } + } + + fn description_mut(&mut self) -> Option<&mut String> { + match self { + DataContract::V0(_) => None, + DataContract::V1(v1) => v1.description.as_mut(), + } + } + /// Returns the timestamp in milliseconds when the contract was created. fn created_at(&self) -> Option { match self { @@ -422,4 +436,11 @@ impl DataContractV1Setters for DataContract { v1.keywords = keywords; } } + + /// Sets the description for the contract. + fn set_description(&mut self, description: Option) { + if let DataContract::V1(v1) = self { + v1.description = description; + } + } } diff --git a/packages/rs-dpp/src/data_contract/accessors/v1/mod.rs b/packages/rs-dpp/src/data_contract/accessors/v1/mod.rs index b798c6e1f53..82a32be1b5f 100644 --- a/packages/rs-dpp/src/data_contract/accessors/v1/mod.rs +++ b/packages/rs-dpp/src/data_contract/accessors/v1/mod.rs @@ -69,6 +69,12 @@ pub trait DataContractV1Getters: DataContractV0Getters { /// Returns a mutable reference to the keywords for the contract. fn keywords_mut(&mut self) -> Option<&mut Vec>; + + /// Returns the description for the contract. + fn description(&self) -> Option<&String>; + + /// Returns a mutable reference to the description for the contract. + fn description_mut(&mut self) -> Option<&mut String>; } pub trait DataContractV1Setters: DataContractV0Setters { @@ -104,4 +110,7 @@ pub trait DataContractV1Setters: DataContractV0Setters { /// Sets the keywords for the contract. fn set_keywords(&mut self, keywords: Vec); + + /// Sets the description for the contract. + fn set_description(&mut self, description: Option); } diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/mod.rs index 662ab19373f..31bc9009da0 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/mod.rs @@ -142,6 +142,13 @@ impl TokenConfigurationV0Getters for TokenConfiguration { TokenConfiguration::V0(v0) => v0.all_used_group_positions(), } } + + /// Returns the token description. + fn description(&self) -> &Option { + match self { + TokenConfiguration::V0(v0) => v0.description(), + } + } } /// Implementing TokenConfigurationV0Setters for TokenConfiguration @@ -240,4 +247,11 @@ impl TokenConfigurationV0Setters for TokenConfiguration { TokenConfiguration::V0(v0) => v0.set_main_control_group_can_be_modified(action_takers), } } + + /// Sets the token description. + fn set_description(&mut self, description: Option) { + match self { + TokenConfiguration::V0(v0) => v0.set_description(description), + } + } } diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/v0/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/v0/mod.rs index 59fa3d34b6c..093d4622ea9 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/accessors/v0/mod.rs @@ -14,13 +14,17 @@ pub trait TokenConfigurationV0Getters { /// Returns a mutable reference to the conventions. fn conventions_mut(&mut self) -> &mut TokenConfigurationConvention; + /// Returns the new tokens destination identity rules. fn conventions_change_rules(&self) -> &ChangeControlRules; /// Returns the base supply. fn base_supply(&self) -> TokenAmount; - /// Returns the base supply. + + /// Returns the KeepsHistory rules. fn keeps_history(&self) -> &TokenKeepsHistoryRules; + + /// Returns if we start as paused. fn start_as_paused(&self) -> bool; /// Returns the maximum supply. @@ -46,8 +50,10 @@ pub trait TokenConfigurationV0Getters { /// Returns the unfreeze rules. fn unfreeze_rules(&self) -> &ChangeControlRules; + /// Returns the destroy frozen funds rules. fn destroy_frozen_funds_rules(&self) -> &ChangeControlRules; + /// Returns the emergency action rules. fn emergency_action_rules(&self) -> &ChangeControlRules; @@ -59,6 +65,9 @@ pub trait TokenConfigurationV0Getters { /// Returns all group positions used in the token configuration fn all_used_group_positions(&self) -> BTreeSet; + + /// Returns the token description. + fn description(&self) -> &Option; } /// Accessor trait for setters of `TokenConfigurationV0` @@ -92,8 +101,10 @@ pub trait TokenConfigurationV0Setters { /// Sets the unfreeze rules. fn set_unfreeze_rules(&mut self, rules: ChangeControlRules); + /// Sets the `destroy frozen funds` rules. fn set_destroy_frozen_funds_rules(&mut self, rules: ChangeControlRules); + /// Sets the emergency action rules. fn set_emergency_action_rules(&mut self, rules: ChangeControlRules); @@ -102,4 +113,7 @@ pub trait TokenConfigurationV0Setters { /// Sets the main control group can be modified. fn set_main_control_group_can_be_modified(&mut self, action_takers: AuthorizedActionTakers); + + /// Sets the token description. + fn set_description(&mut self, description: Option); } diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs index 2e7c1353ad4..889df4e4d0a 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs @@ -149,6 +149,11 @@ impl TokenConfigurationV0Getters for TokenConfigurationV0 { group_positions } + + /// Returns the token description. + fn description(&self) -> &Option { + &self.description + } } /// Implementing `TokenConfigurationV0Setters` for `TokenConfigurationV0` @@ -220,4 +225,9 @@ impl TokenConfigurationV0Setters for TokenConfigurationV0 { fn set_main_control_group_can_be_modified(&mut self, action_takers: AuthorizedActionTakers) { self.main_control_group_can_be_modified = action_takers; } + + /// Sets the token description. + fn set_description(&mut self, description: Option) { + self.description = description; + } } diff --git a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs index 62cb3ba138b..4f56f36926f 100644 --- a/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs +++ b/packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs @@ -57,6 +57,8 @@ pub struct TokenConfigurationV0 { pub main_control_group: Option, #[serde(default)] pub main_control_group_can_be_modified: AuthorizedActionTakers, + #[serde(default)] + pub description: Option, } // Default function for `keeps_history` @@ -265,6 +267,7 @@ impl TokenConfigurationV0 { .into(), main_control_group: None, main_control_group_can_be_modified: AuthorizedActionTakers::NoOne, + description: None, } } diff --git a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs index cfc34db8115..71cdd23526b 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/mod.rs @@ -106,6 +106,13 @@ impl DataContractInSerializationFormat { } } + pub fn description(&self) -> &Option { + match self { + DataContractInSerializationFormat::V0(_) => &None, + DataContractInSerializationFormat::V1(v1) => &v1.description, + } + } + pub fn eq_without_auto_fields(&self, other: &Self) -> bool { match (self, other) { ( diff --git a/packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs b/packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs index b79927dd307..c9144dfa7c7 100644 --- a/packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs +++ b/packages/rs-dpp/src/data_contract/serialized_version/v1/mod.rs @@ -63,6 +63,10 @@ pub struct DataContractInSerializationFormatV1 { /// The contract's keywords for searching #[serde(default)] pub keywords: Vec, + + /// The contract's description + #[serde(default)] + pub description: Option, } fn deserialize_u16_group_map<'de, D>( @@ -129,6 +133,7 @@ impl From for DataContractInSerializationFormatV1 { groups: Default::default(), tokens: Default::default(), keywords: Default::default(), + description: None, } } DataContract::V1(v1) => { @@ -148,6 +153,7 @@ impl From for DataContractInSerializationFormatV1 { groups, tokens, keywords, + description, } = v1; DataContractInSerializationFormatV1 { @@ -169,6 +175,7 @@ impl From for DataContractInSerializationFormatV1 { groups, tokens, keywords, + description, } } } diff --git a/packages/rs-dpp/src/data_contract/v1/accessors/mod.rs b/packages/rs-dpp/src/data_contract/v1/accessors/mod.rs index f5991b3d72f..72bdb5069c4 100644 --- a/packages/rs-dpp/src/data_contract/v1/accessors/mod.rs +++ b/packages/rs-dpp/src/data_contract/v1/accessors/mod.rs @@ -234,6 +234,16 @@ impl DataContractV1Getters for DataContractV1 { fn keywords_mut(&mut self) -> Option<&mut Vec> { Some(&mut self.keywords) } + + /// Returns the description of the contract. + fn description(&self) -> Option<&String> { + self.description.as_ref() + } + + /// Returns a mutable reference to the description of the contract. + fn description_mut(&mut self) -> Option<&mut String> { + self.description.as_mut() + } } impl DataContractV1Setters for DataContractV1 { @@ -287,4 +297,9 @@ impl DataContractV1Setters for DataContractV1 { fn set_keywords(&mut self, keywords: Vec) { self.keywords = keywords; } + + /// Sets the description for the contract. + fn set_description(&mut self, description: Option) { + self.description = description; + } } diff --git a/packages/rs-dpp/src/data_contract/v1/data_contract.rs b/packages/rs-dpp/src/data_contract/v1/data_contract.rs index 19d2e7b9325..37318e70ca5 100644 --- a/packages/rs-dpp/src/data_contract/v1/data_contract.rs +++ b/packages/rs-dpp/src/data_contract/v1/data_contract.rs @@ -110,4 +110,7 @@ pub struct DataContractV1 { /// The contract's keywords for searching pub keywords: Vec, + + /// The contract's description + pub description: Option, } diff --git a/packages/rs-dpp/src/data_contract/v1/serialization/mod.rs b/packages/rs-dpp/src/data_contract/v1/serialization/mod.rs index 05e40710b7b..332cf574d2a 100644 --- a/packages/rs-dpp/src/data_contract/v1/serialization/mod.rs +++ b/packages/rs-dpp/src/data_contract/v1/serialization/mod.rs @@ -112,6 +112,7 @@ impl DataContractV1 { groups: Default::default(), tokens: Default::default(), keywords: Default::default(), + description: None, }; Ok(data_contract) @@ -139,6 +140,7 @@ impl DataContractV1 { groups, tokens, keywords, + description, } = data_contract_data; let document_types = DocumentType::create_document_types_from_document_schemas( @@ -168,6 +170,7 @@ impl DataContractV1 { groups, tokens, keywords, + description, }; Ok(data_contract) diff --git a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs index d727e14f865..b1743acfa86 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/basic_error.rs @@ -76,8 +76,8 @@ use crate::consensus::basic::{ use crate::consensus::ConsensusError; use super::data_contract::{ - DuplicateKeywordsError, InvalidKeywordEncodingError, InvalidKeywordLengthError, - TooManyKeywordsError, + DuplicateKeywordsError, InvalidDescriptionLengthError, InvalidKeywordEncodingError, + InvalidKeywordLengthError, TooManyKeywordsError, }; use crate::consensus::basic::group::GroupActionNotAllowedOnTransitionError; use crate::consensus::basic::overflow_error::OverflowError; @@ -531,6 +531,9 @@ pub enum BasicError { #[error(transparent)] InvalidKeywordEncodingError(InvalidKeywordEncodingError), + + #[error(transparent)] + InvalidDescriptionLengthError(InvalidDescriptionLengthError), } impl From for ConsensusError { diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs new file mode 100644 index 00000000000..7d8c04788a5 --- /dev/null +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/invalid_description_length_error.rs @@ -0,0 +1,44 @@ +use crate::consensus::basic::BasicError; +use crate::consensus::ConsensusError; +use crate::errors::ProtocolError; +use bincode::{Decode, Encode}; +use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize}; +use thiserror::Error; + +#[derive( + Error, Debug, Clone, PartialEq, Eq, Encode, Decode, PlatformSerialize, PlatformDeserialize, +)] +#[error("Data contract {} has description with invalid length: '{}'. Valid length is between 3 and 100 characters.", contract_id, description.len())] +#[platform_serialize(unversioned)] +pub struct InvalidDescriptionLengthError { + /* + + DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION + + */ + contract_id: String, + description: String, +} + +impl InvalidDescriptionLengthError { + pub fn new(contract_id: String, description: String) -> Self { + Self { + contract_id, + description, + } + } + + pub fn contract_id(&self) -> &str { + &self.contract_id + } + + pub fn description(&self) -> &str { + &self.description + } +} + +impl From for ConsensusError { + fn from(err: InvalidDescriptionLengthError) -> Self { + Self::BasicError(BasicError::InvalidDescriptionLengthError(err)) + } +} diff --git a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs index c0610a52f0d..56ea0690eca 100644 --- a/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs +++ b/packages/rs-dpp/src/errors/consensus/basic/data_contract/mod.rs @@ -22,6 +22,7 @@ mod incompatible_re2_pattern_error; mod invalid_compound_index_error; mod invalid_data_contract_id_error; mod invalid_data_contract_version_error; +mod invalid_description_length_error; mod invalid_document_type_name_error; mod invalid_document_type_required_security_level; mod invalid_index_property_type_error; @@ -81,6 +82,7 @@ pub use group_non_unilateral_member_power_has_less_than_required_power_error::*; pub use group_position_does_not_exist_error::*; pub use group_total_power_has_less_than_required_power_error::*; pub use incompatible_document_type_schema_error::*; +pub use invalid_description_length_error::*; pub use invalid_document_type_name_error::*; pub use invalid_keyword_encoding_error::*; pub use invalid_keyword_length_error::*; diff --git a/packages/rs-dpp/src/errors/consensus/codes.rs b/packages/rs-dpp/src/errors/consensus/codes.rs index aeef3882fcd..e974c30e5bc 100644 --- a/packages/rs-dpp/src/errors/consensus/codes.rs +++ b/packages/rs-dpp/src/errors/consensus/codes.rs @@ -110,6 +110,7 @@ impl ErrorWithCode for BasicError { Self::DuplicateKeywordsError(_) => 10263, Self::InvalidKeywordLengthError(_) => 10264, Self::InvalidKeywordEncodingError(_) => 10265, + Self::InvalidDescriptionLengthError(_) => 10266, // Group Errors: 10350-10399 Self::GroupPositionDoesNotExistError(_) => 10350, diff --git a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs index d84943877b5..3e794714efd 100644 --- a/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/check_tx/v0/mod.rs @@ -630,7 +630,7 @@ mod tests { ) .expect("expected to process state transition"); - assert_eq!(processing_result.aggregated_fees().processing_fee, 2488810); + assert_eq!(processing_result.aggregated_fees().processing_fee, 2489210); let check_result = platform .check_tx( @@ -1141,7 +1141,7 @@ mod tests { // The processing fees should be twice as much as a fee multiplier of 0, // since a fee multiplier of 100 means 100% more of 1 (gives 2) - assert_eq!(processing_result.aggregated_fees().processing_fee, 4977620); + assert_eq!(processing_result.aggregated_fees().processing_fee, 4978420); let check_result = platform .check_tx( @@ -1613,7 +1613,7 @@ mod tests { ) .expect("expected to process state transition"); - assert_eq!(processing_result.aggregated_fees().processing_fee, 2488810); + assert_eq!(processing_result.aggregated_fees().processing_fee, 2489210); platform .drive @@ -1699,7 +1699,7 @@ mod tests { assert_eq!( update_processing_result.aggregated_fees().processing_fee, - 2503570 + 2504030 ); let check_result = platform @@ -2069,7 +2069,7 @@ mod tests { ) .expect("expected to process state transition"); - assert_eq!(processing_result.aggregated_fees().processing_fee, 2488810); + assert_eq!(processing_result.aggregated_fees().processing_fee, 2489210); platform .drive diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs index 6eef53767ff..5b5aab870f6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs @@ -224,8 +224,18 @@ impl Platform { emergency_action_rules: ChangeControlRulesV0::default().into(), main_control_group: None, main_control_group_can_be_modified: Default::default(), + description: Some("Some token description".to_string()), }); + token_configuration.conventions.localizations.insert( + "en".to_string(), + TokenConfigurationLocalization::V0(TokenConfigurationLocalizationV0 { + should_capitalize, + singular_form: "cat".to_string(), + plural_form: "cats".to_string(), + }), + ); + let tokens = [ (0, token_configuration.clone()), (1, token_configuration.clone()), @@ -248,7 +258,8 @@ impl Platform { updated_at_epoch: None, groups, tokens, - keywords: vec!["key1".into(), "key2".into()], + keywords: vec!["cat".into(), "white".into()], + description: Some("Some contract description".to_string()), }); self.drive.apply_contract( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs index 422bd9c960b..0b3fb36f414 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/creation.rs @@ -2504,8 +2504,8 @@ mod creation_tests { // Get the document type from the search contract. let doc_type = search_contract - .document_type_for_name("contract") - .expect("expected to find 'contract' in Search contract"); + .document_type_for_name("contractKeywords") + .expect("expected to find 'contractKeywords' in Search contract"); // Verify that the document type has the restrictive creation mode assert_eq!( @@ -2599,7 +2599,7 @@ mod creation_tests { format!( "Document Creation on {}:{} is not allowed because of the document type's creation restriction mode No Creation Allowed", search_contract.id().to_string(Encoding::Base58), - "contract" + "contractKeywords" ), "Mismatch in error message" ); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs index 665b162e751..85aa0655e39 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/advanced_structure/v0/mod.rs @@ -5,7 +5,9 @@ use crate::execution::types::execution_operation::ValidationOperation; use crate::execution::types::state_transition_execution_context::{ StateTransitionExecutionContext, StateTransitionExecutionContextMethodsV0, }; -use dpp::consensus::basic::data_contract::{DuplicateKeywordsError, InvalidKeywordLengthError}; +use dpp::consensus::basic::data_contract::{ + DuplicateKeywordsError, InvalidDescriptionLengthError, InvalidKeywordLengthError, +}; use dpp::consensus::basic::data_contract::{ InvalidDataContractIdError, InvalidDataContractVersionError, InvalidTokenBaseSupplyError, NonContiguousContractTokenPositionsError, @@ -226,6 +228,27 @@ impl DataContractCreatedStateTransitionAdvancedStructureValidationV0 } } + // Validate the description is between 3 and 100 characters + if let Some(description) = self.data_contract().description() { + if !(description.len() >= 3 && description.len() <= 100) { + let bump_action = StateTransitionAction::BumpIdentityNonceAction( + BumpIdentityNonceAction::from_borrowed_data_contract_create_transition(self), + ); + + return Ok(ConsensusValidationResult::new_with_data_and_errors( + bump_action, + vec![ConsensusError::BasicError( + BasicError::InvalidDescriptionLengthError( + InvalidDescriptionLengthError::new( + self.data_contract().id().to_string(Encoding::Base58), + description.to_string(), + ), + ), + )], + )); + } + } + Ok(ConsensusValidationResult::default()) } } diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs index 9aa0193e912..8c5a168089a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_create/mod.rs @@ -2452,7 +2452,12 @@ mod tests { use super::*; use dpp::{ data_contract::conversion::value::v0::DataContractValueConversionMethodsV0, + data_contracts::SystemDataContract, document::DocumentV0Getters, platform_value::string_encoding::Encoding, + system_data_contracts::load_system_data_contract, + }; + use drive::{ + drive::document::query::QueryDocumentsOutcomeV0Methods, query::DriveDocumentQuery, }; #[test] @@ -2956,6 +2961,366 @@ mod tests { assert_eq!(keywords[0], "key1"); assert_eq!(keywords[1], "key2"); assert_eq!(keywords[2], "key3"); + + // Now check the Search Contract has the keyword documents + let search_contract = + load_system_data_contract(SystemDataContract::Search, PlatformVersion::latest()) + .expect("expected to load search contract"); + let document_type = search_contract + .document_type_for_name("contractKeywords") + .expect("expected to get document type"); + + let drive_query = + DriveDocumentQuery::all_items_query(&search_contract, document_type, None); + + let documents_result = platform + .drive + .query_documents(drive_query, None, false, None, None) + .expect("expected to query documents"); + + let documents = documents_result.documents(); + + assert_eq!(documents.len(), 3); + + let mut valid_keywords_for_verification = vec!["key1", "key2", "key3"]; + for document in documents { + let keyword = document + .get("keyword") + .expect("expected to get keyword") + .as_str() + .expect("expected to get string"); + + assert!(valid_keywords_for_verification.contains(&keyword)); + assert_eq!( + document + .get("contractId") + .expect("expected to get data contract id") + .clone() + .into_identifier() + .expect("expected to get identifier") + .to_string(Encoding::Base58), + data_contract_id_str + ); + valid_keywords_for_verification.retain(|&x| x != keyword); + } + } + } + + mod descriptions { + use dpp::{ + data_contract::conversion::value::v0::DataContractValueConversionMethodsV0, + data_contracts::SystemDataContract, document::DocumentV0Getters, + platform_value::string_encoding::Encoding, + system_data_contracts::load_system_data_contract, + }; + use drive::{ + drive::document::query::QueryDocumentsOutcomeV0Methods, query::DriveDocumentQuery, + }; + + use super::*; + + /// Returns a `DataContract` value that already contains at least one keyword + fn base_contract_value_with_keyword(platform_version: &PlatformVersion) -> Value { + let data_contract = json_document_to_contract_with_ids( + // Re‑use the same fixture you already have; it doesn’t need + // to contain a description field – we mutate it below. + "tests/supporting_files/contract/keyword_test/keyword_base_contract.json", + None, + None, + false, + platform_version, + ) + .expect("expected to load contract"); + + let mut contract_value = data_contract + .to_value(PlatformVersion::latest()) + .expect("to_value failed"); + + // Ensure the `keywords` array is not empty so that Drive will attempt + // to create the description documents. + contract_value["keywords"] = Value::Array(vec![Value::Text("key1".to_string())]); + + contract_value + } + + #[test] + fn test_data_contract_creation_fails_with_description_too_short() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + // --- mutate the contract --- + let mut contract_value = base_contract_value_with_keyword(platform_version); + contract_value["description"] = Value::Text("hi".to_string()); // < 3 chars + + let data_contract_invalid = + DataContract::from_value(contract_value, true, platform_version) + .expect("failed to create DataContract from Value"); + + let transition = DataContractCreateTransition::new_from_data_contract( + data_contract_invalid, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expected to create transition"); + + let serialized = transition + .serialize_to_bytes() + .expect("expected to serialize"); + + let tx = platform.drive.grove.start_transaction(); + let processing_result = platform + .platform + .process_raw_state_transitions( + &[serialized], + &platform_state, + &BlockInfo::default(), + &tx, + platform_version, + false, + None, + ) + .expect("expected processing"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::PaidConsensusError( + ConsensusError::BasicError(BasicError::InvalidDescriptionLengthError(_)), + _ + )] + ); + } + + #[test] + fn test_data_contract_creation_fails_with_description_too_long() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let mut contract_value = base_contract_value_with_keyword(platform_version); + // 101 chars – valid for the contract (max 10 000) but exceeds the + // 100‑char limit of the autogenerated **shortDescription** document. + let too_long = "x".repeat(101); + contract_value["description"] = Value::Text(too_long); + + let data_contract_invalid = + DataContract::from_value(contract_value, true, platform_version) + .expect("failed to create DataContract"); + + let transition = DataContractCreateTransition::new_from_data_contract( + data_contract_invalid, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expected to create transition"); + + let serialized = transition + .serialize_to_bytes() + .expect("expected to serialize"); + + let tx = platform.drive.grove.start_transaction(); + let processing_result = platform + .platform + .process_raw_state_transitions( + &[serialized], + &platform_state, + &BlockInfo::default(), + &tx, + platform_version, + false, + None, + ) + .expect("expected processing"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::PaidConsensusError( + ConsensusError::BasicError(BasicError::InvalidDescriptionLengthError(_)), + _ + )] + ); + } + + #[test] + fn test_data_contract_creation_succeeds_with_valid_description() { + let platform_version = PlatformVersion::latest(); + let mut platform = TestPlatformBuilder::new() + .build_with_mock_rpc() + .set_genesis_state(); + + let platform_state = platform.state.load(); + let (identity, signer, key) = setup_identity(&mut platform, 958, dash_to_credits!(0.1)); + + let mut contract_value = base_contract_value_with_keyword(platform_version); + contract_value["description"] = + Value::Text("A perfectly valid description.".to_string()); + + let data_contract_valid = + DataContract::from_value(contract_value, true, platform_version) + .expect("failed to create DataContract"); + + let transition = DataContractCreateTransition::new_from_data_contract( + data_contract_valid, + 1, + &identity.into_partial_identity_info(), + key.id(), + &signer, + platform_version, + None, + ) + .expect("expected to create transition"); + + let serialized = transition + .serialize_to_bytes() + .expect("expected to serialize"); + + let tx = platform.drive.grove.start_transaction(); + let processing_result = platform + .platform + .process_raw_state_transitions( + &[serialized], + &platform_state, + &BlockInfo::default(), + &tx, + platform_version, + false, + None, + ) + .expect("expected processing"); + + assert_matches!( + processing_result.execution_results().as_slice(), + [StateTransitionExecutionResult::SuccessfulExecution(_, _)] + ); + + // Commit so we can query the state afterwards + platform + .drive + .grove + .commit_transaction(tx) + .unwrap() + .expect("expected commit"); + + // ---- Verify description persisted in the contract ---- + let unique_identifiers = transition.unique_identifiers(); + let unique_identifier = unique_identifiers + .first() + .expect("expected at least one unique identifier"); + let data_contract_id_str = unique_identifier + .as_str() + .split('-') + .last() + .expect("split contract id"); + let data_contract_id = Identifier::from_string(data_contract_id_str, Encoding::Base58) + .expect("identifier"); + + let contract = platform + .drive + .fetch_contract(data_contract_id.into(), None, None, None, platform_version) + .value + .expect("expected contract") + .expect("contract exists"); + + let desc = contract + .contract + .description() + .expect("description should exist"); + + assert_eq!(desc, "A perfectly valid description."); + + // Now check the Search Contract has the short and full description documents + let search_contract = + load_system_data_contract(SystemDataContract::Search, PlatformVersion::latest()) + .expect("expected to load search contract"); + let short_description_document_type = search_contract + .document_type_for_name("shortDescription") + .expect("expected to get document type"); + let full_description_document_type = search_contract + .document_type_for_name("fullDescription") + .expect("expected to get document type"); + + let drive_query_short_description = DriveDocumentQuery::all_items_query( + &search_contract, + short_description_document_type, + None, + ); + + let short_description_documents_result = platform + .drive + .query_documents(drive_query_short_description, None, false, None, None) + .expect("expected to query documents"); + + let short_description_documents = short_description_documents_result.documents(); + + assert_eq!(short_description_documents.len(), 1); + let short_description_document = short_description_documents + .first() + .expect("expected to get first document"); + let short_description = short_description_document + .get("description") + .expect("expected to get description") + .as_str() + .expect("expected to get string"); + assert_eq!(short_description, "A perfectly valid description."); + assert_eq!( + short_description_document + .get("contractId") + .expect("expected to get data contract id") + .clone() + .into_identifier() + .expect("expected to get identifier") + .to_string(Encoding::Base58), + data_contract_id_str + ); + + let drive_query_full_description = DriveDocumentQuery::all_items_query( + &search_contract, + full_description_document_type, + None, + ); + let full_description_documents_result = platform + .drive + .query_documents(drive_query_full_description, None, false, None, None) + .expect("expected to query documents"); + + let full_description_documents = full_description_documents_result.documents(); + + assert_eq!(full_description_documents.len(), 1); + let full_description_document = full_description_documents + .first() + .expect("expected to get first document"); + let full_description = full_description_document + .get("description") + .expect("expected to get description") + .as_str() + .expect("expected to get string"); + assert_eq!(full_description, "A perfectly valid description."); + assert_eq!( + full_description_document + .get("contractId") + .expect("expected to get data contract id") + .clone() + .into_identifier() + .expect("expected to get identifier") + .to_string(Encoding::Base58), + data_contract_id_str + ); } } } diff --git a/packages/rs-drive/src/drive/contract/insert/add_description/mod.rs b/packages/rs-drive/src/drive/contract/insert/add_description/mod.rs new file mode 100644 index 00000000000..9931b56defb --- /dev/null +++ b/packages/rs-drive/src/drive/contract/insert/add_description/mod.rs @@ -0,0 +1,134 @@ +use crate::drive::Drive; +use crate::error::drive::DriveError; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use dpp::block::block_info::BlockInfo; +use dpp::fee::fee_result::FeeResult; +use dpp::version::PlatformVersion; + +use dpp::prelude::Identifier; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use std::collections::HashMap; + +mod v0; + +impl Drive { + /// Adds contract description to the state. + pub fn add_new_contract_description( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + match platform_version + .drive + .methods + .contract + .insert + .insert_contract + { + 0 => Err(Error::Drive(DriveError::NotSupported( + "Contract descriptions are not supported in this version", + ))), + 1 => self.add_new_contract_description_v0( + contract_id, + owner_id, + description, + block_info, + apply, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_new_contract_description".to_string(), + known_versions: vec![0, 1], + received: version, + })), + } + } + + /// Adds contract description creation operations to drive operations + pub fn add_new_contract_description_add_to_operations( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive + .methods + .contract + .insert + .insert_contract + { + 0 => Err(Error::Drive(DriveError::NotSupported( + "Contract descriptions are not supported in this version", + ))), + 1 => self.add_new_contract_description_add_to_operations_v0( + contract_id, + owner_id, + description, + block_info, + apply, + transaction, + drive_operations, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_new_contract_description_add_to_operations".to_string(), + known_versions: vec![0, 1], + received: version, + })), + } + } + + /// The operations needed to create a description + pub fn add_new_contract_description_operations( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive + .methods + .contract + .insert + .insert_contract + { + 0 => Err(Error::Drive(DriveError::NotSupported( + "Contract descriptions are not supported in this version", + ))), + 1 => self.add_new_contract_description_operations_v0( + contract_id, + owner_id, + description, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + ), + version => Err(Error::Drive(DriveError::UnknownVersionMismatch { + method: "add_new_contract_description_operations".to_string(), + known_versions: vec![0, 1], + received: version, + })), + } + } +} diff --git a/packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs b/packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs new file mode 100644 index 00000000000..855724c9c8b --- /dev/null +++ b/packages/rs-drive/src/drive/contract/insert/add_description/v0/mod.rs @@ -0,0 +1,214 @@ +use crate::drive::Drive; +use crate::error::Error; +use crate::fees::op::LowLevelDriveOperation; +use crate::util::object_size_info::DocumentInfo::DocumentOwnedInfo; +use crate::util::object_size_info::{DocumentAndContractInfo, OwnedDocumentInfo}; +use dpp::block::block_info::BlockInfo; +use dpp::data_contract::accessors::v0::DataContractV0Getters; +use dpp::document::{Document, DocumentV0}; +use dpp::fee::fee_result::FeeResult; +use dpp::identifier::Identifier; +use grovedb::batch::KeyInfoPath; +use grovedb::{EstimatedLayerInformation, TransactionArg}; +use platform_version::version::PlatformVersion; +use std::collections::{BTreeMap, HashMap}; + +impl Drive { + /// Adds a contract description by inserting a new description subtree structure to the `Identities` subtree. + pub(super) fn add_new_contract_description_v0( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result { + let mut drive_operations: Vec = vec![]; + self.add_new_contract_description_add_to_operations_v0( + contract_id, + owner_id, + description, + block_info, + apply, + transaction, + &mut drive_operations, + platform_version, + )?; + let fees = Drive::calculate_fee( + None, + Some(drive_operations), + &block_info.epoch, + self.config.epochs_per_era, + platform_version, + None, + )?; + Ok(fees) + } + + /// Adds contract description creation operations to drive operations + pub(super) fn add_new_contract_description_add_to_operations_v0( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + apply: bool, + transaction: TransactionArg, + drive_operations: &mut Vec, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + let mut estimated_costs_only_with_layer_info = if apply { + None::> + } else { + Some(HashMap::new()) + }; + + let batch_operations = self.add_new_contract_description_operations( + contract_id, + owner_id, + description, + block_info, + &mut estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + + self.apply_batch_low_level_drive_operations( + estimated_costs_only_with_layer_info, + transaction, + batch_operations, + drive_operations, + &platform_version.drive, + ) + } + + /// The operations needed to create a description + pub(super) fn add_new_contract_description_operations_v0( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + block_info: &BlockInfo, + estimated_costs_only_with_layer_info: &mut Option< + HashMap, + >, + transaction: TransactionArg, + platform_version: &PlatformVersion, + ) -> Result, Error> { + let mut operations: Vec = vec![]; + + let contract = self.cache.system_data_contracts.load_search(); + + let short_description_document_type = + contract.document_type_for_name("shortDescription")?; + let full_description_document_type = contract.document_type_for_name("fullDescription")?; + + let short_description_document = self.build_contract_description_document_owned_v0( + contract_id, + owner_id, + description, + false, + block_info, + )?; + let full_description_document = self.build_contract_description_document_owned_v0( + contract_id, + owner_id, + description, + true, + block_info, + )?; + + let short_description_ops = self.add_document_for_contract_operations( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo((short_description_document, None)), + owner_id: Some(owner_id.to_buffer()), + }, + contract: &contract, + document_type: short_description_document_type, + }, + true, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + let full_description_ops = self.add_document_for_contract_operations( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentOwnedInfo((full_description_document, None)), + owner_id: Some(owner_id.to_buffer()), + }, + contract: &contract, + document_type: full_description_document_type, + }, + true, + block_info, + &mut None, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?; + + operations.extend(short_description_ops); + operations.extend(full_description_ops); + + Ok(operations) + } + + pub(super) fn build_contract_description_document_owned_v0( + &self, + contract_id: Identifier, + owner_id: Identifier, + description: &String, + full_description: bool, + block_info: &BlockInfo, + ) -> Result { + let owner_nonce = + match self.fetch_identity_nonce(owner_id.into(), true, None, PlatformVersion::latest()) + { + Ok(maybe_nonce) => maybe_nonce.unwrap_or(1), + Err(e) => return Err(e), + }; + + let document_type_name = if full_description { + "fullDescription".to_string() + } else { + "shortDescription".to_string() + }; + + let document_id = Document::generate_document_id_v0( + &contract_id, + &owner_id, + &document_type_name, + &owner_nonce.to_be_bytes(), + ); + + let properties = BTreeMap::from([ + ("contractId".to_string(), contract_id.into()), + ("description".to_string(), description.into()), + ]); + + let document: Document = DocumentV0 { + id: document_id, + owner_id, + properties, + revision: None, + created_at: Some(block_info.time_ms), + updated_at: None, + transferred_at: None, + created_at_block_height: Some(block_info.height), + updated_at_block_height: None, + transferred_at_block_height: None, + created_at_core_block_height: None, + updated_at_core_block_height: None, + transferred_at_core_block_height: None, + } + .into(); + + Ok(document) + } +} diff --git a/packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs b/packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs index 57c16d09351..a7daf634932 100644 --- a/packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/add_new_keywords/v0/mod.rs @@ -98,7 +98,7 @@ impl Drive { platform_version: &PlatformVersion, ) -> Result, Error> { let contract = self.cache.system_data_contracts.load_search(); - let document_type = contract.document_type_for_name("contract")?; + let document_type = contract.document_type_for_name("contractKeywords")?; let mut operations: Vec = vec![]; @@ -145,7 +145,7 @@ impl Drive { let document_id = Document::generate_document_id_v0( &contract_id, &owner_id, - "contract", + "contractKeywords", keyword_index.to_be_bytes().as_slice(), ); diff --git a/packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs b/packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs index 59a30e76062..1ed48c28095 100644 --- a/packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/insert_contract/v1/mod.rs @@ -319,6 +319,18 @@ impl Drive { )?); } + if let Some(description) = contract.description() { + batch_operations.extend(self.add_new_contract_description_operations( + contract.id(), + contract.owner_id(), + description, + block_info, + estimated_costs_only_with_layer_info, + transaction, + platform_version, + )?); + } + Ok(batch_operations) } } diff --git a/packages/rs-drive/src/drive/contract/insert/mod.rs b/packages/rs-drive/src/drive/contract/insert/mod.rs index ea57897be76..5822e243119 100644 --- a/packages/rs-drive/src/drive/contract/insert/mod.rs +++ b/packages/rs-drive/src/drive/contract/insert/mod.rs @@ -1,4 +1,6 @@ mod add_contract_to_storage; #[allow(clippy::too_many_arguments)] +mod add_description; +#[allow(clippy::too_many_arguments)] mod add_new_keywords; mod insert_contract; diff --git a/packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs b/packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs index cd66e430e60..b909d49d093 100644 --- a/packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/prove/prove_action_infos/v0/mod.rs @@ -154,6 +154,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); drive @@ -382,6 +383,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); drive diff --git a/packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs b/packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs index 5527662be18..c8602ac7dd4 100644 --- a/packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/prove/prove_action_signers/v0/mod.rs @@ -149,6 +149,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); drive @@ -318,6 +319,7 @@ mod tests { )]), tokens: BTreeMap::new(), keywords: Vec::new(), + description: None, }); drive @@ -412,6 +414,7 @@ mod tests { )]), tokens: BTreeMap::new(), keywords: Vec::new(), + description: None, }); drive diff --git a/packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs b/packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs index 93772e6c4b7..bab7fbe6036 100644 --- a/packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/prove/prove_group_info/v0/mod.rs @@ -107,6 +107,7 @@ mod tests { )]), tokens: Default::default(), keywords: Vec::new(), + description: None, }); let contract_id = contract.id(); @@ -177,6 +178,7 @@ mod tests { groups: Default::default(), tokens: Default::default(), keywords: Vec::new(), + description: None, }); let contract_id = contract.id(); diff --git a/packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs b/packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs index 3b53aae4b05..68b20c7b812 100644 --- a/packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/group/prove/prove_group_infos/v0/mod.rs @@ -135,6 +135,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let contract_id = contract.id(); @@ -280,6 +281,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let contract_id = contract.id(); diff --git a/packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs b/packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs index 5138aa8845d..b2a7667a713 100644 --- a/packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/balance/prove_identities_token_balances/v0/mod.rs @@ -98,6 +98,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive @@ -199,6 +200,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive @@ -291,6 +293,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive diff --git a/packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs b/packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs index d0069901b8e..354251fe180 100644 --- a/packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/balance/prove_identity_token_balances/v0/mod.rs @@ -103,6 +103,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); let token_id_1 = contract.token_id(0).expect("expected token at position 0"); @@ -264,6 +265,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); @@ -352,6 +354,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); diff --git a/packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs b/packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs index 43e1886b2f2..edc445f0df3 100644 --- a/packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/info/prove_identities_token_infos/v0/mod.rs @@ -98,6 +98,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive @@ -199,6 +200,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive @@ -289,6 +291,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); drive diff --git a/packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs b/packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs index 0a4ad4e064f..18e1a3e920f 100644 --- a/packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/info/prove_identity_token_infos/v0/mod.rs @@ -106,6 +106,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); let token_id_1 = contract.token_id(0).expect("expected token at position 0"); @@ -254,6 +255,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); diff --git a/packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs b/packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs index b4cbfd2a850..c7f6d5afdc8 100644 --- a/packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/status/prove_token_statuses/v0/mod.rs @@ -95,6 +95,7 @@ mod tests { ), ]), keywords: Vec::new(), + description: None, }); let token_id_1 = contract.token_id(0).expect("expected token at position 0"); diff --git a/packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs b/packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs index 83061d04d78..5d1858139bd 100644 --- a/packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs +++ b/packages/rs-drive/src/drive/tokens/system/prove_token_total_supply_and_aggregated_identity_balances/v0/mod.rs @@ -89,6 +89,7 @@ mod tests { TokenConfiguration::V0(TokenConfigurationV0::default_most_restrictive()), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); @@ -215,6 +216,7 @@ mod tests { ), )]), keywords: Vec::new(), + description: None, }); let token_id = contract.token_id(0).expect("expected token at position 0"); diff --git a/packages/rs-drive/tests/deterministic_root_hash.rs b/packages/rs-drive/tests/deterministic_root_hash.rs index 35b3d7e7b57..760ed03f3c9 100644 --- a/packages/rs-drive/tests/deterministic_root_hash.rs +++ b/packages/rs-drive/tests/deterministic_root_hash.rs @@ -302,7 +302,7 @@ mod tests { // We expect a different app hash because data contract is not serialized the same way let expected_app_hash = match platform_version.protocol_version { 0..=8 => "1b80f4a9f00597b3f1ddca904b3cee67576868adcdd802c0a3f91e14209bb402", - _ => "aa29a0d3dcdcb1dc1b446830931762e0b9c2e2d97d6f426f8dbe4e0eda8e6130", + _ => "76e3af331ff60aea3006671d048ce16871369da4ec562bdc9966837bb49ee92c", }; assert_eq!( diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index 8353aeecb0b..ac6c5d96250 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -2509,8 +2509,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 163, 83, 211, 88, 187, 57, 197, 189, 189, 39, 40, 150, 102, 186, 188, 111, 200, 230, - 134, 21, 72, 136, 135, 92, 102, 206, 72, 43, 127, 87, 26, 82, + 53, 9, 163, 92, 116, 134, 17, 186, 21, 68, 156, 162, 47, 181, 214, 162, 253, 4, 246, 8, + 41, 187, 151, 152, 216, 164, 206, 110, 230, 176, 124, 225, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -3823,8 +3823,8 @@ mod tests { assert_eq!( root_hash.as_slice(), vec![ - 243, 205, 195, 230, 73, 41, 217, 87, 42, 205, 142, 71, 144, 29, 239, 97, 174, 131, - 226, 122, 190, 78, 58, 99, 94, 106, 233, 185, 194, 198, 246, 205 + 144, 154, 147, 246, 236, 57, 41, 67, 21, 26, 212, 158, 68, 159, 206, 26, 158, 50, + 252, 62, 143, 176, 149, 50, 19, 226, 239, 65, 112, 243, 225, 64 ], ); } @@ -3974,8 +3974,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 163, 83, 211, 88, 187, 57, 197, 189, 189, 39, 40, 150, 102, 186, 188, 111, 200, 230, - 134, 21, 72, 136, 135, 92, 102, 206, 72, 43, 127, 87, 26, 82, + 53, 9, 163, 92, 116, 134, 17, 186, 21, 68, 156, 162, 47, 181, 214, 162, 253, 4, 246, 8, + 41, 187, 151, 152, 216, 164, 206, 110, 230, 176, 124, 225, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -4426,8 +4426,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 138, 110, 99, 80, 216, 232, 45, 246, 159, 207, 139, 253, 210, 64, 32, 114, 102, 107, - 21, 120, 163, 19, 189, 99, 109, 95, 56, 217, 134, 206, 160, 215, + 75, 38, 164, 96, 117, 46, 13, 23, 183, 41, 83, 163, 112, 55, 172, 37, 186, 36, 223, 39, + 106, 201, 46, 222, 167, 79, 236, 122, 12, 210, 29, 123, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -4549,8 +4549,8 @@ mod tests { // Make sure the state is deterministic let expected_app_hash = vec![ - 163, 83, 211, 88, 187, 57, 197, 189, 189, 39, 40, 150, 102, 186, 188, 111, 200, 230, - 134, 21, 72, 136, 135, 92, 102, 206, 72, 43, 127, 87, 26, 82, + 53, 9, 163, 92, 116, 134, 17, 186, 21, 68, 156, 162, 47, 181, 214, 162, 253, 4, 246, 8, + 41, 187, 151, 152, 216, 164, 206, 110, 230, 176, 124, 225, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -5347,8 +5347,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 252, 254, 89, 190, 119, 227, 29, 62, 78, 216, 77, 35, 178, 115, 23, 145, 237, 234, 159, - 60, 9, 83, 51, 174, 88, 255, 12, 116, 106, 202, 232, 29, + 235, 23, 161, 209, 153, 68, 160, 57, 151, 170, 19, 99, 64, 48, 5, 114, 233, 154, 77, + 65, 104, 102, 128, 181, 159, 124, 54, 108, 229, 88, 185, 134, ]; assert_eq!(root_hash.as_slice(), expected_app_hash,); @@ -5443,8 +5443,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 252, 254, 89, 190, 119, 227, 29, 62, 78, 216, 77, 35, 178, 115, 23, 145, 237, 234, 159, - 60, 9, 83, 51, 174, 88, 255, 12, 116, 106, 202, 232, 29, + 235, 23, 161, 209, 153, 68, 160, 57, 151, 170, 19, 99, 64, 48, 5, 114, 233, 154, 77, + 65, 104, 102, 128, 181, 159, 124, 54, 108, 229, 88, 185, 134, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -5539,8 +5539,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 252, 254, 89, 190, 119, 227, 29, 62, 78, 216, 77, 35, 178, 115, 23, 145, 237, 234, 159, - 60, 9, 83, 51, 174, 88, 255, 12, 116, 106, 202, 232, 29, + 235, 23, 161, 209, 153, 68, 160, 57, 151, 170, 19, 99, 64, 48, 5, 114, 233, 154, 77, + 65, 104, 102, 128, 181, 159, 124, 54, 108, 229, 88, 185, 134, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -5635,8 +5635,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 252, 254, 89, 190, 119, 227, 29, 62, 78, 216, 77, 35, 178, 115, 23, 145, 237, 234, 159, - 60, 9, 83, 51, 174, 88, 255, 12, 116, 106, 202, 232, 29, + 235, 23, 161, 209, 153, 68, 160, 57, 151, 170, 19, 99, 64, 48, 5, 114, 233, 154, 77, + 65, 104, 102, 128, 181, 159, 124, 54, 108, 229, 88, 185, 134, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -5831,8 +5831,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 89, 74, 31, 85, 116, 81, 139, 178, 90, 11, 123, 172, 93, 187, 25, 125, 35, 201, 210, - 64, 40, 43, 40, 68, 230, 228, 168, 46, 63, 219, 98, 240, + 233, 90, 110, 8, 43, 137, 139, 242, 8, 152, 175, 246, 177, 73, 49, 137, 61, 142, 2, 49, + 158, 134, 13, 222, 60, 223, 139, 41, 66, 131, 135, 38, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -6038,8 +6038,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 89, 74, 31, 85, 116, 81, 139, 178, 90, 11, 123, 172, 93, 187, 25, 125, 35, 201, 210, - 64, 40, 43, 40, 68, 230, 228, 168, 46, 63, 219, 98, 240, + 233, 90, 110, 8, 43, 137, 139, 242, 8, 152, 175, 246, 177, 73, 49, 137, 61, 142, 2, 49, + 158, 134, 13, 222, 60, 223, 139, 41, 66, 131, 135, 38, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -6248,8 +6248,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 89, 74, 31, 85, 116, 81, 139, 178, 90, 11, 123, 172, 93, 187, 25, 125, 35, 201, 210, - 64, 40, 43, 40, 68, 230, 228, 168, 46, 63, 219, 98, 240, + 233, 90, 110, 8, 43, 137, 139, 242, 8, 152, 175, 246, 177, 73, 49, 137, 61, 142, 2, 49, + 158, 134, 13, 222, 60, 223, 139, 41, 66, 131, 135, 38, ]; assert_eq!(root_hash.as_slice(), expected_app_hash,); @@ -6462,8 +6462,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 244, 130, 169, 10, 90, 218, 48, 147, 73, 95, 89, 174, 234, 151, 228, 21, 155, 188, 165, - 185, 121, 77, 221, 236, 82, 228, 82, 133, 102, 214, 251, 40, + 112, 166, 177, 100, 209, 55, 7, 42, 111, 43, 77, 15, 40, 149, 26, 219, 121, 244, 83, 5, + 102, 253, 66, 122, 99, 217, 33, 173, 135, 17, 174, 115, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -6542,8 +6542,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 244, 130, 169, 10, 90, 218, 48, 147, 73, 95, 89, 174, 234, 151, 228, 21, 155, 188, 165, - 185, 121, 77, 221, 236, 82, 228, 82, 133, 102, 214, 251, 40, + 112, 166, 177, 100, 209, 55, 7, 42, 111, 43, 77, 15, 40, 149, 26, 219, 121, 244, 83, 5, + 102, 253, 66, 122, 99, 217, 33, 173, 135, 17, 174, 115, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); @@ -6643,8 +6643,8 @@ mod tests { .expect("there is always a root hash"); let expected_app_hash = vec![ - 244, 130, 169, 10, 90, 218, 48, 147, 73, 95, 89, 174, 234, 151, 228, 21, 155, 188, 165, - 185, 121, 77, 221, 236, 82, 228, 82, 133, 102, 214, 251, 40, + 112, 166, 177, 100, 209, 55, 7, 42, 111, 43, 77, 15, 40, 149, 26, 219, 121, 244, 83, 5, + 102, 253, 66, 122, 99, 217, 33, 173, 135, 17, 174, 115, ]; assert_eq!(root_hash.as_slice(), expected_app_hash); diff --git a/packages/rs-drive/tests/query_tests_history.rs b/packages/rs-drive/tests/query_tests_history.rs index cb72796f888..3229c6fbbcd 100644 --- a/packages/rs-drive/tests/query_tests_history.rs +++ b/packages/rs-drive/tests/query_tests_history.rs @@ -1666,8 +1666,8 @@ fn test_query_historical_latest_platform_version() { assert_eq!( root_hash.as_slice(), vec![ - 198, 240, 42, 199, 134, 177, 186, 144, 191, 122, 14, 217, 209, 140, 131, 144, 63, 232, - 141, 193, 177, 136, 200, 150, 42, 110, 151, 216, 85, 161, 78, 44 + 161, 240, 182, 38, 13, 26, 246, 165, 76, 67, 252, 39, 203, 128, 225, 233, 70, 76, 30, + 228, 64, 40, 59, 240, 240, 135, 215, 135, 146, 2, 128, 65 ] ); @@ -3032,8 +3032,8 @@ fn test_query_historical_latest_platform_version() { assert_eq!( root_hash.as_slice(), vec![ - 244, 221, 68, 246, 214, 152, 18, 222, 186, 119, 187, 173, 119, 184, 146, 5, 27, 145, - 125, 63, 233, 17, 138, 99, 99, 177, 83, 145, 4, 8, 124, 155 + 82, 200, 76, 76, 113, 4, 94, 39, 105, 206, 63, 185, 209, 222, 13, 161, 194, 209, 156, + 251, 133, 192, 38, 65, 93, 196, 214, 198, 52, 196, 37, 208 ] ); } diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json new file mode 100644 index 00000000000..9adca368205 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json deleted file mode 100644 index d8f00611846..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index 78b6e2613b4..d7eb96c1aa9 100644 Binary files a/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_list_document_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/document_list_document_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_2fd2f7aebe5686d4e4179323b49e8920dea81c3f44b9549c238dcb82cccc9923.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_2fd2f7aebe5686d4e4179323b49e8920dea81c3f44b9549c238dcb82cccc9923.json new file mode 100644 index 00000000000..6ee022e9e57 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_2fd2f7aebe5686d4e4179323b49e8920dea81c3f44b9549c238dcb82cccc9923.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_c4bb9b2e03829c0926d347692bc4eacbb5ffa75f6cb27d3ee8a17b185852f102.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_c4bb9b2e03829c0926d347692bc4eacbb5ffa75f6cb27d3ee8a17b185852f102.json deleted file mode 100644 index 4890cb0a839..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_DocumentQuery_c4bb9b2e03829c0926d347692bc4eacbb5ffa75f6cb27d3ee8a17b185852f102.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index 6f97641bedf..038ae04f81d 100644 Binary files a/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_list_drive_query/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/document_list_drive_query/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json new file mode 100644 index 00000000000..bd892165174 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_2a42b0afe6c6f58b02d8152142acec7d11a37410433366315d1103f81859344b.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_4816e45a0ba02d69c291f23322410a8556ecf1145e99c87071cc8998a97d7ccb.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_4816e45a0ba02d69c291f23322410a8556ecf1145e99c87071cc8998a97d7ccb.json new file mode 100644 index 00000000000..b8c9c8b7c11 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_4816e45a0ba02d69c291f23322410a8556ecf1145e99c87071cc8998a97d7ccb.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json deleted file mode 100644 index 9b0218f7492..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9064a0dc37a9f6f767159a4325ba9664c6f3704dadf217d5b236f608cb4dc8a1.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9267cfc8e7a6f302a2a7d179bc9337e03233ad6fd5c394dd4e6033f39e9447e8.json b/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9267cfc8e7a6f302a2a7d179bc9337e03233ad6fd5c394dd4e6033f39e9447e8.json deleted file mode 100644 index f83ccb50780..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_DocumentQuery_9267cfc8e7a6f302a2a7d179bc9337e03233ad6fd5c394dd4e6033f39e9447e8.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index d66f6373976..603afa7eb28 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json index 1a711e0ad72..e6ba55bd212 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json and b/packages/rs-sdk/tests/vectors/document_read_no_contract/msg_GetDataContractRequest_e4cf74168e03a40bd159451456b501c1ba166a2dd8f6efb31b0289dc011da983.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read_no_contract/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_96c4914304501c97094650f1da1086bcaf743e2fa8f6b8b143deb29b5265e971.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_96c4914304501c97094650f1da1086bcaf743e2fa8f6b8b143deb29b5265e971.json deleted file mode 100644 index af500c51b1e..00000000000 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_96c4914304501c97094650f1da1086bcaf743e2fa8f6b8b143deb29b5265e971.json and /dev/null differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_f531f69255dae40cef880290c177ff33d2448d30f2527374349b9f507b44c5c1.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_f531f69255dae40cef880290c177ff33d2448d30f2527374349b9f507b44c5c1.json new file mode 100644 index 00000000000..aa4d00e5ac0 Binary files /dev/null and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_DocumentQuery_f531f69255dae40cef880290c177ff33d2448d30f2527374349b9f507b44c5c1.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index d66f6373976..1382d46be43 100644 Binary files a/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/document_read_no_document/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/document_read_no_document/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json index 4ca3e6ba660..6487de69be4 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json and b/packages/rs-sdk/tests/vectors/test_data_contract_read/msg_GetDataContractRequest_e87a2e6acef76975c30eb7272da71733fb6ad13495beb7ca1b6a6c4ceb30e0f7.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contract_read/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json index c48d9bd3101..bd8f1bdd637 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json and b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/msg_GetDataContractRequest_1d1e53ab5e04d9ec5dce4ff9ac048c03122daf7ab2e77108f4bf44af1ad15eae.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contract_read_not_found/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json index a5c6db96089..c1129991c45 100644 Binary files a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json and b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/msg_GetDataContractsRequest_f229a0e58a5c4fb050f57c087bf067bd9ccc29eca3092a5664a5a9ba3bb7e967.json differ diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json new file mode 100644 index 00000000000..e18b2a7deac --- /dev/null +++ b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-3603d12872604475619be7ad682f8339ad60debd43b3f430bd12d51eac268936.json @@ -0,0 +1 @@ +b751df5b612ece651a4d290fa95fab328d5b186b84fc88b103bb45cdf6d3815620b74daa0d72067d74ea86da595c6a59 \ No newline at end of file diff --git a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json b/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json deleted file mode 100644 index 5992d970292..00000000000 --- a/packages/rs-sdk/tests/vectors/test_data_contracts_1_ok_1_nx/quorum_pubkey-106-6b957c585f866e7d826afcd92d1a891ce226199229e3031f71994d14dd32f088.json +++ /dev/null @@ -1 +0,0 @@ -b4d9b2ac8940208c9b5a4182518b6792b89c7e08caa3f6b83a1f81526346d2be47f9c1d9c2b26a9d73103c8c2e525dd0 \ No newline at end of file diff --git a/packages/search-contract/schema/v1/search-contract-documents.json b/packages/search-contract/schema/v1/search-contract-documents.json index 2f7be903882..444c1297f69 100644 --- a/packages/search-contract/schema/v1/search-contract-documents.json +++ b/packages/search-contract/schema/v1/search-contract-documents.json @@ -1,9 +1,8 @@ { - "contract": { + "contractKeywords": { "type": "object", "documentsMutable": false, "canBeDeleted": false, - "referenceType": "contract", "creationRestrictionMode": 2, "indices": [ { @@ -36,5 +35,83 @@ "keyword" ], "additionalProperties": false + }, + "shortDescription": { + "type": "object", + "documentsMutable": false, + "canBeDeleted": false, + "creationRestrictionMode": 2, + "indices": [ + { + "name": "byContractId", + "properties": [ + { + "contractId": "asc" + } + ], + "unique": true + } + ], + "properties": { + "contractId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "contentMediaType": "application/x.dash.dpp.identifier" + }, + "description": { + "type": "string", + "minLength": 3, + "maxLength": 100, + "position": 1 + } + }, + "required": [ + "contractId", + "description" + ], + "description": "Short description of the contract. This document type is immutable and creation is not allowed. Creation occurs automatically internally on DataContractCreate and mirrors the contract's description field.", + "additionalProperties": false + }, + "fullDescription": { + "type": "object", + "documentsMutable": true, + "canBeDeleted": false, + "creationRestrictionMode": 2, + "indices": [ + { + "name": "byContractId", + "properties": [ + { + "contractId": "asc" + } + ], + "unique": true + } + ], + "properties": { + "contractId": { + "type": "array", + "byteArray": true, + "minItems": 32, + "maxItems": 32, + "position": 0, + "contentMediaType": "application/x.dash.dpp.identifier" + }, + "description": { + "type": "string", + "minLength": 3, + "maxLength": 10000, + "position": 1 + } + }, + "required": [ + "contractId", + "description" + ], + "description": "Full description of the contract. This document type is mutable by contract owner but creation is not allowed. Creation occurs automatically internally on DataContractCreate and mirrors the contract's description field initially.", + "additionalProperties": false } } \ No newline at end of file diff --git a/packages/search-contract/src/v1/mod.rs b/packages/search-contract/src/v1/mod.rs index c237ea3343d..200a4523c97 100644 --- a/packages/search-contract/src/v1/mod.rs +++ b/packages/search-contract/src/v1/mod.rs @@ -2,13 +2,29 @@ use crate::Error; use serde_json::Value; pub mod document_types { - pub mod contract { - pub const NAME: &str = "contract"; + pub mod contract_keywords { + pub const NAME: &str = "contractKeywords"; pub mod properties { pub const KEY_INDEX: &str = "byKeyword"; } } + + pub mod short_description { + pub const NAME: &str = "shortDescription"; + + pub mod properties { + pub const KEY_INDEX: &str = "byContractId"; + } + } + + pub mod full_description { + pub const NAME: &str = "fullDescription"; + + pub mod properties { + pub const KEY_INDEX: &str = "byContractId"; + } + } } pub fn load_documents_schemas() -> Result { diff --git a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs index 244b233fc66..f609620bd63 100644 --- a/packages/wasm-dpp/src/errors/consensus/consensus_error.rs +++ b/packages/wasm-dpp/src/errors/consensus/consensus_error.rs @@ -61,7 +61,7 @@ use dpp::consensus::state::data_trigger::DataTriggerError::{ DataTriggerConditionError, DataTriggerExecutionError, DataTriggerInvalidResultError, }; use wasm_bindgen::{JsError, JsValue}; -use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupTotalPowerLessThanRequiredError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordEncodingError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError}; +use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupTotalPowerLessThanRequiredError, InvalidDescriptionLengthError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordEncodingError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError}; use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedError, DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError}; use dpp::consensus::basic::group::GroupActionNotAllowedOnTransitionError; use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError}; @@ -773,6 +773,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue { BasicError::InvalidKeywordEncodingError(e) => { generic_consensus_error!(InvalidKeywordEncodingError, e).into() } + BasicError::InvalidDescriptionLengthError(e) => { + generic_consensus_error!(InvalidDescriptionLengthError, e).into() + } } }