Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteRawCustom(t *testing.T, ctx sdk.Context, app *App, contract sdk.AccAddress, ...) error
- func GetDefaultBypassFeeMessages() []string
- func GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option
- func JunoGasRegisterConfig() wasmtypes.WasmGasRegisterConfig
- func MakeEncodingConfig() params.EncodingConfig
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewJunoWasmGasRegister() wasmtypes.WasmGasRegister
- func RandomAccountAddress() sdk.AccAddress
- func SetAddressPrefixes()
- type App
- func (app *App) AppCodec() codec.Codec
- func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *App) ChainID() string
- func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
- func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *App) GetChainBondDenom() string
- func (app *App) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
- func (app *App) InterfaceRegistry() types.InterfaceRegistry
- func (app *App) LegacyAmino() *codec.LegacyAmino
- func (app *App) LoadHeight(height int64) error
- func (app *App) ModuleAccountAddrs() map[string]bool
- func (app *App) Name() string
- func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig)
- func (app *App) RegisterNodeService(clientCtx client.Context)
- func (app *App) RegisterTendermintService(clientCtx client.Context)
- func (app *App) RegisterTxService(clientCtx client.Context)
- func (app *App) SetCheckTx(handler pobabci.CheckTx)
- func (app *App) SimulationManager() *module.SimulationManager
- type EmptyAppOptions
- type EmptyBaseAppOptions
- type GenesisState
- type HandlerOptions
Constants ¶
const ( AccountAddressPrefix = "juno" Name = "juno" )
const ( // DefaultJunoInstanceCost is initially set the same as in wasmd DefaultJunoInstanceCost uint64 = 60_000 // DefaultJunoCompileCost set to a large number for testing DefaultJunoCompileCost uint64 = 3 )
const (
SimAppChainID = "testing"
)
SimAppChainID hardcoded chainID for simulation
Variables ¶
var ( NodeDir = ".juno" Bech32Prefix = "juno" // 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/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" Upgrades = []upgrades.Upgrade{ testnetV18alpha2.Upgrade, testnetV18alpha3.Upgrade, testnetV18alpha4.Upgrade, testnetV19alpha3.Upgrade, testnetV21alpha1.Upgrade, testnetV22alpha1.Upgrade, testnetV23alpha1.Upgrade, v10.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade, v18.Upgrade, v19.Upgrade, v21.Upgrade, v22.Upgrade, v23.Upgrade, v24.Upgrade, v25.Upgrade, } )
We pull these out so we can set them with LDFLAGS in the Makefile
var ( // DefaultNodeHome default home directories for Juno 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 junoApp 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{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, nftmodule.AppModuleBasic{}, consensus.AppModuleBasic{}, buildermodule.AppModuleBasic{}, wasm.AppModuleBasic{}, ibc.AppModuleBasic{}, ibctm.AppModuleBasic{}, transfer.AppModuleBasic{}, ica.AppModuleBasic{}, ibcfee.AppModuleBasic{}, icq.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, tokenfactory.AppModuleBasic{}, drip.AppModuleBasic{}, feepay.AppModuleBasic{}, feeshare.AppModuleBasic{}, globalfee.AppModuleBasic{}, ibc_hooks.AppModuleBasic{}, packetforward.AppModuleBasic{}, clock.AppModuleBasic{}, cwhooks.AppModuleBasic{}, wasmlc.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 *App, 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 JunoGasRegisterConfig ¶
func JunoGasRegisterConfig() wasmtypes.WasmGasRegisterConfig
JunoGasRegisterConfig is defaults plus a custom compile amount
func MakeEncodingConfig ¶
func MakeEncodingConfig() params.EncodingConfig
MakeEncodingConfig creates an EncodingConfig for testing
func NewAnteHandler ¶
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.
func NewJunoWasmGasRegister ¶
func NewJunoWasmGasRegister() 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.
Types ¶
type App ¶
type App struct { *baseapp.BaseApp AppKeepers keepers.AppKeepers // the module manager ModuleManager *module.Manager // contains filtered or unexported fields }
App extends an ABCI application, but with most of its parameters exported. They are exported for convenience in creating helper functions, as object capabilities aren't needed for testing.
func New ¶
func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *App
New returns a reference to an initialized Juno.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *App
SetupWithGenesisValSet initializes a new junoApp 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 JunoApp from first genesis account. A Nop logger is set in JunoApp.
func (*App) AppCodec ¶
AppCodec returns Juno's 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 (*App) BeginBlocker ¶
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*App) ChainID ¶
ChainID gets chainID from private fields of BaseApp Should be removed once SDK 0.50.x will be adopted
func (*App) CheckTx ¶
func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
CheckTx will check the transaction with the provided checkTxHandler. We override the default handler so that we can verify bid transactions before they are inserted into the mempool. With the POB CheckTx, we can verify the bid transaction and all of the bundled transactions before inserting the bid transaction into the mempool.
func (*App) EndBlocker ¶
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*App) ExportAppStateAndValidators ¶
func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*App) GetChainBondDenom ¶
func (*App) GetSubspace ¶
func (app *App) 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 (*App) InitChainer ¶
func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain
InitChainer application update at chain initialization
func (*App) InterfaceRegistry ¶
func (app *App) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns Juno's InterfaceRegistry
func (*App) LegacyAmino ¶
func (app *App) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns SimApp's 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 (*App) LoadHeight ¶
LoadHeight loads a particular height
func (*App) ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func (*App) RegisterAPIRoutes ¶
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*App) RegisterNodeService ¶
func (*App) RegisterTendermintService ¶
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*App) RegisterTxService ¶
RegisterTxService implements the Application.RegisterTxService method.
func (*App) SetCheckTx ¶
SetCheckTx sets the checkTxHandler for the app.
func (*App) SimulationManager ¶
func (app *App) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface
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
The genesis state 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 *ibckeeper.Keeper FeePayKeeper feepaykeeper.Keeper BankKeeper bankkeeper.Keeper TxCounterStoreKey storetypes.StoreKey WasmConfig wasmtypes.WasmConfig Cdc codec.BinaryCodec BypassMinFeeMsgTypes []string GlobalFeeKeeper globalfeekeeper.Keeper StakingKeeper stakingkeeper.Keeper BuilderKeeper builderkeeper.Keeper TxEncoder sdk.TxEncoder Mempool builderante.Mempool BondDenom string }
HandlerOptions extends the SDK's AnteHandler options by requiring the IBC channel keeper and a BankKeeper with an added method for fee sharing.