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: enable clippy::correctness as part of CI #8299

Merged
merged 6 commits into from
Jan 11, 2023

Conversation

pugachAG
Copy link
Contributor

@pugachAG pugachAG commented Jan 6, 2023

This enables clippy clippy::correctness checks as part of CI as discussed here.

It is added as part of sanity check step for consistency, since that is where cargo check is executed.

This fixes the following issues in order to pass the added checks:

  • noop .clone()
  • this loop never actually loops
  • 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using self.burst == 0 instead

This PR is a part of #8145

@pugachAG pugachAG changed the title wip: enable clippy as part of CI feat: enable clippy::correctness as part of CI Jan 10, 2023
@pugachAG pugachAG marked this pull request as ready for review January 10, 2023 14:42
@pugachAG pugachAG requested a review from a team as a code owner January 10, 2023 14:42
Copy link
Collaborator

@nagisa nagisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clippy file has been added empty, so we should probably not add one at all.

.buildkite/pipeline.yml Outdated Show resolved Hide resolved
chain/chain/src/store_validator/validate.rs Outdated Show resolved Hide resolved
chain/chain/src/store_validator/validate.rs Outdated Show resolved Hide resolved
chain/chain/src/store_validator/validate.rs Outdated Show resolved Hide resolved
chain/chunks/src/lib.rs Outdated Show resolved Hide resolved
@pugachAG pugachAG requested a review from nagisa January 10, 2023 17:37
@pugachAG pugachAG added A-CI Area: Continuous Integration A-benchmark Area: performance benchmarks S-automerge and removed A-benchmark Area: performance benchmarks labels Jan 11, 2023
@near-bulldozer near-bulldozer bot merged commit 35f6054 into near:master Jan 11, 2023
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Jan 15, 2023
This enables clippy `clippy::correctness` checks as part of CI as discussed [here](near#8291 (comment)).

It is added as part of `sanity check` step for consistency, since that is where `cargo check` is executed.

This fixes the following issues in order to pass the added checks:
* noop `.clone()`
* this loop never actually loops 
* `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `self.burst == 0` instead

This PR is a part of near#8145
near-bulldozer bot pushed a commit that referenced this pull request Jan 16, 2023
`block_refcount_final` was incorrectly refactored in #8299 to check for `sv.inner.genesis_blocks` and `sv.inner.block_refcount` being non-empty. It should check for more than 1 element instead.

This was caught by [the nayduck test](https://nayduck.near.org/#/test/410756):
```
2023-01-15T12:31:09.117757Z ERROR handle{handler="NetworkAdversarialMessage" actor="ClientActor" msg_type="NetworkAdversarialMessage"}: client: Storage Validation failed, [ErrorMessage { col: "BlockRefCount", key: "\"BLOCK_REFCOUNT\"", err: ValidationFailed { func_name: "f", error: "Found 1 Blocks that are not counted, e.g. (B7Sbqj2uD5M3yACTDgSDG9haw2L5vEdLsJiosuPZCDn1, 1)" } }]
```

See [zulip thread](https://near.zulipchat.com/#narrow/stream/295302-general/topic/failing.20nayduck.20tests) for more context.
@pugachAG pugachAG mentioned this pull request Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Continuous Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants