module

package
v0.0.0-...-b507993 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 14 Imported by: 1

README

Mesh security provider

Cosmos module implementation

Integrate the mesh security provider module

Prerequisites

Projects that want to integrate the meshsecurityprovider module onto their Cosmos SDK chain must enable the following modules:

Configuring and Adding Module

  1. Add the mesh security package to the go.mod and install it.

    require (
    ...
    github.com/osmosis-labs/mesh-security
    ...
    )
    
  2. Add the following modules to app.go

    import (
    ... 
        meshsecprov "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider"
        meshsecprovkeeper "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/keeper"
        meshsecprovtypes "github.com/osmosis-labs/mesh-security-sdk/x/meshsecurityprovider/types"
    ...
    )
    
  3. In app.go: Register the AppModule for the mesh security provider module.

    ModuleBasics = module.NewBasicManager(
      ...
      meshsecprov.AppModuleBasic{},
      ...
    )
    
  4. In app.go: Add mesh security provider keeper.

    type App struct {
      ...
      MeshSecProvKeeper *meshsecprovkeeper.Keeper
      ...
    }
    
  5. In app.go: Add mesh security provider store key.

    keys := sdk.NewKVStoreKeys(
      ...
      meshsecprovtypes.StoreKey,
      ...
    )
    
  6. In app.go: Instantiate mesh security provider keeper

    app.MeshSecProvKeeper = meshsecprovkeeper.NewKeeper(
    	appCodec,
    	keys[meshsecprovtypes.StoreKey],
    	authtypes.NewModuleAddress(govtypes.ModuleName).String(),
    	app.BankKeeper,
    	&app.WasmKeeper,
    	app.StakingKeeper,
    )
    
  7. In app.go: Add the mesh security provider module to the app manager instantiation.

    app.mm = module.NewManager(
        ...
        meshsecprov.NewAppModule(app.MeshSecProvKeeper)
        ...
    )
    
  8. In app.go: Add the module as the final element to the following:

  • SetOrderBeginBlockers
  • SetOrderEndBlockers
  • SetOrderInitGenesis
    // Add mesh security to begin blocker logic
    app.moduleManager.SetOrderBeginBlockers(
      ...
      meshsecprovtypes.ModuleName,
      ...
    )
    
    // Add mesh security to end blocker logic
    app.moduleManager.SetOrderEndBlockers(
      ...
      meshsecprovtypes.ModuleName,
      ...
    )
    
    // Add mesh security to init genesis logic
    app.moduleManager.SetOrderInitGenesis(
      ...
      meshsecprovtypes.ModuleName,
      ...
    )
    
  1. In app.go: Add the mesh security wasm message handler decorator to the wasm module.
    meshMessageHandler := wasmkeeper.WithMessageHandlerDecorator(func(nested wasmkeeper.Messenger) wasmkeeper.Messenger {
    	return wasmkeeper.NewMessageHandlerChain(
    		meshsecprovkeeper.CustomMessageDecorator(app.MeshSecProvKeeper),
    		nested,
    	)
    })
    wasmOpts = append(wasmOpts, meshMessageHandler)
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

func NewAppModule

func NewAppModule(moduleKeeper *keeper.Keeper) AppModule

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)

BeginBlock performs TODO.

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion implements AppModule/ConsensusVersion.

func (AppModule) EndBlock

EndBlock performs TODO.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the meshsecurity provider. module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the meshsecurity provider module. no validator updates.

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the meshsecurity provider module's querier route name.

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

type AppModuleBasic

type AppModuleBasic struct{}

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

func (AppModuleBasic) GetQueryCmd

func (b AppModuleBasic) GetQueryCmd() *cobra.Command

func (AppModuleBasic) GetTxCmd

func (b AppModuleBasic) GetTxCmd() *cobra.Command

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (b AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

--------------------------------------- Interfaces.

func (AppModuleBasic) RegisterInterfaces

func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers interfaces and implementations of the meshsecurity provider module.

func (AppModuleBasic) RegisterLegacyAminoCodec

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the meshsecurity provider module.

Directories

Path Synopsis
client
cli
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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