Skip to content

Commit 3af1aaf

Browse files
chore(drive): fix drive linting (#2763)
1 parent 872383b commit 3af1aaf

File tree

174 files changed

+535
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+535
-352
lines changed

packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::platform_types::platform::Platform;
55
use crate::rpc::core::CoreRPCLike;
66

77
use dpp::block::block_info::BlockInfo;
8-
use drive::error::Error::GroveDB;
8+
use drive::error;
99
use drive::grovedb::Transaction;
1010

1111
use crate::execution::engine::consensus_params_update::consensus_params_update;
@@ -131,7 +131,7 @@ where
131131
.grove
132132
.root_hash(Some(transaction), &platform_version.drive.grove_version)
133133
.unwrap()
134-
.map_err(GroveDB)?;
134+
.map_err(error::Error::from)?;
135135

136136
// We use first platform version because Tenderdash starts genesis with first versions
137137
// by default

packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use dpp::block::epoch::Epoch;
22

33
use dpp::validation::ValidationResult;
4-
use drive::error::Error::GroveDB;
54

65
use dpp::version::PlatformVersion;
76
use drive::grovedb::Transaction;
@@ -383,7 +382,7 @@ where
383382
.grove
384383
.root_hash(Some(transaction), &platform_version.drive.grove_version)
385384
.unwrap()
386-
.map_err(|e| Error::Drive(GroveDB(e)))?; //GroveDb errors are system errors
385+
.map_err(|e| Error::Drive(drive::error::Error::from(e)))?; //GroveDb errors are system errors
387386

388387
block_execution_context
389388
.block_state_info_mut()

packages/rs-drive-abci/src/execution/platform_events/fee_pool_inwards_distribution/add_distribute_block_fees_into_pools_operations/v0/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ impl<C> Platform<C> {
3737
)
3838
.or_else(|e| match e {
3939
// Handle epoch change when storage fees are not set yet
40-
error::Error::GroveDB(grovedb::Error::PathKeyNotFound(_)) => Ok(0u64),
40+
error::Error::GroveDB(inner)
41+
if matches!(inner.as_ref(), grovedb::Error::PathKeyNotFound(_)) =>
42+
{
43+
Ok(0u64)
44+
}
4145
_ => Err(e),
4246
})?;
4347

packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v0/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,7 @@ mod tests {
270270

271271
assert!(matches!(
272272
result,
273-
Err(DriveError::GroveDB(
274-
grovedb::Error::PathParentLayerNotFound(_)
275-
))
273+
Err(DriveError::GroveDB(e)) if matches!(e.as_ref(), grovedb::Error::PathParentLayerNotFound(_))
276274
));
277275
}
278276
}

packages/rs-drive-abci/src/execution/platform_events/fee_pool_outwards_distribution/add_distribute_fees_from_oldest_unpaid_epoch_pool_to_proposers_operations/v1/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ mod tests {
300300

301301
assert!(matches!(
302302
result,
303-
Err(DriveError::GroveDB(
304-
grovedb::Error::PathParentLayerNotFound(_)
305-
))
303+
Err(DriveError::GroveDB(e)) if matches!(e.as_ref(), grovedb::Error::PathParentLayerNotFound(_))
306304
));
307305
}
308306
}

packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl<C> Platform<C> {
287287
.map(|element| {
288288
let contested_document_resource_vote_poll_bytes = element
289289
.into_item_bytes()
290-
.map_err(drive::error::Error::GroveDB)?;
290+
.map_err(drive::error::Error::from)?;
291291
let vote_poll =
292292
VotePoll::deserialize_from_bytes(&contested_document_resource_vote_poll_bytes)?;
293293
match vote_poll {

packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9785,9 +9785,8 @@ mod tests {
97859785

97869786
assert_matches!(
97879787
query_validation_result,
9788-
Err(Error::Drive(drive::error::Error::GroveDB(
9789-
drive::grovedb::Error::CorruptedReferencePathKeyNotFound(_)
9790-
)))
9788+
Err(Error::Drive(drive::error::Error::GroveDB(e)))
9789+
if matches!(e.as_ref(), drive::grovedb::Error::CorruptedReferencePathKeyNotFound(_))
97919790
)
97929791
}
97939792

@@ -10564,9 +10563,8 @@ mod tests {
1056410563

1056510564
assert_matches!(
1056610565
query_validation_result,
10567-
Err(Error::Drive(drive::error::Error::GroveDB(
10568-
drive::grovedb::Error::CorruptedReferencePathKeyNotFound(_)
10569-
)))
10566+
Err(Error::Drive(drive::error::Error::GroveDB(e)))
10567+
if matches!(e.as_ref(), drive::grovedb::Error::CorruptedReferencePathKeyNotFound(_))
1057010568
)
1057110569
}
1057210570

packages/rs-drive-abci/src/query/system/path_elements/v0/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<C> Platform<C> {
5757
.map(|element| {
5858
element
5959
.serialize(&platform_version.drive.grove_version)
60-
.map_err(|e| Error::Drive(drive::error::Error::GroveDB(e)))
60+
.map_err(|e| Error::Drive(drive::error::Error::from(e)))
6161
})
6262
.collect::<Result<Vec<Vec<u8>>, Error>>()?;
6363

packages/rs-drive-proof-verifier/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<O> MapGroveDbError<O> for Result<O, drive::error::Error> {
124124

125125
Err(drive::error::Error::GroveDB(grove_err)) => {
126126
// If InvalidProof error is returned, extract the path query from it
127-
let maybe_query = match &grove_err {
127+
let maybe_query = match grove_err.as_ref() {
128128
GroveError::InvalidProof(path_query, ..) => Some(path_query.clone()),
129129
_ => None,
130130
};

packages/rs-drive-proof-verifier/src/proof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl FromProof<platform::GetIdentityByNonUniquePublicKeyHashRequest> for Identit
421421
.map_err(|e| match e {
422422
drive::error::Error::GroveDB(e) => {
423423
// If InvalidProof error is returned, extract the path query from it
424-
let maybe_query = match &e {
424+
let maybe_query = match e.as_ref() {
425425
GroveError::InvalidProof(path_query, ..) => Some(path_query.clone()),
426426
_ => None,
427427
};

0 commit comments

Comments
 (0)