Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteRawCustom(t *testing.T, ctx sdk.Context, app *TerpApp, contract sdk.AccAddress, ...) error
- func GetDefaultBypassFeeMessages() []string
- func GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option
- func MakeEncodingConfig() params.EncodingConfig
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewTerpWasmGasRegister() wasmtypes.WasmGasRegister
- func RandomAccountAddress() sdk.AccAddress
- func SetAddressPrefixes()
- func TerpGasRegisterConfig() wasmtypes.WasmGasRegisterConfig
- type EmptyAppOptions
- type EmptyBaseAppOptions
- type GenesisState
- type HandlerOptions
- type TerpApp
- func (app *TerpApp) AppCodec() codec.Codec
- func (app *TerpApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *TerpApp) ChainID() string
- func (app *TerpApp) Configurator() module.Configurator
- func (app *TerpApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *TerpApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *TerpApp) GetChainBondDenom() string
- func (app *TerpApp) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *TerpApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *TerpApp) InterfaceRegistry() types.InterfaceRegistry
- func (app *TerpApp) LegacyAmino() *codec.LegacyAmino
- func (app *TerpApp) LoadHeight(height int64) error
- func (app *TerpApp) ModuleAccountAddrs() map[string]bool
- func (app *TerpApp) Name() string
- func (app *TerpApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *TerpApp) RegisterNodeService(clientCtx client.Context)
- func (app *TerpApp) RegisterTendermintService(clientCtx client.Context)
- func (app *TerpApp) RegisterTxService(clientCtx client.Context)
- func (app *TerpApp) SimulationManager() *module.SimulationManager
Constants ¶
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 )
const (
MockFeePort string = ibcmock.ModuleName + ibcfeetypes.ModuleName
)
Variables ¶
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
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
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.
var ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic(getGovProposalHandlers()), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, groupmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, nftmodule.AppModuleBasic{}, consensus.AppModuleBasic{}, wasm.AppModuleBasic{}, ibc.AppModuleBasic{}, ibctm.AppModuleBasic{}, transfer.AppModuleBasic{}, ica.AppModuleBasic{}, ibcfee.AppModuleBasic{}, icq.AppModuleBasic{}, ibchooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, feeshare.AppModuleBasic{}, globalfee.AppModuleBasic{}, clock.AppModuleBasic{}, drip.AppModuleBasic{}, tokenfactory.AppModuleBasic{}, )
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 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 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 ¶
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 ¶
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 (*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 ¶
LoadHeight loads a particular height
func (*TerpApp) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*TerpApp) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*TerpApp) RegisterNodeService ¶
func (*TerpApp) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*TerpApp) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*TerpApp) SimulationManager ¶
func (app *TerpApp) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface