From 2bfc037a07a6932fe1dbcb9cfbaf8be54ca2b930 Mon Sep 17 00:00:00 2001 From: Qt Date: Sat, 9 Mar 2024 00:59:11 +0800 Subject: [PATCH] docs: update docs (#19676) Co-authored-by: son trinh Co-authored-by: Julien Robert --- baseapp/abci.go | 2 +- baseapp/options.go | 2 +- baseapp/params_legacy.go | 63 +++++++++--------- client/context.go | 2 +- client/keys/types.go | 2 +- client/rpc/block.go | 2 +- client/v2/internal/util/util.go | 2 +- codec/codec.go | 2 +- codec/types/compat.go | 6 +- codec/unknownproto/doc.go | 44 ++++++------- core/comet/service.go | 4 +- core/store/database.go | 2 +- errors/doc.go | 62 +++++++++--------- runtime/events.go | 2 +- runtime/types.go | 16 ++--- server/doc.go | 56 ++++++++-------- .../grpc/gogoreflection/serverreflection.go | 65 +++++++++---------- server/mock/app.go | 6 +- server/mock/tx.go | 5 +- server/start.go | 5 ++ server/types/abci.go | 34 ++++++---- server/types/app.go | 2 +- server/util.go | 6 +- x/auth/migrations/legacytx/stdsign.go | 4 +- 24 files changed, 201 insertions(+), 195 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index f851338acb..e54824f41e 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -1199,7 +1199,7 @@ func checkNegativeHeight(height int64) error { return nil } -// createQueryContext creates a new sdk.Context for a query, taking as args +// CreateQueryContext creates a new sdk.Context for a query, taking as args // the block height and whether the query needs a proof or not. func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, error) { if err := checkNegativeHeight(height); err != nil { diff --git a/baseapp/options.go b/baseapp/options.go index 5acc6811db..372c2411cf 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -273,7 +273,7 @@ func (app *BaseApp) SetFauxMerkleMode() { app.fauxMerkleMode = true } -// SetNotSigverify during simulation testing, transaction signature verification needs to be ignored. +// SetNotSigverifyTx during simulation testing, transaction signature verification needs to be ignored. func (app *BaseApp) SetNotSigverifyTx() { app.sigverifyTx = false } diff --git a/baseapp/params_legacy.go b/baseapp/params_legacy.go index 13fd34add7..b8a0591dae 100644 --- a/baseapp/params_legacy.go +++ b/baseapp/params_legacy.go @@ -1,37 +1,36 @@ -/* -Deprecated. +// Deprecated: -Legacy types are defined below to aid in the migration of CometBFT consensus -parameters from use of the now deprecated x/params modules to a new dedicated -x/consensus module. +// Legacy types are defined below to aid in the migration of CometBFT consensus +// parameters from use of the now deprecated x/params modules to a new dedicated +// x/consensus module. +// +// Application developers should ensure that they implement their upgrade handler +// correctly such that app.ConsensusParamsKeeper.Set() is called with the values +// returned by GetConsensusParams(). +// +// Example: +// +// baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +// +// app.UpgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// if cp := baseapp.GetConsensusParams(ctx, baseAppLegacySS); cp != nil { +// app.ConsensusParamsKeeper.Set(ctx, cp) +// } else { +// ctx.Logger().Info("warning: consensus parameters are undefined; skipping migration", "upgrade", UpgradeName) +// } +// +// return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) +// }, +// ) +// +// Developers can also bypass the use of the legacy Params subspace and set the +// values to app.ConsensusParamsKeeper.Set() explicitly. +// +// Note, for new chains this is not necessary as CometBFT's consensus parameters +// will automatically be set for you in InitChain. -Application developers should ensure that they implement their upgrade handler -correctly such that app.ConsensusParamsKeeper.Set() is called with the values -returned by GetConsensusParams(). - -Example: - - baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) - - app.UpgradeKeeper.SetUpgradeHandler( - UpgradeName, - func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - if cp := baseapp.GetConsensusParams(ctx, baseAppLegacySS); cp != nil { - app.ConsensusParamsKeeper.Set(ctx, cp) - } else { - ctx.Logger().Info("warning: consensus parameters are undefined; skipping migration", "upgrade", UpgradeName) - } - - return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) - }, - ) - -Developers can also bypass the use of the legacy Params subspace and set the -values to app.ConsensusParamsKeeper.Set() explicitly. - -Note, for new chains this is not necessary as CometBFT's consensus parameters -will automatically be set for you in InitChain. -*/ package baseapp import ( diff --git a/client/context.go b/client/context.go index b4f8e54fe0..2d513c81b3 100644 --- a/client/context.go +++ b/client/context.go @@ -309,7 +309,7 @@ func (ctx Context) WithAux(isAux bool) Context { return ctx } -// WithLedgerHasProto returns the context with the provided boolean value, indicating +// WithLedgerHasProtobuf returns the context with the provided boolean value, indicating // whether the target Ledger application can support Protobuf payloads. func (ctx Context) WithLedgerHasProtobuf(val bool) Context { ctx.LedgerHasProtobuf = val diff --git a/client/keys/types.go b/client/keys/types.go index 1df26ed287..70fdfa6520 100644 --- a/client/keys/types.go +++ b/client/keys/types.go @@ -22,7 +22,7 @@ func NewAddNewKey(name, password, mnemonic string, account, index int) AddNewKey } } -// RecoverKeyBody recovers a key +// RecoverKey recovers a key type RecoverKey struct { Password string `json:"password"` Mnemonic string `json:"mnemonic"` diff --git a/client/rpc/block.go b/client/rpc/block.go index d1b99d7229..388741328d 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -68,7 +68,7 @@ func QueryBlocks(clientCtx client.Context, page, limit int, query, orderBy strin return result, nil } -// get block by height +// GetBlockByHeight get block by height func GetBlockByHeight(clientCtx client.Context, height *int64) (*cmt.Block, error) { // get the node node, err := clientCtx.GetNode() diff --git a/client/v2/internal/util/util.go b/client/v2/internal/util/util.go index 1ec9881422..dddb0c4202 100644 --- a/client/v2/internal/util/util.go +++ b/client/v2/internal/util/util.go @@ -17,7 +17,7 @@ import ( // later versions unsupported by the current version can be added var buildInfo, _ = debug.ReadBuildInfo() -// DescriptorName returns the name of the descriptor in kebab case. +// DescriptorKebabName returns the name of the descriptor in kebab case. func DescriptorKebabName(descriptor protoreflect.Descriptor) string { return strcase.ToKebab(string(descriptor.Name())) } diff --git a/codec/codec.go b/codec/codec.go index d26f91b356..51b8d8051b 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -59,7 +59,7 @@ type ( // MustUnmarshal calls Unmarshal and panics if error is returned. MustUnmarshal(bz []byte, ptr proto.Message) - // Unmarshal parses the data encoded with UnmarshalLengthPrefixed method and stores + // UnmarshalLengthPrefixed parses the data encoded with UnmarshalLengthPrefixed method and stores // the result in the value pointed to by v. UnmarshalLengthPrefixed(bz []byte, ptr proto.Message) error // MustUnmarshalLengthPrefixed calls UnmarshalLengthPrefixed and panics if error diff --git a/codec/types/compat.go b/codec/types/compat.go index 080ca321c7..bb4dff0bf4 100644 --- a/codec/types/compat.go +++ b/codec/types/compat.go @@ -102,7 +102,7 @@ func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { return nil } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoPacker is provided for backwards compatibility with // amino for the binary marshaling phase type AminoPacker struct { Cdc *amino.Codec @@ -123,7 +123,7 @@ func (a AminoPacker) UnpackAny(any *Any, _ interface{}) error { return err } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoJSONUnpacker is an AnyUnpacker provided for backwards compatibility with // amino for the JSON marshaling phase type AminoJSONUnpacker struct { Cdc *amino.Codec @@ -160,7 +160,7 @@ func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { return nil } -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with +// AminoJSONPacker is an AnyUnpacker provided for backwards compatibility with // amino for the JSON un-marshaling phase type AminoJSONPacker struct { Cdc *amino.Codec diff --git a/codec/unknownproto/doc.go b/codec/unknownproto/doc.go index cef3f8f253..ac8fd58da1 100644 --- a/codec/unknownproto/doc.go +++ b/codec/unknownproto/doc.go @@ -1,24 +1,22 @@ -/* -unknownproto implements functionality to "type check" protobuf serialized byte sequences -against an expected proto.Message to report: - -a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor - -b) Mismatched wire types for a field -- this is indicative of mismatched services - -Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case - - if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { - // Handle the error. - } - -and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. - -By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize -this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: - - if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { - // Handle the error. - } -*/ +// Package unknownproto implements functionality to "type check" protobuf serialized byte sequences +// against an expected proto.Message to report: +// +// a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor +// +// b) Mismatched wire types for a field -- this is indicative of mismatched services +// +// Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case +// +// if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { +// // Handle the error. +// } +// +// and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. +// +// By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize +// this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: +// +// if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { +// // Handle the error. +// } package unknownproto diff --git a/core/comet/service.go b/core/comet/service.go index 8af646e011..bc99e820f1 100644 --- a/core/comet/service.go +++ b/core/comet/service.go @@ -5,7 +5,7 @@ import ( "time" ) -// BlockInfoService is an interface that can be used to get information specific to Comet +// CometInfoService is an interface that can be used to get information specific to Comet type CometInfoService interface { GetCometInfo(context.Context) Info } @@ -50,7 +50,7 @@ type VoteInfo struct { BlockIDFlag BlockIDFlag } -// BlockIdFlag indicates which BlockID the signature is for +// BlockIDFlag indicates which BlockID the signature is for type BlockIDFlag int32 const ( diff --git a/core/store/database.go b/core/store/database.go index 551727a634..45283ee621 100644 --- a/core/store/database.go +++ b/core/store/database.go @@ -1,6 +1,6 @@ package store -// Database provides access to the underlying database for CRUD operations of non-consensus data. +// DatabaseService provides access to the underlying database for CRUD operations of non-consensus data. // WARNING: using this api will make your module unprovable for fraud and validity proofs type DatabaseService interface { GetDatabase() NonConsensusStore diff --git a/errors/doc.go b/errors/doc.go index ed6b9a69bf..f98e7932ae 100644 --- a/errors/doc.go +++ b/errors/doc.go @@ -1,33 +1,31 @@ -/* -Package errors implements custom error interfaces for cosmos-sdk. - -Error declarations should be generic and cover broad range of cases. Each -returned error instance can wrap a generic error declaration to provide more -details. - -This package provides a broad range of errors declared that fits all common -cases. If an error is very specific for an extension it can be registered outside -of the errors package. If it will be needed my many extensions, please consider -registering it in the errors package. To create a new error instance use Register -function. You must provide a unique, non zero error code and a short description, for example: - - var ErrZeroDivision = errors.Register(9241, "zero division") - -When returning an error, you can attach to it an additional context -information by using Wrap function, for example: - - func safeDiv(val, div int) (int, err) { - if div == 0 { - return 0, errors.Wrapf(ErrZeroDivision, "cannot divide %d", val) - } - return val / div, nil - } - -The first time an error instance is wrapped a stacktrace is attached as well. -Stacktrace information can be printed using %+v and %v formats. - - %s is just the error message - %+v is the full stack trace - %v appends a compressed [filename:line] where the error was created -*/ +// Package errors implements custom error interfaces for cosmos-sdk. +// +// Error declarations should be generic and cover broad range of cases. Each +// returned error instance can wrap a generic error declaration to provide more +// details. +// +// This package provides a broad range of errors declared that fits all common +// cases. If an error is very specific for an extension it can be registered outside +// of the errors package. If it will be needed my many extensions, please consider +// registering it in the errors package. To create a new error instance use Register +// function. You must provide a unique, non zero error code and a short description, for example: +// +// var ErrZeroDivision = errors.Register(9241, "zero division") +// +// When returning an error, you can attach to it an additional context +// information by using Wrap function, for example: +// +// func safeDiv(val, div int) (int, err) { +// if div == 0 { +// return 0, errors.Wrapf(ErrZeroDivision, "cannot divide %d", val) +// } +// return val / div, nil +// } +// +// The first time an error instance is wrapped a stacktrace is attached as well. +// Stacktrace information can be printed using %+v and %v formats. +// +// %s is just the error message +// %+v is the full stack trace +// %v appends a compressed [filename:line] where the error was created package errors diff --git a/runtime/events.go b/runtime/events.go index 150de335d5..956e445b42 100644 --- a/runtime/events.go +++ b/runtime/events.go @@ -50,7 +50,7 @@ func (e Events) EmitKV(eventType string, attrs ...event.Attribute) error { return nil } -// Emit emits an typed event that is defined in the protobuf file. +// EmitNonConsensus emits an typed event that is defined in the protobuf file. // In the future these events will be added to consensus. func (e Events) EmitNonConsensus(event protoiface.MessageV1) error { return e.EventManagerI.EmitTypedEvent(event) diff --git a/runtime/types.go b/runtime/types.go index 4ae2774d5b..04027d0dbc 100644 --- a/runtime/types.go +++ b/runtime/types.go @@ -10,25 +10,25 @@ import ( const ModuleName = "runtime" -// App implements the common methods for a Cosmos SDK-based application +// AppI implements the common methods for a Cosmos SDK-based application // specific blockchain. type AppI interface { - // The assigned name of the app. + // Name the assigned name of the app. Name() string - // Application updates every begin block. + // BeginBlocker updates every begin block. BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) - // Application updates every end block. + // EndBlocker updates every end block. EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) - // Application update at chain (i.e app) initialization. + // InitChainer update at chain (i.e app) initialization. InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) - // Loads the app at a given height. + // LoadHeight load the app at a given height. LoadHeight(height int64) error - // Exports the state of the application for a genesis file. + // ExportAppStateAndValidators exports the state of the application for a genesis file. ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (types.ExportedApp, error) } @@ -36,6 +36,6 @@ type AppI interface { // specific blockchain that chooses to utilize the sdk simulation framework. type AppSimI interface { AppI - // Helper for the simulation framework. + // SimulationManager helper for the simulation framework. SimulationManager() *module.SimulationManager } diff --git a/server/doc.go b/server/doc.go index 241c218259..22ba8c1675 100644 --- a/server/doc.go +++ b/server/doc.go @@ -1,30 +1,28 @@ -/* -The commands from the SDK are defined with `cobra` and configured with the -`viper` package. - -This takes place in the `InterceptConfigsPreRunHandler` function. -Since the `viper` package is used for configuration the precedence is dictated -by that package. That is - -1. Command line switches -2. Environment variables -3. Files from configuration values -4. Default values - -The global configuration instance exposed by the `viper` package is not -used by Cosmos SDK in this function. A new instance of `viper.Viper` is created -and the following is performed. The environmental variable prefix is set -to the current program name. Environmental variables consider the underscore -to be equivalent to the `.` or `-` character. This means that an configuration -value called `rpc.laddr` would be read from an environmental variable called -`MYTOOL_RPC_LADDR` if the current program name is `mytool`. - -Running the `InterceptConfigsPreRunHandler` also reads `app.toml` -and `config.toml` from the home directory under the `config` directory. -If `config.toml` or `app.toml` do not exist then those files are created -and populated with default values. `InterceptConfigsPreRunHandler` takes -two parameters to set/update a custom template to create custom `app.toml`. -If these parameters are empty, the server then creates a default template -provided by the SDK. -*/ +// Package server The commands from the SDK are defined with `cobra` and configured with the +// `viper` package. +// +// This takes place in the `InterceptConfigsPreRunHandler` function. +// Since the `viper` package is used for configuration the precedence is dictated +// by that package. That is +// +// 1. Command line switches +// 2. Environment variables +// 3. Files from configuration values +// 4. Default values +// +// The global configuration instance exposed by the `viper` package is not +// used by Cosmos SDK in this function. A new instance of `viper.Viper` is created +// and the following is performed. The environmental variable prefix is set +// to the current program name. Environmental variables consider the underscore +// to be equivalent to the `.` or `-` character. This means that an configuration +// value called `rpc.laddr` would be read from an environmental variable called +// `MYTOOL_RPC_LADDR` if the current program name is `mytool`. +// +// Running the `InterceptConfigsPreRunHandler` also reads `app.toml` +// and `config.toml` from the home directory under the `config` directory. +// If `config.toml` or `app.toml` do not exist then those files are created +// and populated with default values. `InterceptConfigsPreRunHandler` takes +// two parameters to set/update a custom template to create custom `app.toml`. +// If these parameters are empty, the server then creates a default template +// provided by the SDK. package server diff --git a/server/grpc/gogoreflection/serverreflection.go b/server/grpc/gogoreflection/serverreflection.go index 9d04abb92f..c5db746ef8 100644 --- a/server/grpc/gogoreflection/serverreflection.go +++ b/server/grpc/gogoreflection/serverreflection.go @@ -1,40 +1,35 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. -/* -Package reflection implements server reflection service. +// Package gogoreflection implements server reflection service. +// +// The service implemented is defined in: +// https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. +// +// To register server reflection on a gRPC server: +// +// import "google.golang.org/grpc/reflection" +// +// s := grpc.NewServer() +// pb.RegisterYourOwnServer(s, &server{}) +// +// // Register reflection service on gRPC server. +// reflection.Register(s) +// +// s.Serve(lis) -The service implemented is defined in: -https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. - -To register server reflection on a gRPC server: - - import "google.golang.org/grpc/reflection" - - s := grpc.NewServer() - pb.RegisterYourOwnServer(s, &server{}) - - // Register reflection service on gRPC server. - reflection.Register(s) - - s.Serve(lis) -*/ -package gogoreflection // import "google.golang.org/grpc/reflection" +package gogoreflection import ( "bytes" diff --git a/server/mock/app.go b/server/mock/app.go index f090f8c6df..5348215355 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -89,13 +89,13 @@ func KVStoreHandler(storeKey storetypes.StoreKey) bam.MsgServiceHandler { } } -// basic KV structure +// KV is a basic kv structure type KV struct { Key string `json:"key"` Value string `json:"value"` } -// What Genesis JSON is formatted as +// GenesisJSON what genesis JSON is formatted as type GenesisJSON struct { Values []KV `json:"values"` } @@ -144,7 +144,7 @@ func AppGenStateEmpty(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json. return } -// Manually write the handlers for this custom message +// MsgServer manually write the handlers for this custom message type MsgServer interface { Test(ctx context.Context, msg *KVStoreTx) (*sdk.Result, error) } diff --git a/server/mock/tx.go b/server/mock/tx.go index 151a4d5746..ab2fc6bfdb 100644 --- a/server/mock/tx.go +++ b/server/mock/tx.go @@ -16,7 +16,7 @@ import ( txsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" ) -// An sdk.Tx which is its own sdk.Msg. +// KVStoreTx is an sdk.Tx which is its own sdk.Msg. type KVStoreTx struct { key []byte value []byte @@ -72,6 +72,7 @@ func (msg *KVStoreTx) Equals(key cryptotypes.PubKey) bool { } // dummy implementation of proto.Message + func (msg *KVStoreTx) Reset() {} func (msg *KVStoreTx) String() string { return "TODO" } func (msg *KVStoreTx) ProtoMessage() {} @@ -110,7 +111,7 @@ func (msg *KVStoreTx) GetSignBytes() []byte { return msg.bytes } -// Should the app be calling this? Or only handlers? +// ValidateBasic should the app be calling this? or only handlers? func (msg *KVStoreTx) ValidateBasic() error { return nil } diff --git a/server/start.go b/server/start.go index ae64602a19..85d0fca57a 100644 --- a/server/start.go +++ b/server/start.go @@ -76,10 +76,12 @@ const ( FlagShutdownGrace = "shutdown-grace" // state sync-related flags + FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval" FlagStateSyncSnapshotKeepRecent = "state-sync.snapshot-keep-recent" // api-related flags + FlagAPIEnable = "api.enable" FlagAPISwagger = "api.swagger" FlagAPIAddress = "api.address" @@ -90,15 +92,18 @@ const ( FlagAPIEnableUnsafeCORS = "api.enabled-unsafe-cors" // gRPC-related flags + flagGRPCOnly = "grpc-only" flagGRPCEnable = "grpc.enable" flagGRPCAddress = "grpc.address" flagGRPCWebEnable = "grpc-web.enable" // mempool flags + FlagMempoolMaxTxs = "mempool.max-txs" // testnet keys + KeyIsTestnet = "is-testnet" KeyNewChainID = "new-chain-ID" KeyNewOpAddr = "new-operator-addr" diff --git a/server/types/abci.go b/server/types/abci.go index 9c298691dc..6eb922b979 100644 --- a/server/types/abci.go +++ b/server/types/abci.go @@ -10,28 +10,40 @@ import ( // to be driven by a blockchain-based replication engine via the ABCI. type ABCI interface { // Info/Query Connection - Info(*abci.RequestInfo) (*abci.ResponseInfo, error) // Return application info - Query(context.Context, *abci.RequestQuery) (*abci.ResponseQuery, error) // Query for state + + // Info returns application info + Info(*abci.RequestInfo) (*abci.ResponseInfo, error) + // Query returns application state + Query(context.Context, *abci.RequestQuery) (*abci.ResponseQuery, error) // Mempool Connection - CheckTx(*abci.RequestCheckTx) (*abci.ResponseCheckTx, error) // Validate a tx for the mempool + + // CheckTx validate a tx for the mempool + CheckTx(*abci.RequestCheckTx) (*abci.ResponseCheckTx, error) // Consensus Connection - InitChain(*abci.RequestInitChain) (*abci.ResponseInitChain, error) // Initialize blockchain w validators/other info from CometBFT + + // InitChain Initialize blockchain w validators/other info from CometBFT + InitChain(*abci.RequestInitChain) (*abci.ResponseInitChain, error) PrepareProposal(*abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) ProcessProposal(*abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) - // Deliver the decided block with its txs to the Application + // FinalizeBlock deliver the decided block with its txs to the Application FinalizeBlock(*abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) - // Create application specific vote extension + // ExtendVote create application specific vote extension ExtendVote(context.Context, *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) - // Verify application's vote extension data + // VerifyVoteExtension verify application's vote extension data VerifyVoteExtension(*abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) // Commit the state and return the application Merkle root hash Commit() (*abci.ResponseCommit, error) // State Sync Connection - ListSnapshots(*abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error) // List available snapshots - OfferSnapshot(*abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error) // Offer a snapshot to the application - LoadSnapshotChunk(*abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error) // Load a snapshot chunk - ApplySnapshotChunk(*abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error) // Apply a snapshot chunk + + // ListSnapshots list available snapshots + ListSnapshots(*abci.RequestListSnapshots) (*abci.ResponseListSnapshots, error) + // OfferSnapshot offer a snapshot to the application + OfferSnapshot(*abci.RequestOfferSnapshot) (*abci.ResponseOfferSnapshot, error) + // LoadSnapshotChunk load a snapshot chunk + LoadSnapshotChunk(*abci.RequestLoadSnapshotChunk) (*abci.ResponseLoadSnapshotChunk, error) + // ApplySnapshotChunk apply a snapshot chunk + ApplySnapshotChunk(*abci.RequestApplySnapshotChunk) (*abci.ResponseApplySnapshotChunk, error) } diff --git a/server/types/app.go b/server/types/app.go index c0b4a30309..8d73f69e13 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -56,7 +56,7 @@ type ( // CommitMultiStore return the multistore instance CommitMultiStore() storetypes.CommitMultiStore - // Return the snapshot manager + // SnapshotManager return the snapshot manager SnapshotManager() *snapshots.Manager // Close is called in start cmd to gracefully cleanup resources. diff --git a/server/util.go b/server/util.go index 54d075c406..de48b0bad3 100644 --- a/server/util.go +++ b/server/util.go @@ -44,7 +44,7 @@ import ( // a command's Context. const ServerContextKey = sdk.ContextKey("server.context") -// server context +// Context server context type Context struct { Viper *viper.Viper Config *cmtcfg.Config @@ -323,7 +323,7 @@ func interceptConfigs(rootViper *viper.Viper, customAppTemplate string, customCo return conf, nil } -// add server commands +// AddCommands add server commands func AddCommands[T types.Application](rootCmd *cobra.Command, appCreator types.AppCreator[T], addStartFlags types.ModuleInitFlags) { cometCmd := &cobra.Command{ Use: "comet", @@ -361,7 +361,7 @@ func AddTestnetCreatorCommand[T types.Application](rootCmd *cobra.Command, appCr rootCmd.AddCommand(testnetCreateCmd) } -// https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go +// ExternalIP https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go // TODO there must be a better way to get external IP func ExternalIP() (string, error) { ifaces, err := net.Interfaces() diff --git a/x/auth/migrations/legacytx/stdsign.go b/x/auth/migrations/legacytx/stdsign.go index e5a4e454cb..e8d00f6759 100644 --- a/x/auth/migrations/legacytx/stdsign.go +++ b/x/auth/migrations/legacytx/stdsign.go @@ -23,7 +23,7 @@ import ( type LegacyMsg interface { sdk.Msg - // Get the canonical byte representation of the Msg. + // GetSignBytes get the canonical byte representation of the Msg. GetSignBytes() []byte } @@ -92,7 +92,7 @@ type StdSignature struct { Signature []byte `json:"signature" yaml:"signature"` } -// Deprecated +// Deprecated: NewStdSignature returns a std signature func NewStdSignature(pk cryptotypes.PubKey, sig []byte) StdSignature { return StdSignature{PubKey: pk, Signature: sig} }