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

fix: fixed how profiles-related data are deleted #784

Merged
merged 9 commits into from
Mar 22, 2022

Conversation

RiccardoM
Copy link
Contributor

@RiccardoM RiccardoM commented Mar 21, 2022

Description

This PR fixes how DTag transfer requests, app links and chain links are deleted. Particularly, there was a bug inside the DeleteAllUserAppLinks that did not remove all the keys (the ApplicationLinkClientIDKey was left there).

I have replaced the individual key removal from within that method with a call to the properly implemented DeleteApplicationLink instead.

I have also improved DeleteApplicationLink and DeleteChainLink methods to require an ApplicationLink and a ChainLink respectively. Now they do not return any error if the link is not found, and that responsibility (existence check) is moved to the called.

Depends-On: #787


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/profiles Module that allows to create and manage decentralized social profiles label Mar 21, 2022
@RiccardoM RiccardoM added the requires-upgrade Test the on-chain upgrade for this PR label Mar 21, 2022
@RiccardoM RiccardoM mentioned this pull request Mar 21, 2022
19 tasks
@codecov
Copy link

codecov bot commented Mar 21, 2022

Codecov Report

Merging #784 (6ae1292) into master (8905ecb) will decrease coverage by 0.10%.
The diff coverage is 84.61%.

❗ Current head 6ae1292 differs from pull request most recent head 6a6e923. Consider uploading reports for the commit 6a6e923 to get more accurate results

@@            Coverage Diff             @@
##           master     #784      +/-   ##
==========================================
- Coverage   81.30%   81.20%   -0.11%     
==========================================
  Files          76       76              
  Lines        6495     6460      -35     
==========================================
- Hits         5281     5246      -35     
- Misses        970      972       +2     
+ Partials      244      242       -2     
Impacted Files Coverage Δ
x/profiles/keeper/msg_server_app_link.go 0.00% <0.00%> (ø)
x/profiles/legacy/v4/keeper.go 81.81% <ø> (-1.64%) ⬇️
x/profiles/keeper/keeper_app_links.go 81.15% <85.71%> (+4.90%) ⬆️
app/app.go 82.20% <100.00%> (ø)
x/profiles/keeper/keeper_chain_links.go 82.69% <100.00%> (-2.06%) ⬇️
x/profiles/keeper/keeper_dtag_transfers.go 88.46% <100.00%> (-0.63%) ⬇️
x/profiles/keeper/msg_server_chain_link.go 100.00% <100.00%> (ø)
x/profiles/keeper/msg_server_dtag_transfers.go 76.74% <100.00%> (+0.55%) ⬆️
x/profiles/legacy/v4/store.go 83.53% <100.00%> (-1.38%) ⬇️
x/relationships/legacy/v1/store.go 57.14% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8905ecb...6a6e923. Read the comment docs.

@RiccardoM RiccardoM changed the title fix: fixed how chain links and app links are deleted fix: fixed how profiles-related data are deleted Mar 21, 2022
@RiccardoM RiccardoM mentioned this pull request Mar 21, 2022
19 tasks
@RiccardoM RiccardoM added the automerge Automatically merge PR once all prerequisites pass label Mar 21, 2022
Copy link
Contributor

@dadamu dadamu left a comment

Choose a reason for hiding this comment

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

LGTM

},
check: func(ctx sdk.Context) {
kvStore := ctx.KVStore(keys[types.StoreKey])
require.False(t, kvStore.Has(profilestypes.ApplicationLinkClientIDKey("client_id")))
Copy link
Contributor

@dadamu dadamu Mar 22, 2022

Choose a reason for hiding this comment

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

Suggested change
require.False(t, kvStore.Has(profilestypes.ApplicationLinkClientIDKey("client_id")))
require.False(t, kvStore.Has(v4.ApplicationLinkClientIDKey("client_id")))

The client id key of profilesv4 is not the same as the new one. We should check old key is deleted properly or not, instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks for spotting this! 🙏

@mergify mergify bot merged commit 1dd8004 into master Mar 22, 2022
@mergify mergify bot deleted the riccardo/app-chain-links-fixes branch March 22, 2022 09:51
mergify bot pushed a commit that referenced this pull request Mar 22, 2022
## Description
This PR adds the hooks to the `x/profiles` keeper, allowing other keepers to react to events such as profiles saving, deletion and others. 

Depends-On: #784



---

### 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge PR once all prerequisites pass requires-upgrade Test the on-chain upgrade for this PR x/profiles Module that allows to create and manage decentralized social profiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants