Skip to content

Commit a9a687c

Browse files
refactor(x/consensus): audit QA (#21151)
1 parent bc698d8 commit a9a687c

File tree

8 files changed

+48
-67
lines changed

8 files changed

+48
-67
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
5757
* (baseapp) [#18499](https://github.com/cosmos/cosmos-sdk/pull/18499) Add `MsgRouter` response type from message name function.
5858
* (types) [#18768](https://github.com/cosmos/cosmos-sdk/pull/18768) Add MustValAddressFromBech32 function.
5959
* (gRPC) [#19049](https://github.com/cosmos/cosmos-sdk/pull/19049) Add debug log prints for each gRPC request.
60-
* (x/consensus) [#19483](https://github.com/cosmos/cosmos-sdk/pull/19483) Add consensus messages registration to consensus module.
6160
* (types) [#19759](https://github.com/cosmos/cosmos-sdk/pull/19759) Align SignerExtractionAdapter in PriorityNonceMempool Remove.
6261
* (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility.
6362
* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore.
@@ -144,7 +143,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
144143
* The module manager now can do everything that the basic manager was doing.
145144
* When using runtime, just inject the module manager when needed using your app config.
146145
* All `AppModuleBasic` structs have been removed.
147-
* (x/consensus) [#19488](https://github.com/cosmos/cosmos-sdk/pull/19488) Consensus module creation takes `appmodule.Environment` instead of individual services.
148146
* (server) [#18303](https://github.com/cosmos/cosmos-sdk/pull/18303) `x/genutil` now handles the application export. `server.AddCommands` does not take an `AppExporter` but instead `genutilcli.Commands` does.
149147
* (x/gov/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/18036) `MsgDeposit` has been removed because of AutoCLI migration.
150148
* (x/staking/testutil) [#17986](https://github.com/cosmos/cosmos-sdk/pull/17986) `MsgRedelegateExec`, `MsgUnbondExec` has been removed because of AutoCLI migration.
@@ -174,7 +172,6 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
174172
* (x/staking) [#18257](https://github.com/cosmos/cosmos-sdk/pull/18257) Staking module was moved to its own go.mod `cosmossdk.io/x/staking`
175173
* (x/authz) [#18265](https://github.com/cosmos/cosmos-sdk/pull/18265) Authz module was moved to its own go.mod `cosmossdk.io/x/authz`
176174
* (x/mint) [#18283](https://github.com/cosmos/cosmos-sdk/pull/18283) Mint module was moved to its own go.mod `cosmossdk.io/x/mint`
177-
* (x/consensus) [#18041](https://github.com/cosmos/cosmos-sdk/pull/18041) `ToProtoConsensusParams()` returns an error
178175
* (x/slashing) [#18115](https://github.com/cosmos/cosmos-sdk/pull/18115) `NewValidatorSigningInfo` takes strings instead of `sdk.AccAddress`
179176
* (types) [#18268](https://github.com/cosmos/cosmos-sdk/pull/18268) Remove global setting of basedenom. Use the staking module parameter instead
180177
* (x/auth) [#18351](https://github.com/cosmos/cosmos-sdk/pull/18351) Auth module was moved to its own go.mod `cosmossdk.io/x/auth`

api/cosmos/consensus/v1/tx.pulsar.go

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/consensus/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@ Ref: https://keepachangelog.com/en/1.0.0/
3131

3232
## [Unreleased]
3333

34+
### Features
35+
36+
* (x/consensus) [#19483](https://github.com/cosmos/cosmos-sdk/pull/19483) Add consensus messages registration to consensus module.
3437
* [#20615](https://github.com/cosmos/cosmos-sdk/pull/20615) Add consensus messages to add cometinfo to consensus modules
38+
39+
### API Breaking Changes
40+
41+
* (x/consensus) [#19488](https://github.com/cosmos/cosmos-sdk/pull/19488) Consensus module creation takes `appmodule.Environment` instead of individual services.
42+
* (x/consensus) [#18041](https://github.com/cosmos/cosmos-sdk/pull/18041) `ToProtoConsensusParams()` returns an error
43+

x/consensus/keeper/keeper.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"github.com/cosmos/cosmos-sdk/codec"
2020
)
2121

22-
var StoreKey = "Consensus"
23-
2422
type Keeper struct {
2523
appmodule.Environment
2624

x/consensus/keeper/keeper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func getDuration(d time.Duration) *time.Duration {
3838
}
3939

4040
func (s *KeeperTestSuite) SetupTest(enabledFeatures bool) {
41-
key := storetypes.NewKVStoreKey(consensusparamkeeper.StoreKey)
41+
key := storetypes.NewKVStoreKey(types.StoreKey)
4242
testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test"))
4343
ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Height: 5})
4444
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{})

x/consensus/proto/cosmos/consensus/v1/tx.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ message MsgUpdateParams {
3838
cometbft.types.v1.EvidenceParams evidence = 3;
3939
cometbft.types.v1.ValidatorParams validator = 4;
4040

41-
// Since: cosmos-sdk 0.51
42-
cometbft.types.v1.ABCIParams abci = 5 [deprecated = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"];
43-
cometbft.types.v1.SynchronyParams synchrony = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.51"];
41+
cometbft.types.v1.ABCIParams abci = 5 [deprecated = true, (cosmos_proto.field_added_in) = "cosmos-sdk 0.50"];
42+
43+
cometbft.types.v1.SynchronyParams synchrony = 6 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.52"];
4444
cometbft.types.v1.FeatureParams feature = 7 [(cosmos_proto.field_added_in) = "cosmos-sdk 0.52"];
4545
}
4646

x/consensus/types/msgs.go

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,17 @@ func (msg MsgUpdateParams) ToProtoConsensusParams() (cmtproto.ConsensusParams, e
3131
PubKeyTypes: msg.Validator.PubKeyTypes,
3232
},
3333
Version: cmttypes.DefaultConsensusParams().ToProto().Version, // Version is stored in x/upgrade
34-
Feature: &cmtproto.FeatureParams{},
35-
Synchrony: &cmtproto.SynchronyParams{},
34+
Feature: msg.Feature,
35+
Synchrony: msg.Synchrony,
3636
}
3737

3838
if msg.Abci != nil {
39-
cp.Feature.VoteExtensionsEnableHeight = &types.Int64Value{
40-
Value: msg.Abci.VoteExtensionsEnableHeight,
41-
}
42-
}
43-
44-
if msg.Feature != nil {
45-
if msg.Feature.VoteExtensionsEnableHeight != nil {
46-
cp.Feature.VoteExtensionsEnableHeight = &types.Int64Value{
47-
Value: msg.Feature.GetVoteExtensionsEnableHeight().GetValue(),
48-
}
39+
if cp.Feature == nil {
40+
cp.Feature = &cmtproto.FeatureParams{}
4941
}
50-
if msg.Feature.PbtsEnableHeight != nil {
51-
cp.Feature.PbtsEnableHeight = &types.Int64Value{
52-
Value: msg.Feature.GetPbtsEnableHeight().GetValue(),
53-
}
54-
}
55-
}
5642

57-
if msg.Synchrony != nil {
58-
if msg.Synchrony.MessageDelay != nil {
59-
delay := *msg.Synchrony.MessageDelay
60-
cp.Synchrony.MessageDelay = &delay
61-
}
62-
if msg.Synchrony.Precision != nil {
63-
precision := *msg.Synchrony.Precision
64-
cp.Synchrony.Precision = &precision
43+
cp.Feature.VoteExtensionsEnableHeight = &types.Int64Value{
44+
Value: msg.Abci.VoteExtensionsEnableHeight,
6545
}
6646
}
6747

x/consensus/types/tx.pb.go

Lines changed: 28 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)