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!: implement expired subspace fee grant deletion #1198

Merged
merged 26 commits into from
Jul 14, 2023

Conversation

dadamu
Copy link
Contributor

@dadamu dadamu commented Jul 13, 2023

Description

This PR implements expired subspace fee grant deletion mentioned in ADR-017.


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)

@github-actions github-actions bot added the x/subspaces Issue on the x/subspaces module label Jul 13, 2023
@dadamu dadamu changed the title feat: implement subspace fee grant expiration deletion feat: implement expired subspace fee grant deletion Jul 13, 2023
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Patch coverage: 89.47% and project coverage change: -0.46 ⚠️

Comparison is base (275eee9) 80.95% compared to head (ce8ef22) 80.49%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
- Coverage   80.95%   80.49%   -0.46%     
==========================================
  Files         215      218       +3     
  Lines       18062    18289     +227     
==========================================
+ Hits        14622    14722     +100     
- Misses       2829     2955     +126     
- Partials      611      612       +1     
Impacted Files Coverage Δ
x/subspaces/module.go 12.58% <0.00%> (ø)
x/subspaces/types/models_feegrant.go 78.57% <61.53%> (-0.38%) ⬇️
x/subspaces/abci.go 100.00% <100.00%> (ø)
x/subspaces/keeper/feegrant.go 94.32% <100.00%> (+2.92%) ⬆️
x/subspaces/legacy/v7/store.go 100.00% <100.00%> (ø)
x/subspaces/simulation/decoder.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dadamu dadamu changed the title feat: implement expired subspace fee grant deletion feat!: implement expired subspace fee grant deletion Jul 14, 2023
@dadamu dadamu marked this pull request as ready for review July 14, 2023 08:54
@dadamu dadamu requested a review from a team as a code owner July 14, 2023 08:54
x/subspaces/abci.go Outdated Show resolved Hide resolved
x/subspaces/keeper/feegrant.go Show resolved Hide resolved
x/subspaces/keeper/feegrant.go Show resolved Hide resolved
x/subspaces/keeper/feegrant.go Show resolved Hide resolved
x/subspaces/keeper/feegrant_test.go Outdated Show resolved Hide resolved
x/subspaces/types/models_feegrant_test.go Show resolved Hide resolved
Comment on lines 33 to 34
allowanceKey := allowancePrefix
allowanceKey = append(allowanceKey, iterator.Key()...)
Copy link
Contributor

Choose a reason for hiding this comment

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

These lines can be combined

Suggested change
allowanceKey := allowancePrefix
allowanceKey = append(allowanceKey, iterator.Key()...)
allowanceKey := append(allowancePrefix, iterator.Key()...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would cause the linter error: appendAssign: append result not assigned to the same slice (gocritic).
https://github.com/desmos-labs/desmos/actions/runs/5552100585/jobs/10139013465#step:5:146

Copy link
Contributor

Choose a reason for hiding this comment

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

What about something like this?

allowanceKey := append([]byte(allowanceKey...), iterator.Key()...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be another linter problem:
x/subspaces/legacy/v7/store.go:33:33: unnecessary conversion (unconvert) allowanceKey := append([]byte(allowancePrefix), iterator.Key()...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok then we can leave it as it is

Copy link
Contributor Author

@dadamu dadamu Jul 14, 2023

Choose a reason for hiding this comment

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

I found the similar codes in profile grpc_query which uses append([]byte(nil), prefix) pattern. I think we can apply it.

https://github.com/desmos-labs/desmos/blob/master/x/profiles/keeper/grpc_query.go#L179

Updated

dadamu and others added 5 commits July 14, 2023 22:57
Co-authored-by: Riccardo <riccardo.montagnin@gmail.com>
Co-authored-by: Riccardo <riccardo.montagnin@gmail.com>
Co-authored-by: Riccardo <riccardo.montagnin@gmail.com>
Co-authored-by: Riccardo <riccardo.montagnin@gmail.com>
@dadamu dadamu requested a review from RiccardoM July 14, 2023 15:11
@RiccardoM RiccardoM merged commit 9644ca9 into master Jul 14, 2023
32 of 33 checks passed
@RiccardoM RiccardoM deleted the paul/impl-subspace-fee-grant-expiration-deletion branch July 14, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x/subspaces Issue on the x/subspaces module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants