consensus

package module
v0.2.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 26 Imported by: 11

README


sidebar_position: 1

x/consensus

Abstract

Functionality to modify CometBFT's ABCI consensus params.

Contents

State

The x/consensus module keeps state of the consensus params from CometBFT.

Params

The consensus module stores its params in state with the prefix of 0x05, it can be updated with governance or the address with authority.

  • Params: 0x05 | ProtocolBuffer(cometbft.ConsensusParams)
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/x/consensus/proto/cosmos/consensus/v1/query.proto#L21-L27
https://github.com/cometbft/cometbft/blob/v0.34.35/proto/tendermint/types/params.proto#L11-L18

Keeper

The Keeper of the x/consensus module provides the following functions:

  • Params: Retrieves the current consensus parameters.

  • UpdateParams: Updates the consensus parameters. Only the authority can perform this operation.

  • BlockParams: Returns the maximum gas and bytes allowed in a block.

  • ValidatorPubKeyTypes: Provides the list of public key types allowed for validators.

  • EvidenceParams: Returns the evidence parameters, including maximum age and bytes.

  • AppVersion: Returns the current application version.

Note: It is recommended to use the x/consensus module keeper to get consensus params instead of accessing them through the context.

Messages

UpdateParams

Update consensus params.

https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/x/consensus/proto/cosmos/consensus/v1/tx.proto#L24-L44

The message will fail under the following conditions:

  • The signer is not the set authority
  • Not all values are set

Events

The consensus module emits the following events:

Message Events

MsgUpdateParams
Type Attribute Key Attribute Value
string authority msg.Signer
string parameters consensus Parameters

Documentation

Index

Constants

View Source
const ConsensusVersion = 1

ConsensusVersion defines the current x/consensus module consensus version.

Variables

This section is empty.

Functions

func ProvideAppVersionModifier

func ProvideAppVersionModifier(k keeper.Keeper) server.VersionModifier

Types

type AppModule

type AppModule struct {
	// contains filtered or unexported fields
}

AppModule implements an application module

func NewAppModule

func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) AutoCLIOptions

func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions

AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion implements HasConsensusVersion.

func (AppModule) DefaultGenesis

func (am AppModule) DefaultGenesis() json.RawMessage

DefaultGenesis returns the default genesis state. (Noop)

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error)

ExportGenesis returns the exported genesis state. (Noop)

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error

InitGenesis performs genesis initialization for the bank module.

func (AppModule) IsAppModule

func (AppModule) IsAppModule()

IsAppModule implements the appmodule.AppModule interface.

func (AppModule) IsOnePerModuleType

func (am AppModule) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

func (AppModule) ModuleCodec

func (am AppModule) ModuleCodec() (schema.ModuleCodec, error)

ModuleCodec implements schema.HasModuleCodec. It allows the indexer to decode the module's KVPairUpdate.

func (AppModule) Name

func (AppModule) Name() string

Name returns the consensus module's name. Deprecated: kept for legacy reasons.

func (AppModule) RegisterGRPCGatewayRoutes

func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux)

RegisterGRPCGatewayRoutes registers the gRPC Gateway routes

func (AppModule) RegisterInterfaces

func (AppModule) RegisterInterfaces(registrar registry.InterfaceRegistrar)

RegisterInterfaces registers interfaces and implementations of the bank module.

func (AppModule) RegisterLegacyAminoCodec

func (AppModule) RegisterLegacyAminoCodec(registrar registry.AminoRegistrar)

RegisterLegacyAminoCodec registers the consensus module's types on the LegacyAmino codec.

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error

RegisterServices registers module services.

func (AppModule) ValidateGenesis

func (am AppModule) ValidateGenesis(data json.RawMessage) error

ValidateGenesis validates the genesis state. (Noop)

type ModuleInputs

type ModuleInputs struct {
	depinject.In

	Config       *modulev1.Module
	Cdc          codec.Codec
	Environment  appmodule.Environment
	AddressCodec address.Codec
}

type ModuleOutputs

type ModuleOutputs struct {
	depinject.Out

	Keeper        keeper.Keeper
	Module        appmodule.AppModule
	BaseAppOption runtime.BaseAppOption
}

func ProvideModule

func ProvideModule(in ModuleInputs) ModuleOutputs

Directories

Path Synopsis
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL