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

refactor: Improve x/bank deterministic tests #13450

Merged
merged 13 commits into from
Oct 6, 2022
Merged

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Oct 5, 2022

Description

While reviewing #13362, I noticed two things:

  1. I personally don't feel comfortable to test determinism using mocks. There might be cases where x/bank keeper calls an x/auth keeper method, and the latter is non-deterministic. Mocks wouldn't catch this. I propose to use depinject. ref: EPIC: make guarantees around query responses #13041 (comment)
  2. Pagination was never tested.

This PR addresses these 2 points.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@amaury1093 amaury1093 marked this pull request as ready for review October 5, 2022 13:29
@amaury1093 amaury1093 requested a review from a team as a code owner October 5, 2022 13:29
@amaury1093 amaury1093 mentioned this pull request Oct 5, 2022
19 tasks
@codecov
Copy link

codecov bot commented Oct 5, 2022

Codecov Report

Merging #13450 (2dabaf7) into main (bb54c59) will increase coverage by 0.08%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13450      +/-   ##
==========================================
+ Coverage   53.87%   53.95%   +0.08%     
==========================================
  Files         641      647       +6     
  Lines       55034    55295     +261     
==========================================
+ Hits        29648    29833     +185     
- Misses      23003    23072      +69     
- Partials     2383     2390       +7     
Impacted Files Coverage Δ
x/bank/keeper/grpc_query.go 56.34% <0.00%> (-11.68%) ⬇️
crypto/keys/internal/ecdsa/privkey.go 81.13% <0.00%> (-1.89%) ⬇️
x/group/keeper/keeper.go 56.25% <0.00%> (-0.40%) ⬇️
tx/textual/valuerenderer/dec.go 74.19% <0.00%> (ø)
tx/textual/valuerenderer/valuerenderer.go 79.16% <0.00%> (ø)
tx/textual/valuerenderer/coins.go 80.80% <0.00%> (ø)
tx/textual/valuerenderer/bytes.go 60.00% <0.00%> (ø)
tx/textual/valuerenderer/timestamp.go 100.00% <0.00%> (ø)
tx/textual/valuerenderer/int.go 78.94% <0.00%> (ø)

Copy link
Contributor

@atheeshp atheeshp left a comment

Choose a reason for hiding this comment

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

lgtm

@amaury1093 amaury1093 enabled auto-merge (squash) October 6, 2022 10:43
@amaury1093 amaury1093 merged commit ff39d24 into main Oct 6, 2022
@amaury1093 amaury1093 deleted the am/refactor-det-tests branch October 6, 2022 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants