docs: update docs (#19676)
Co-authored-by: son trinh <son@decentrio.ventures> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
parent
2bf7e9f846
commit
2bfc037a07
@ -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 {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"`
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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()))
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user