Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/rs-dpp/src/data_contract/data_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<u8>, ProtocolError> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, JsonValue>,
) {
Expand All @@ -69,8 +69,8 @@ fn visit_array<'a>(
}
}

fn visit_map<'a>(
map: &'a Map<String, JsonValue>,
fn visit_map(
map: &Map<String, JsonValue>,
property_path: Option<&String>,
binary_paths: &mut BTreeMap<String, JsonValue>,
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/rs-dpp/src/data_trigger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ where
}
}

fn create_error<'a, SR>(
context: &DataTriggerExecutionContext<'a, SR>,
fn create_error<SR>(
context: &DataTriggerExecutionContext<SR>,
dt_create: &DocumentCreateTransition,
msg: String,
) -> DataTriggerError
Expand Down
8 changes: 4 additions & 4 deletions packages/rs-dpp/src/document/document_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]>,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
[
Expand Down Expand Up @@ -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,
[
Expand Down
4 changes: 2 additions & 2 deletions packages/rs-dpp/src/tests/identity/identity_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/rs-drive-abci/src/state/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DriveOperationType<'a>>,
operations: &mut Vec<DriveOperationType<'a>>,
) -> Result<(), Error> {
let domain = "dash";

Expand Down
8 changes: 4 additions & 4 deletions packages/rs-drive-abci/tests/strategy_tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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,
Expand All @@ -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,
Expand Down
36 changes: 12 additions & 24 deletions packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,19 @@ 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,
block_count: 400,
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),
);
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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),
);
{
Expand Down
30 changes: 14 additions & 16 deletions packages/rs-drive/src/drive/grove_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const N: usize>(
&self,
path_key_info: PathKeyInfo<N>,
storage_flags: Option<&StorageFlags>,
apply_type: BatchInsertTreeApplyType,
transaction: TransactionArg,
Expand Down Expand Up @@ -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<N>,
storage_flags: Option<&StorageFlags>,
apply_type: BatchInsertTreeApplyType,
transaction: TransactionArg,
Expand Down Expand Up @@ -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<const N: usize>(
&self,
path_key_element_info: PathKeyElementInfo<N>,
apply_type: BatchInsertApplyType,
transaction: TransactionArg,
drive_operations: &mut Vec<DriveOperation>,
Expand Down Expand Up @@ -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<const N: usize>(
&self,
path_key_element_info: PathKeyElementInfo<N>,
apply_type: BatchInsertApplyType,
transaction: TransactionArg,
drive_operations: &mut Vec<DriveOperation>,
Expand Down Expand Up @@ -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<u16>,
apply_type: BatchDeleteUpTreeApplyType,
transaction: TransactionArg,
Expand Down
Loading