From aa3a60e2275a13e9d69498c1c5a52d9c691f9aa4 Mon Sep 17 00:00:00 2001 From: Sergio Mena Date: Fri, 10 May 2024 16:21:31 +0200 Subject: [PATCH] Remove duplicate `ToProtoConsensusParams` --- x/consensus/types/consensus.go | 44 ---------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 x/consensus/types/consensus.go diff --git a/x/consensus/types/consensus.go b/x/consensus/types/consensus.go deleted file mode 100644 index 07ca2dee2c00..000000000000 --- a/x/consensus/types/consensus.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - "errors" - - cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" - cmttypes "github.com/cometbft/cometbft/types" - gogotypes "github.com/cosmos/gogoproto/types" -) - -func (msg ConsensusMsgParams) ToProtoConsensusParams() (cmtproto.ConsensusParams, error) { - if msg.Evidence == nil || msg.Block == nil || msg.Validator == nil || msg.Version == nil { - return cmtproto.ConsensusParams{}, errors.New("all parameters must be present") - } - - cp := cmtproto.ConsensusParams{ - Block: &cmtproto.BlockParams{ - MaxBytes: msg.Block.MaxBytes, - MaxGas: msg.Block.MaxGas, - }, - Evidence: &cmtproto.EvidenceParams{ - MaxAgeNumBlocks: msg.Evidence.MaxAgeNumBlocks, - MaxAgeDuration: msg.Evidence.MaxAgeDuration, - MaxBytes: msg.Evidence.MaxBytes, - }, - Validator: &cmtproto.ValidatorParams{ - PubKeyTypes: msg.Validator.PubKeyTypes, - }, - - Version: cmttypes.DefaultConsensusParams().ToProto().Version, // Version is stored in x/upgrade - } - - if msg.Abci != nil { - cp.Feature = &cmtproto.FeatureParams{ - VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: msg.Abci.VoteExtensionsEnableHeight}, - } - } - - if msg.Version != nil { - cp.Version.App = msg.Version.App - } - - return cp, nil -}