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(staking): change historicalinfo to contain minimal set of data #17655

Merged
merged 18 commits into from
Sep 19, 2023

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Sep 7, 2023

Description

While speaking with the ibc-go team and rereading the adr it became apparent that only three fields are needed by the ibc team and everything else is redundant. This PR aims to remove the redundant code in order to reduce state bloat


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
  • run make lint and make test
  • 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)

@tac0turtle tac0turtle changed the title refactor: reduce historicalinfo refactor: change historicalinfo to contain minimal set of data Sep 7, 2023
@tac0turtle tac0turtle added the S: DO NOT MERGE Status: DO NOT MERGE label Sep 8, 2023
@tac0turtle tac0turtle removed S:proposed S: DO NOT MERGE Status: DO NOT MERGE labels Sep 18, 2023
@tac0turtle tac0turtle marked this pull request as ready for review September 18, 2023 09:15
@tac0turtle tac0turtle requested a review from a team as a code owner September 18, 2023 09:15
proto/cosmos/staking/v1beta1/staking.proto Outdated Show resolved Hide resolved
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Just dropping a question about naming, PR looks great btw! Thanks 🙏

proto/cosmos/staking/v1beta1/staking.proto Outdated Show resolved Hide resolved
@tac0turtle tac0turtle added this pull request to the merge queue Sep 19, 2023
@tac0turtle tac0turtle removed this pull request from the merge queue due to a manual request Sep 19, 2023
CHANGELOG.md Outdated
@@ -160,6 +160,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (x/distribution) [#17115](https://github.com/cosmos/cosmos-sdk/pull/17115) Migrate `PreviousProposer` to collections.
* (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp.
* (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `HistoricalInfo` was replaced with `Historical`, it removes the validator set and comet header and only keep what is needed for IBC.
Copy link
Member

Choose a reason for hiding this comment

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

I feel like the changelog does not correspond to the latest updates in this PR.

Copy link
Member

@julienrbrt julienrbrt Sep 19, 2023

Choose a reason for hiding this comment

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

Can we add a Client Breaking change as well, given that the response of the query will be different?

@@ -25,6 +25,22 @@ var _ types.ValidatorSet = Keeper{}
// Implements DelegationSet interface
var _ types.DelegationSet = Keeper{}

func HistoricalInfoCodec(cdc codec.BinaryCodec) collcodec.ValueCodec[types.HistoricalRecord] {
Copy link
Member

Choose a reason for hiding this comment

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

Nit, should be in keys.go for consistency with bank (

var BalanceValueCodec = collcodec.NewAltValueCodec(sdk.IntValue, func(bytes []byte) (math.Int, error) {
)

@julienrbrt julienrbrt changed the title refactor: change historicalinfo to contain minimal set of data refactor(staking): change historicalinfo to contain minimal set of data Sep 19, 2023
@tac0turtle tac0turtle added this pull request to the merge queue Sep 19, 2023
Merged via the queue into main with commit c05ff14 Sep 19, 2023
50 checks passed
@tac0turtle tac0turtle deleted the marko/reduce_historicalInfo branch September 19, 2023 11:01
message HistoricalRecord {
bytes apphash = 1;
google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true];
bytes validator_hash = 3;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I know this is just merged, but should this field be validators_hash (plural). I can make a PR if you want :)

Copy link
Member Author

Choose a reason for hiding this comment

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

true i can amend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants