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: migrate consensus to collections #15553

Merged
merged 16 commits into from
Mar 28, 2023
Merged

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Mar 27, 2023

This pr migrates consensus module to consensus and puts everything related to the keeper in a single file
Closes: #16275


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)

return Keeper{
storeService: storeService,
cdc: cdc,
authority: authority,

Params: collections.NewItem(sb, ParamsPrefix, StoreKey, codec.CollValue[cmtproto.ConsensusParams](cdc)),
Copy link
Member Author

Choose a reason for hiding this comment

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

before we were not using a store prefix so we should verify this

Copy link
Member Author

Choose a reason for hiding this comment

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

tested on a local testnet it works

baseapp/params_legacy.go Fixed Show fixed Hide fixed
x/consensus/keeper/keeper.go Fixed Show fixed Hide fixed
@tac0turtle tac0turtle marked this pull request as ready for review March 27, 2023 19:23
@tac0turtle tac0turtle requested a review from a team as a code owner March 27, 2023 19:23
@github-prbot github-prbot requested review from a team, atheeshp and testinginprod and removed request for a team March 27, 2023 19:23
if cp := app.GetConsensusParams(app.deliverState.ctx); cp != nil {
res.ConsensusParamUpdates = cp
}
cp := app.GetConsensusParams(app.deliverState.ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

path flow from Begin/EndBlock to a panic call path flow from Begin/EndBlock to a panic call
baseapp/baseapp.go Fixed Show fixed Hide fixed
}

cp, err := app.paramStore.Get(ctx)
if err != nil {
panic(err)
panic(fmt.Errorf("consensus key is nil: %w", err))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@facundomedica
Copy link
Member

TestDeliverTx (server/mock/app_test.go) is failing because the paramStore is not set

Copy link
Contributor

@testinginprod testinginprod left a comment

Choose a reason for hiding this comment

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

LGTM.

x/consensus/keeper/keeper.go Outdated Show resolved Hide resolved
x/consensus/keeper/keeper.go Outdated Show resolved Hide resolved
@tac0turtle tac0turtle enabled auto-merge (squash) March 28, 2023 15:37

// QueryParamsResponse defines the response type for querying x/consensus parameters.
message QueryParamsResponse {
message QueryGetParamsResponse {
Copy link
Member

Choose a reason for hiding this comment

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

Is that proto breaking warning ok to be ignored? cc @AmauryM

Copy link
Member

Choose a reason for hiding this comment

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

Reverted in #15627

@tac0turtle tac0turtle merged commit a5ad307 into main Mar 28, 2023
@tac0turtle tac0turtle deleted the marko/consensus_collections branch March 28, 2023 20:41
}

cp, err := app.paramStore.Get(ctx)
if err != nil {
panic(err)
panic(fmt.Errorf("consensus key is nil: %w", err))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The key isn't nil, the value is empty/nil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I'll amend in another pr.

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.

refactor: migrate consensus to collections
6 participants