app

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 147 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTerpInstanceCost is initially set the same as in wasmd
	DefaultTerpInstanceCost uint64 = 60_000
	// DefaultTerpCompileCost set to a large number for testing
	DefaultTerpCompileCost uint64 = 3
)

Variables

View Source
var (
	NodeDir      = ".terp"
	Bech32Prefix = "terp"

	// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
	// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
	ProposalsEnabled = "true"
	// If set to non-empty string it must be comma-separated list of values that are all a subset
	// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
	// https://github.com/terpnetwork/terp-core/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
	EnableSpecificProposals = ""

	Upgrades = []upgrades.Upgrade{
		v2.Upgrade,
		v3.Upgrade,

		v4_1.Upgrade,
	}
)

We pull these out so we can set them with LDFLAGS in the Makefile

View Source
var (
	// DefaultNodeHome default home directories for terpd
	DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = Bech32Prefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

These constants are derived from the above variables. These are the ones we will want to use in the code, based on any overrides above

View Source
var DefaultConsensusParams = &tmproto.ConsensusParams{
	Block: &tmproto.BlockParams{
		MaxBytes: 200000,
		MaxGas:   2000000,
	},
	Evidence: &tmproto.EvidenceParams{
		MaxAgeNumBlocks: 302400,
		MaxAgeDuration:  504 * time.Hour,
		MaxBytes:        10000,
	},
	Validator: &tmproto.ValidatorParams{
		PubKeyTypes: []string{
			tmtypes.ABCIPubKeyTypeEd25519,
		},
	},
}

DefaultConsensusParams defines the default Tendermint consensus params used in terpApp testing.

ModuleBasics defines the module BasicManager is in charge of setting up basic, non-dependant module elements, such as codec registration and genesis verification.

Functions

func ExecuteRawCustom

func ExecuteRawCustom(t *testing.T, ctx sdk.Context, app *TerpApp, contract sdk.AccAddress, sender sdk.AccAddress, msg json.RawMessage, funds sdk.Coin) error

func GetDefaultBypassFeeMessages

func GetDefaultBypassFeeMessages() []string

func GetWasmOpts

func GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option

func MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates a new EncodingConfig with all modules registered

func NewAnteHandler

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)

func NewTerpWasmGasRegister

func NewTerpWasmGasRegister() wasmtypes.WasmGasRegister

func RandomAccountAddress

func RandomAccountAddress() sdk.AccAddress

func SetAddressPrefixes

func SetAddressPrefixes()

SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.

func TerpGasRegisterConfig

func TerpGasRegisterConfig() wasmtypes.WasmGasRegisterConfig

TerpGasRegisterConfig is defaults plus a custom compile amount

Types

type EmptyAppOptions

type EmptyAppOptions struct{}

func (EmptyAppOptions) Get

func (EmptyAppOptions) Get(_ string) interface{}

type EmptyBaseAppOptions

type EmptyBaseAppOptions struct{}

EmptyBaseAppOptions is a stub implementing AppOptions

func (EmptyBaseAppOptions) Get

func (ao EmptyBaseAppOptions) Get(_ string) interface{}

Get implements AppOptions

type GenesisState

type GenesisState map[string]json.RawMessage

GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type HandlerOptions

type HandlerOptions struct {
	ante.HandlerOptions

	GovKeeper         govkeeper.Keeper
	IBCKeeper         *keeper.Keeper
	FeeShareKeeper    feesharekeeper.Keeper
	BankKeeperFork    feeshareante.BankKeeper
	WasmConfig        *wasmTypes.WasmConfig
	TXCounterStoreKey storetypes.StoreKey
	Cdc               codec.BinaryCodec

	BypassMinFeeMsgTypes []string

	GlobalFeeKeeper globalfeekeeper.Keeper
	StakingKeeper   stakingkeeper.Keeper

	TxEncoder sdk.TxEncoder
}

HandlerOptions extend the SDK's AnteHandler options by requiring the IBC channel keeper.

type TerpApp

type TerpApp struct {
	*baseapp.BaseApp

	AppKeepers keepers.AppKeepers

	// the module manager
	ModuleManager *module.Manager
	// contains filtered or unexported fields
}

TerpApp extended ABCI application

func NewTerpApp

func NewTerpApp(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	appOpts servertypes.AppOptions,
	wasmOpts []wasmkeeper.Option,
	baseAppOptions ...func(*baseapp.BaseApp),
) *TerpApp

NewTerpApp returns a reference to an initialized TerpApp.

func Setup

func Setup(t *testing.T) *TerpApp

func SetupWithGenesisValSet

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *TerpApp

SetupWithGenesisValSet initializes a new terpApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit in the default token of the TerpApp from first genesis account. A Nop logger is set in TerpApp.

func (*TerpApp) AppCodec

func (app *TerpApp) AppCodec() codec.Codec

AppCodec returns app codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*TerpApp) BeginBlocker

func (app *TerpApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlocker application updates every begin block

func (*TerpApp) ChainID

func (app *TerpApp) ChainID() string

ChainID gets chainID from private fields of BaseApp Should be removed once SDK 0.50.x will be adopted

func (*TerpApp) Configurator

func (app *TerpApp) Configurator() module.Configurator

func (*TerpApp) EndBlocker

func (app *TerpApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

EndBlocker application updates every end block

func (*TerpApp) ExportAppStateAndValidators

func (app *TerpApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)

ExportAppStateAndValidators exports the state of the application for a genesis file.

func (*TerpApp) GetChainBondDenom

func (app *TerpApp) GetChainBondDenom() string

func (*TerpApp) GetSubspace

func (app *TerpApp) GetSubspace(moduleName string) paramstypes.Subspace

GetSubspace returns a param subspace for a given module name.

NOTE: This is solely to be used for testing purposes.

func (*TerpApp) InitChainer

func (app *TerpApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

InitChainer application update at chain initialization

func (*TerpApp) InterfaceRegistry

func (app *TerpApp) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns TerpApp's InterfaceRegistry

func (*TerpApp) LegacyAmino

func (app *TerpApp) LegacyAmino() *codec.LegacyAmino

LegacyAmino returns legacy amino codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*TerpApp) LoadHeight

func (app *TerpApp) LoadHeight(height int64) error

LoadHeight loads a particular height

func (*TerpApp) ModuleAccountAddrs

func (app *TerpApp) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func (*TerpApp) Name

func (app *TerpApp) Name() string

Name returns the name of the App

func (*TerpApp) RegisterAPIRoutes

func (app *TerpApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)

RegisterAPIRoutes registers all application module routes with the provided API server.

func (*TerpApp) RegisterNodeService

func (app *TerpApp) RegisterNodeService(clientCtx client.Context)

func (*TerpApp) RegisterTendermintService

func (app *TerpApp) RegisterTendermintService(clientCtx client.Context)

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*TerpApp) RegisterTxService

func (app *TerpApp) RegisterTxService(clientCtx client.Context)

RegisterTxService implements the Application.RegisterTxService method.

func (*TerpApp) SimulationManager

func (app *TerpApp) SimulationManager() *module.SimulationManager

SimulationManager implements the SimulationApp interface

Directories

Path Synopsis
Package params defines the simulation parameters in the gaia.
Package params defines the simulation parameters in the gaia.
v2
v3
v4

Jump to

Keyboard shortcuts

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