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

Regen Network/Slashing protobuf #5627

Merged

Conversation

anilcse
Copy link
Collaborator

@anilcse anilcse commented Feb 7, 2020

Closes: regen-network#19

Description


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@tac0turtle tac0turtle added T: State Machine Breaking State machine breaking changes (impacts consensus). C:x/slashing WIP labels Feb 11, 2020
@alexanderbez alexanderbez mentioned this pull request Feb 11, 2020
28 tasks
@anilcse anilcse force-pushed the regen-network/slashing_protobuf branch from 5395ce8 to d90bb3e Compare February 11, 2020 16:33
…ork/slashing_protobuf

# Conflicts:
#	x/slashing/app_test.go
x/slashing/app_test.go Outdated Show resolved Hide resolved
simapp/codec.go Outdated
@@ -15,6 +16,7 @@ type AppCodec struct {
amino *codec.Codec

Params *params.Codec
Slashing *slashing.Codec
Copy link
Member

Choose a reason for hiding this comment

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

I do think we should have something more generic when modules don't actually do anything special with their codec. What do you think @alexanderbez ?

Copy link
Member

Choose a reason for hiding this comment

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

this file should be removed as the new design does not contain this struct. you can see here: https://github.com/cosmos/cosmos-sdk/blob/08502d6d98bff3872916f8b69cde2d255351d3fb/simapp/codec/codec.go

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

@anilcse can you rebase off of the latest master please? Also, we need to remove the use of internal/ pkg (just bump everything up to the root; ref: #5646).

@codecov
Copy link

codecov bot commented Feb 18, 2020

Codecov Report

Merging #5627 into master will decrease coverage by 0.62%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5627      +/-   ##
==========================================
- Coverage   39.42%   38.79%   -0.63%     
==========================================
  Files         326      327       +1     
  Lines       29014    29505     +491     
==========================================
+ Hits        11438    11446       +8     
- Misses      16386    16867     +481     
- Partials     1190     1192       +2     

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Looks great! Just a few small nit picks 👍

CHANGELOG.md Outdated
for JSON encoding.
* The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type
provided is specified by `ModuleCdc`.
* (distr) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffer for state
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this line added?

cdc.RegisterConcrete(MsgUnjail{}, "cosmos-sdk/MsgUnjail", nil)
}

type Codec struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't actually need a concrete type here anymore. See https://github.com/cosmos/cosmos-sdk/blob/master/x/distribution/types/codec.go for an example. You can just copy and modify.

syntax = "proto3";
package cosmos_sdk.x.slashing.v1;

option go_package = "types";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think some other modules do this wrong and need to be fixed. This should be github.com/cosmos/cosmos-sdk/x/slashing/types.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK 🎉

@alexanderbez alexanderbez merged commit 883c1a2 into cosmos:master Feb 20, 2020
@ryanchristo ryanchristo deleted the regen-network/slashing_protobuf branch December 12, 2022 18:15
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/slashing T: State Machine Breaking State machine breaking changes (impacts consensus).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate slashing module to Protobuf
6 participants