-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat(consensus): add consensus message #19483
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bc6bf86
add proto message for consensus message
tac0turtle 2007967
add message
tac0turtle ffbf490
Merge branch 'main' into marko/19246
tac0turtle b95e7ea
add api
tac0turtle f183441
add test case
tac0turtle d76c1a6
add changelog
tac0turtle d091a68
Update CHANGELOG.md
tac0turtle ffbc1d1
comments
tac0turtle 32e6d7c
lint fix
tac0turtle 381de64
fix
tac0turtle 09d8a40
add docs
tac0turtle 1cbefb3
bank -> consensus
tac0turtle c4fb275
fix test and linting
tac0turtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Since: cosmos-sdk 0.51 | ||
syntax = "proto3"; | ||
package cosmos.consensus.v1; | ||
|
||
import "tendermint/types/params.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/consensus/types"; | ||
|
||
// ConMsgParams is the Msg/Params request type. This is a consensus message that is sent from cometbft. | ||
message ConMsgParams { | ||
// params defines the x/consensus parameters to be passed from comet. | ||
// | ||
// NOTE: All parameters must be supplied. | ||
tendermint.types.VersionParams version = 1; | ||
tendermint.types.BlockParams block = 2; | ||
tendermint.types.EvidenceParams evidence = 3; | ||
tendermint.types.ValidatorParams validator = 4; | ||
tendermint.types.ABCIParams abci = 5; | ||
} | ||
|
||
// ConMsgParamsResponse defines the response structure for executing a | ||
// ConMsgParams message. | ||
message ConMsgParamsResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package types | ||
|
||
import ( | ||
"errors" | ||
|
||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
cmttypes "github.com/cometbft/cometbft/types" | ||
) | ||
|
||
func (msg ConMsgParams) 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.Abci = &cmtproto.ABCIParams{ | ||
VoteExtensionsEnableHeight: msg.Abci.VoteExtensionsEnableHeight, | ||
} | ||
} | ||
|
||
if msg.Version != nil { | ||
cp.Version.App = msg.Version.App | ||
} | ||
|
||
return cp, nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Is there a reason to abbreviate
Consensus
?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.
smaller footprint since larger names impact overall size