-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Conversation
x/consensus/keeper/keeper.go
Outdated
return Keeper{ | ||
storeService: storeService, | ||
cdc: cdc, | ||
authority: authority, | ||
|
||
Params: collections.NewItem(sb, ParamsPrefix, StoreKey, codec.CollValue[cmtproto.ConsensusParams](cdc)), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
4c18799
to
05fecfa
Compare
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
} | ||
|
||
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
TestDeliverTx (server/mock/app_test.go) is failing because the paramStore is not set |
e343cd7
to
52f8f06
Compare
85eefca
to
8f27bd5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
||
// QueryParamsResponse defines the response type for querying x/consensus parameters. | ||
message QueryParamsResponse { | ||
message QueryGetParamsResponse { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted in #15627
} | ||
|
||
cp, err := app.paramStore.Get(ctx) | ||
if err != nil { | ||
panic(err) | ||
panic(fmt.Errorf("consensus key is nil: %w", err)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change