Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(drive): handlers error codes #1394

Merged
merged 28 commits into from
Oct 3, 2023

Revert "wip: test mtime hack"

8ec05be
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feat(drive): handlers error codes #1394

Revert "wip: test mtime hack"
8ec05be
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Oct 3, 2023 in 11s

clippy

550 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 550
Note 0
Help 0

Versions

  • rustc 1.72.1 (d5c2e9c34 2023-09-13)
  • cargo 1.72.1 (103a7ff2e 2023-08-15)
  • clippy 0.1.72 (d5c2e9c 2023-09-13)

Annotations

Check warning on line 229 in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
   --> packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs:229:16
    |
229 |             if diffs.len() > 0 {
    |                ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!diffs.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

Check warning on line 189 in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
   --> packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/state/v0/mod.rs:189:16
    |
189 |             if diffs.len() > 0 {
    |                ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!diffs.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default

Check warning on line 76 in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this lifetime isn't used in the function definition

warning: this lifetime isn't used in the function definition
  --> packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/transformer/v0/mod.rs:76:32
   |
76 |     fn transform_transition_v0<'a>(
   |                                ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
   = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default

Check warning on line 16 in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&Vec` instead of `&[_]` involves a new object where a slice will do

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
  --> packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/executor.rs:16:32
   |
16 |         data_trigger_bindings: &Vec<DataTriggerBinding>,
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&[DataTriggerBinding]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
   = note: `#[warn(clippy::ptr_arg)]` on by default

Check warning on line 91 in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

needlessly taken reference of left operand

warning: needlessly taken reference of left operand
  --> packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/bindings/data_trigger_binding/v0/mod.rs:91:9
   |
91 |         &self.data_contract_id == data_contract_id
   |         ----------------------^^^^^^^^^^^^^^^^^^^^
   |         |
   |         help: use the left value directly: `self.data_contract_id`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
   = note: `#[warn(clippy::op_ref)]` on by default

Check warning on line 43 in packages/rs-drive-abci/src/execution/types/execution_event/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

all variants have the same postfix: `DriveEvent`

warning: all variants have the same postfix: `DriveEvent`
  --> packages/rs-drive-abci/src/execution/types/execution_event/mod.rs:21:1
   |
21 | / pub(in crate::execution) enum ExecutionEvent<'a> {
22 | |     /// A drive event that is paid by an identity
23 | |     PaidDriveEvent {
24 | |         /// The identity requesting the event
...  |
42 | |     },
43 | | }
   | |_^
   |
   = help: remove the postfixes and use full paths to the variants instead of glob imports
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
   = note: `#[warn(clippy::enum_variant_names)]` on by default

Check warning on line 46 in packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/mod.rs:46:10
   |
46 |     ) -> Result<(FeeResult, Vec<(Vec<u8>, ExecTxResult)>), Error> {
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 52 in packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> packages/rs-drive-abci/src/execution/platform_events/state_transition_processing/process_raw_state_transitions/v0/mod.rs:52:10
   |
52 |     ) -> Result<(FeeResult, Vec<(Vec<u8>, ExecTxResult)>), Error> {
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
   = note: `#[warn(clippy::type_complexity)]` on by default

Check warning on line 119 in packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   --> packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs:119:21
    |
119 |             .extend(new_quorums.into_iter());
    |                     ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `new_quorums`
    |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   --> /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/iter/traits/collect.rs:377:18
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

Check warning on line 11 in packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

module has the same name as its containing module

warning: module has the same name as its containing module
  --> packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/mod.rs:11:1
   |
11 | mod update_masternode_identities;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
   = note: `#[warn(clippy::module_inception)]` on by default

Check warning on line 129 in packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

warning: redundant closure
   --> packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs:129:51
    |
129 |                 block_state_info.block_hash().map(|a| hex::encode(a)).unwrap_or("None".to_string()),
    |                                                   ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `hex::encode`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

Check warning on line 430 in packages/rs-drive-abci/src/abci/handlers.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant closure

warning: redundant closure
   --> packages/rs-drive-abci/src/abci/handlers.rs:430:104
    |
430 | ...lock_hash().map(|block_hash| hex::encode(block_hash)).unwrap_or("None".to_string())
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `hex::encode`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
    = note: `#[warn(clippy::redundant_closure)]` on by default

Check warning on line 93 in packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods `to_vec` and `into_vec` are never used

warning: methods `to_vec` and `into_vec` are never used
   --> packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs:93:12
    |
91  | impl<'a> WithdrawalTxs<'a> {
    | -------------------------- methods in this implementation
92  |     /// Convert withdrawal transactions to vector of ExtendVoteExtension
93  |     pub fn to_vec(&self) -> Vec<ExtendVoteExtension> {
    |            ^^^^^^
...
103 |     pub fn into_vec(self) -> Vec<ExtendVoteExtension> {
    |            ^^^^^^^^

Check warning on line 31 in packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated items `load`, `validate`, and `finalize` are never used

warning: associated items `load`, `validate`, and `finalize` are never used
  --> packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs:31:12
   |
29 | impl<'a> WithdrawalTxs<'a> {
   | -------------------------- associated items in this implementation
30 |     /// Load pending withdrawal transactions from database
31 |     pub fn load(transaction: TransactionArg, drive: &Drive) -> Result<Self, AbciError> {
   |            ^^^^
...
54 |     pub fn validate(&self) -> Result<(), AbciError> {
   |            ^^^^^^^^
...
69 |     pub fn finalize(
   |            ^^^^^^^^

Check warning on line 26 in packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field `drive_operations` is never read

warning: field `drive_operations` is never read
  --> packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs:26:5
   |
24 | pub struct WithdrawalTxs<'a> {
   |            ------------- field in this struct
25 |     inner: Vec<VoteExtension>,
26 |     drive_operations: Vec<DriveOperation<'a>>,
   |     ^^^^^^^^^^^^^^^^
   |
   = note: `WithdrawalTxs` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

Check warning on line 20 in packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

constant `MAX_WITHDRAWAL_TXS` is never used

warning: constant `MAX_WITHDRAWAL_TXS` is never used
  --> packages/rs-drive-abci/src/platform_types/withdrawal/withdrawal_txs/v0/mod.rs:20:7
   |
20 | const MAX_WITHDRAWAL_TXS: u16 = 16;
   |       ^^^^^^^^^^^^^^^^^^

Check warning on line 20 in packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

type alias `GetDataContractFn` is never used

warning: type alias `GetDataContractFn` is never used
  --> packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/mod.rs:20:10
   |
20 | pub type GetDataContractFn = fn(Identifier) -> Result<Arc<DataContractFetchInfo>, ProtocolError>;
   |          ^^^^^^^^^^^^^^^^^

Check warning on line 13 in packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variant `PrecalculatedOperation` is never constructed

warning: variant `PrecalculatedOperation` is never constructed
  --> packages/rs-drive-abci/src/execution/types/execution_operation/mod.rs:13:5
   |
11 | pub enum ExecutionOperation {
   |          ------------------ variant in this enum
12 |     SignatureVerification(SignatureVerificationOperation),
13 |     PrecalculatedOperation(FeeResult),
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `ExecutionOperation` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis

Check warning on line 47 in packages/rs-drive-abci/src/execution/types/execution_event/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated functions `new_document_operation`, `new_contract_operation`, and `new_identity_insertion` are never used

warning: associated functions `new_document_operation`, `new_contract_operation`, and `new_identity_insertion` are never used
  --> packages/rs-drive-abci/src/execution/types/execution_event/mod.rs:47:12
   |
45 | impl<'a> ExecutionEvent<'a> {
   | --------------------------- associated functions in this implementation
46 |     /// Creates a new identity Insertion Event
47 |     pub fn new_document_operation(
   |            ^^^^^^^^^^^^^^^^^^^^^^
...
57 |     pub fn new_contract_operation(
   |            ^^^^^^^^^^^^^^^^^^^^^^
...
67 |     pub fn new_identity_insertion(
   |            ^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 39 in packages/rs-drive-abci/src/execution/types/execution_event/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variant `FreeDriveEvent` is never constructed

warning: variant `FreeDriveEvent` is never constructed
  --> packages/rs-drive-abci/src/execution/types/execution_event/mod.rs:39:5
   |
21 | pub(in crate::execution) enum ExecutionEvent<'a> {
   |                               -------------- variant in this enum
...
39 |     FreeDriveEvent {
   |     ^^^^^^^^^^^^^^
   |
   = note: `ExecutionEvent` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
   = note: `#[warn(dead_code)]` on by default

Check warning on line 24 in packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `execution_context`

warning: unused variable: `execution_context`
  --> packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_unique_identity_public_key_hashes_in_state/v0/mod.rs:24:5
   |
24 |     execution_context: &mut StateTransitionExecutionContext,
   |     ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_execution_context`

Check warning on line 23 in packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `execution_context`

warning: unused variable: `execution_context`
  --> packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_exist_in_state/v0/mod.rs:23:5
   |
23 |     execution_context: &mut StateTransitionExecutionContext,
   |     ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_execution_context`

Check warning on line 24 in packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `execution_context`

warning: unused variable: `execution_context`
  --> packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_ids_dont_exist_in_state/v0/mod.rs:24:5
   |
24 |     execution_context: &mut StateTransitionExecutionContext,
   |     ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_execution_context`

Check warning on line 58 in packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `execution_context`

warning: unused variable: `execution_context`
  --> packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_identity_public_key_contract_bounds/v0/mod.rs:58:5
   |
58 |     execution_context: &mut StateTransitionExecutionContext,
   |     ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_execution_context`
   |
   = note: `#[warn(unused_variables)]` on by default

Check warning on line 150 in packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

value assigned to `status` is never read

warning: value assigned to `status` is never read
   --> packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs:150:25
    |
150 |                 let mut status = current_status;
    |                         ^^^^^^
    |
    = help: maybe it is overwritten before being read?
    = note: `#[warn(unused_assignments)]` on by default