diff --git a/packages/rs-dpp/src/data_contract/data_contract.rs b/packages/rs-dpp/src/data_contract/data_contract.rs index 8a5b69418ba..8278573f6d2 100644 --- a/packages/rs-dpp/src/data_contract/data_contract.rs +++ b/packages/rs-dpp/src/data_contract/data_contract.rs @@ -646,7 +646,6 @@ mod test { fn conversion_to_buffer_from_buffer_too_high_version() { init(); let data_contract = get_data_contract_fixture(None); - data_contract.protocol_version; let data_contract_bytes = data_contract .to_buffer() diff --git a/packages/rs-dpp/src/data_contract/document_type/document_type.rs b/packages/rs-dpp/src/data_contract/document_type/document_type.rs index c96596ee39d..8655a37ad07 100644 --- a/packages/rs-dpp/src/data_contract/document_type/document_type.rs +++ b/packages/rs-dpp/src/data_contract/document_type/document_type.rs @@ -138,8 +138,8 @@ impl DocumentType { bytes } - pub fn serialize_value_for_key<'a>( - &'a self, + pub fn serialize_value_for_key( + &self, key: &str, value: &Value, ) -> Result, ProtocolError> { diff --git a/packages/rs-dpp/src/data_contract/get_binary_properties_from_schema.rs b/packages/rs-dpp/src/data_contract/get_binary_properties_from_schema.rs index f2812f22584..15fd5f0a76c 100644 --- a/packages/rs-dpp/src/data_contract/get_binary_properties_from_schema.rs +++ b/packages/rs-dpp/src/data_contract/get_binary_properties_from_schema.rs @@ -54,8 +54,8 @@ fn build_binary_properties_map( } } -fn visit_array<'a>( - array: &'a [JsonValue], +fn visit_array( + array: &[JsonValue], property_path: Option<&String>, binary_paths: &mut BTreeMap, ) { @@ -69,8 +69,8 @@ fn visit_array<'a>( } } -fn visit_map<'a>( - map: &'a Map, +fn visit_map( + map: &Map, property_path: Option<&String>, binary_paths: &mut BTreeMap, ) { diff --git a/packages/rs-dpp/src/data_trigger/mod.rs b/packages/rs-dpp/src/data_trigger/mod.rs index 64b55db6996..51879cd3623 100644 --- a/packages/rs-dpp/src/data_trigger/mod.rs +++ b/packages/rs-dpp/src/data_trigger/mod.rs @@ -135,8 +135,8 @@ where } } -fn create_error<'a, SR>( - context: &DataTriggerExecutionContext<'a, SR>, +fn create_error( + context: &DataTriggerExecutionContext, dt_create: &DocumentCreateTransition, msg: String, ) -> DataTriggerError diff --git a/packages/rs-dpp/src/document/document_stub.rs b/packages/rs-dpp/src/document/document_stub.rs index a1150343c69..41cf8250983 100644 --- a/packages/rs-dpp/src/document/document_stub.rs +++ b/packages/rs-dpp/src/document/document_stub.rs @@ -340,8 +340,8 @@ impl DocumentStub { } /// Return a value given the path to its key for a document type. - pub fn get_raw_for_document_type<'a>( - &'a self, + pub fn get_raw_for_document_type( + &self, key_path: &str, document_type: &DocumentType, owner_id: Option<[u8; 32]>, @@ -407,8 +407,8 @@ impl DocumentStub { } /// Return a value given the path to its key and the document type for a contract. - pub fn get_raw_for_contract<'a>( - &'a self, + pub fn get_raw_for_contract( + &self, key: &str, document_type_name: &str, contract: &DataContract, diff --git a/packages/rs-dpp/src/tests/identity/identity_public_key_spec.rs b/packages/rs-dpp/src/tests/identity/identity_public_key_spec.rs index 93f1e829bce..a6c4a4fd651 100644 --- a/packages/rs-dpp/src/tests/identity/identity_public_key_spec.rs +++ b/packages/rs-dpp/src/tests/identity/identity_public_key_spec.rs @@ -23,7 +23,7 @@ mod from_raw_object { assert_eq!(public_key.key_type, KeyType::ECDSA_SECP256K1); assert_eq!(public_key.purpose, Purpose::AUTHENTICATION); assert_eq!(public_key.security_level, SecurityLevel::MASTER); - assert_eq!(public_key.read_only, false); + assert!(!public_key.read_only); assert_eq!( public_key.data, [ @@ -94,7 +94,7 @@ mod from_raw_object { assert_eq!(public_key.key_type, KeyType::ECDSA_SECP256K1); assert_eq!(public_key.purpose, Purpose::AUTHENTICATION); assert_eq!(public_key.security_level, SecurityLevel::MASTER); - assert_eq!(public_key.read_only, false); + assert!(!public_key.read_only); assert_eq!( public_key.data, [ diff --git a/packages/rs-dpp/src/tests/identity/identity_spec.rs b/packages/rs-dpp/src/tests/identity/identity_spec.rs index 5796d59011b..a527df4e828 100644 --- a/packages/rs-dpp/src/tests/identity/identity_spec.rs +++ b/packages/rs-dpp/src/tests/identity/identity_spec.rs @@ -108,7 +108,7 @@ mod from_buffer { 155, 24, 189, 162, 3, 243, 11, 210, 211, 238, 215, 105, 163, 71, 98 ] ); - assert_eq!(pk_1.read_only, false); + assert!(!pk_1.read_only); assert_eq!(pk_2.id, 1); assert_eq!(pk_2.key_type, KeyType::try_from(0u8).unwrap()); @@ -121,7 +121,7 @@ mod from_buffer { 207, 105, 202, 13, 209, 136, 190, 227, 182, 209, 12, 13, 79, 139 ] ); - assert_eq!(pk_2.read_only, false); + assert!(!pk_2.read_only); } } diff --git a/packages/rs-drive-abci/src/state/genesis.rs b/packages/rs-drive-abci/src/state/genesis.rs index 46a47fd4dc9..1a9a4640481 100644 --- a/packages/rs-drive-abci/src/state/genesis.rs +++ b/packages/rs-drive-abci/src/state/genesis.rs @@ -191,10 +191,10 @@ impl Platform { )) } - fn register_dpns_top_level_domain_operations<'a, 'b>( + fn register_dpns_top_level_domain_operations<'a>( &self, contract: &'a DataContract, - operations: &'b mut Vec>, + operations: &mut Vec>, ) -> Result<(), Error> { let domain = "dash"; diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 4744b9bba30..1307aab75f1 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -406,7 +406,7 @@ pub(crate) fn run_chain_for_strategy( seed: u64, ) -> ChainExecutionOutcome { let quorum_size = config.quorum_size; - let mut platform = setup_platform_raw(Some(config.clone())); + let platform = setup_platform_raw(Some(config.clone())); let mut rng = StdRng::seed_from_u64(seed); // init chain let init_chain_request = static_init_chain_request(); @@ -424,7 +424,7 @@ pub(crate) fn run_chain_for_strategy( None, ); - let mut current_proposers: Vec<[u8; 32]> = proposers + let current_proposers: Vec<[u8; 32]> = proposers .choose_multiple(&mut rng, quorum_size as usize) .cloned() .collect(); @@ -447,7 +447,7 @@ pub(crate) fn run_chain_for_strategy( } pub(crate) fn continue_chain_for_strategy( - mut platform: Platform, + platform: Platform, chain_execution_parameters: ChainExecutionParameters, strategy: Strategy, config: PlatformConfig, @@ -457,7 +457,7 @@ pub(crate) fn continue_chain_for_strategy( block_start, block_count, block_spacing_ms, - mut proposers, + proposers, mut current_proposers, current_proposer_versions, mut current_time_ms, diff --git a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs index 6026bc68ed3..2e665e97b75 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs @@ -151,13 +151,7 @@ mod tests { .unwrap() .height + 1; - let ChainExecutionOutcome { - platform, - proposers, - current_proposers, - end_time_ms, - .. - } = continue_chain_for_strategy( + let ChainExecutionOutcome { platform, .. } = continue_chain_for_strategy( platform, ChainExecutionParameters { block_start, @@ -165,11 +159,11 @@ mod tests { block_spacing_ms: hour_in_ms, proposers, current_proposers, - current_proposer_versions: Some(current_proposer_versions.clone()), + current_proposer_versions: Some(current_proposer_versions), current_time_ms: end_time_ms, }, - strategy.clone(), - config.clone(), + strategy, + config, StrategyRandomness::SeedEntropy(18), ); { @@ -339,7 +333,7 @@ mod tests { block_spacing_ms: hour_in_ms, proposers, current_proposers, - current_proposer_versions: Some(current_proposer_versions.clone()), + current_proposer_versions: Some(current_proposer_versions), current_time_ms: end_time_ms, }, strategy, @@ -456,10 +450,10 @@ mod tests { block_spacing_ms: hour_in_ms, proposers, current_proposers, - current_proposer_versions: Some(current_proposer_versions.clone()), + current_proposer_versions: Some(current_proposer_versions), current_time_ms: end_time_ms, }, - strategy.clone(), + strategy, config.clone(), StrategyRandomness::SeedEntropy(99), ); @@ -585,7 +579,7 @@ mod tests { block_spacing_ms: hour_in_ms * 4, //let's try to move to next epoch proposers, current_proposers, - current_proposer_versions: Some(current_proposer_versions.clone()), + current_proposer_versions: Some(current_proposer_versions), current_time_ms: end_time_ms, }, strategy, @@ -651,7 +645,7 @@ mod tests { current_proposer_versions, end_time_ms, .. - } = run_chain_for_strategy(1400, hour_in_ms, strategy.clone(), config.clone(), 15); + } = run_chain_for_strategy(1400, hour_in_ms, strategy, config.clone(), 15); { let drive_cache = platform.drive.cache.borrow_mut(); let counter = drive_cache @@ -710,13 +704,7 @@ mod tests { .unwrap() .height + 1; - let ChainExecutionOutcome { - platform, - proposers, - current_proposers, - end_time_ms, - .. - } = continue_chain_for_strategy( + let ChainExecutionOutcome { platform, .. } = continue_chain_for_strategy( platform, ChainExecutionParameters { block_start, @@ -727,8 +715,8 @@ mod tests { current_proposer_versions: None, current_time_ms: end_time_ms, }, - strategy.clone(), - config.clone(), + strategy, + config, StrategyRandomness::SeedEntropy(7), ); { diff --git a/packages/rs-drive/src/drive/grove_operations.rs b/packages/rs-drive/src/drive/grove_operations.rs index 69f1ccdcc7d..f4abf06885d 100644 --- a/packages/rs-drive/src/drive/grove_operations.rs +++ b/packages/rs-drive/src/drive/grove_operations.rs @@ -791,9 +791,9 @@ impl Drive { /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. /// Will also check the current drive operations - pub(crate) fn batch_insert_empty_tree_if_not_exists<'a, 'c, const N: usize>( - &'a self, - path_key_info: PathKeyInfo<'c, N>, + pub(crate) fn batch_insert_empty_tree_if_not_exists( + &self, + path_key_info: PathKeyInfo, storage_flags: Option<&StorageFlags>, apply_type: BatchInsertTreeApplyType, transaction: TransactionArg, @@ -1063,12 +1063,10 @@ impl Drive { /// Pushes an "insert empty tree where path key does not yet exist" operation to `drive_operations`. /// Will also check the current drive operations pub(crate) fn batch_insert_empty_tree_if_not_exists_check_existing_operations< - 'a, - 'c, const N: usize, >( - &'a self, - path_key_info: PathKeyInfo<'c, N>, + &self, + path_key_info: PathKeyInfo, storage_flags: Option<&StorageFlags>, apply_type: BatchInsertTreeApplyType, transaction: TransactionArg, @@ -1223,9 +1221,9 @@ impl Drive { /// Pushes an "insert element if the path key does not yet exist" operation to `drive_operations`. /// Returns true if the path key already exists without references. - pub(crate) fn batch_insert_if_not_exists<'a, 'c, const N: usize>( - &'a self, - path_key_element_info: PathKeyElementInfo<'c, N>, + pub(crate) fn batch_insert_if_not_exists( + &self, + path_key_element_info: PathKeyElementInfo, apply_type: BatchInsertApplyType, transaction: TransactionArg, drive_operations: &mut Vec, @@ -1321,9 +1319,9 @@ impl Drive { /// Pushes an "insert element if element was changed or is new" operation to `drive_operations`. /// Returns true if the path key already exists without references. - pub(crate) fn batch_insert_if_changed_value<'a, 'c, const N: usize>( - &'a self, - path_key_element_info: PathKeyElementInfo<'c, N>, + pub(crate) fn batch_insert_if_changed_value( + &self, + path_key_element_info: PathKeyElementInfo, apply_type: BatchInsertApplyType, transaction: TransactionArg, drive_operations: &mut Vec, @@ -1486,10 +1484,10 @@ impl Drive { } /// Pushes a "delete up tree while empty" operation to `drive_operations`. - pub(crate) fn batch_delete_up_tree_while_empty<'a, 'c>( - &'a self, + pub(crate) fn batch_delete_up_tree_while_empty( + &self, path: KeyInfoPath, - key: &'c [u8], + key: &[u8], stop_path_height: Option, apply_type: BatchDeleteUpTreeApplyType, transaction: TransactionArg, diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index 727fa5dbe07..9bb97a886f2 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -547,47 +547,43 @@ pub fn setup_dpns_test_with_data(path: &str) -> (Drive, Contract) { let file = File::open(path).expect("should read domains from file"); - for line in io::BufReader::new(file).lines() { - if let Ok(domain_json) = line { - let domain_json: serde_json::Value = - serde_json::from_str(&domain_json).expect("should parse json"); - - let domain_cbor = serializer::value_to_cbor( - domain_json, - Some(drive::drive::defaults::PROTOCOL_VERSION), - ) - .expect("expected to serialize to cbor"); + for domain_json in io::BufReader::new(file).lines().flatten() { + let domain_json: serde_json::Value = + serde_json::from_str(&domain_json).expect("should parse json"); + + let domain_cbor = + serializer::value_to_cbor(domain_json, Some(drive::drive::defaults::PROTOCOL_VERSION)) + .expect("expected to serialize to cbor"); + + let domain = DocumentStub::from_cbor(&domain_cbor, None, None) + .expect("expected to deserialize the document"); + + let document_type = contract + .document_type_for_name("domain") + .expect("expected to get document type"); + + let storage_flags = Some(Cow::Owned(StorageFlags::SingleEpoch(0))); - let domain = DocumentStub::from_cbor(&domain_cbor, None, None) - .expect("expected to deserialize the document"); - - let document_type = contract - .document_type_for_name("domain") - .expect("expected to get document type"); - - let storage_flags = Some(Cow::Owned(StorageFlags::SingleEpoch(0))); - - drive - .add_document_for_contract( - DocumentAndContractInfo { - owned_document_info: OwnedDocumentInfo { - document_info: DocumentRefAndSerialization(( - &domain, - &domain_cbor, - storage_flags, - )), - owner_id: None, - }, - contract: &contract, - document_type, + drive + .add_document_for_contract( + DocumentAndContractInfo { + owned_document_info: OwnedDocumentInfo { + document_info: DocumentRefAndSerialization(( + &domain, + &domain_cbor, + storage_flags, + )), + owner_id: None, }, - false, - BlockInfo::genesis(), - true, - Some(&db_transaction), - ) - .expect("expected to insert a document successfully"); - } + contract: &contract, + document_type, + }, + false, + BlockInfo::genesis(), + true, + Some(&db_transaction), + ) + .expect("expected to insert a document successfully"); } drive .grove