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: ADR-010: Posts module #847

Merged
merged 87 commits into from
May 26, 2022
Merged

feat: ADR-010: Posts module #847

merged 87 commits into from
May 26, 2022

Conversation

RiccardoM
Copy link
Contributor

@RiccardoM RiccardoM commented Apr 27, 2022

Description

This PR implements the x/posts module as per ADR-010.

Implementation checklist

  • Types
  • Keeper
  • CLI
  • Simulation tests
  • Invariants
  • spec folder

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)

Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
@codecov
Copy link

codecov bot commented Apr 27, 2022

Codecov Report

Merging #847 (7a54d90) into master (d27785d) will increase coverage by 0.11%.
The diff coverage is 82.58%.

@@            Coverage Diff             @@
##           master     #847      +/-   ##
==========================================
+ Coverage   81.64%   81.76%   +0.11%     
==========================================
  Files          91      110      +19     
  Lines        7224     9240    +2016     
==========================================
+ Hits         5898     7555    +1657     
- Misses       1052     1363     +311     
- Partials      274      322      +48     
Impacted Files Coverage Δ
x/posts/types/params.go 56.52% <ø> (ø)
x/subspaces/types/permissions.go 73.52% <ø> (ø)
x/posts/module.go 8.33% <8.33%> (ø)
x/posts/keeper/alias_functions.go 66.00% <66.00%> (ø)
x/posts/types/models.go 71.39% <71.39%> (ø)
x/posts/keeper/keeper.go 73.68% <73.68%> (ø)
x/posts/keeper/subspaces_hooks.go 73.68% <73.68%> (ø)
x/posts/keeper/grpc_query.go 82.85% <82.85%> (ø)
x/posts/keeper/msg_server.go 85.83% <85.83%> (ø)
x/posts/keeper/posts.go 90.35% <90.35%> (ø)
... and 12 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 d28eca1...7a54d90. Read the comment docs.

Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
@github-actions github-actions bot added the x/profiles Module that allows to create and manage decentralized social profiles label Apr 28, 2022
@github-actions github-actions bot added the x/subspaces Issue on the x/subspaces module label Apr 29, 2022
RiccardoM added 12 commits May 2, 2022 12:00
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
…posts-implementation

� Conflicts:
�	app/app.go
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
@github-actions github-actions bot added the x/CLI label May 4, 2022
RiccardoM added 5 commits May 4, 2022 15:05
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
Signed-off-by: Riccardo Montagnin <[email protected]>
@github-actions github-actions bot added the kind/adr An issue or PR relating to an architectural decision record label May 5, 2022
repeated uint32 answers_indexes = 4;

// Address of the user answering the poll
bytes user = 5 [ (gogoproto.casttype) =
Copy link
Contributor

@dadamu dadamu May 20, 2022

Choose a reason for hiding this comment

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

Why is the type of user is AccAddress instead of bech32 prefixed string? Is it to prevent the double vote with the same address via ibc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted to use a string instead of a bytes representation

x/posts/types/models.go Outdated Show resolved Hide resolved
x/posts/types/models.go Outdated Show resolved Hide resolved
x/posts/types/models.go Outdated Show resolved Hide resolved
x/posts/types/msgs.go Outdated Show resolved Hide resolved
sdk.NewAttribute(types.AttributeKeySubspaceID, fmt.Sprintf("%d", msg.SubspaceID)),
sdk.NewAttribute(types.AttributeKeyPostID, fmt.Sprintf("%d", post.ID)),
sdk.NewAttribute(types.AttributeKeyAuthor, msg.Author),
sdk.NewAttribute(types.AttributeKeyCreationTime, post.CreationDate.Format(time.RFC3339)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a dump question, why timestamp should be indexed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done in order to allow clients to get the creation time from the returned events. Since it is based on the block time, and this is not know to the client, the only way we have to return it to clients (so that they can update the post information locally) is though block events that can later be parsed

@RiccardoM RiccardoM requested a review from dadamu May 26, 2022 09:12
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.

Ready to go

@mergify mergify bot merged commit a091bdd into master May 26, 2022
@mergify mergify bot deleted the riccardo/posts-implementation branch May 26, 2022 10:37
mergify bot pushed a commit that referenced this pull request Jun 7, 2022
## Description

This PR implements the `x/reports` module as detailed inside [ADR-011](https://github.com/desmos-labs/desmos/blob/master/docs/architecture/adr-011-reports-module.md).

Depends-On: #847 

---

### 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...

- [x] 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
- [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [x] 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
- [x] reviewed "Files changed" and left comments if necessary
- [x] 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 kind/adr An issue or PR relating to an architectural decision record x/CLI x/profiles Module that allows to create and manage decentralized social profiles x/subspaces Issue on the x/subspaces module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants