Documentation ¶
Index ¶
- func ChainedCustomQuerier(k viewKeeper, stk stakingKeeper, slk slashingKeeper, ...) wasmkeeper.WasmVMQueryHandler
- func ConvertSdkValidatorToWasm(v stakingtypes.Validator) wasmvmtypes.Validator
- func FetchAllStoredOperations(t *testing.T, ctx sdk.Context, msKeeper *Keeper) map[string][]types.PipedValsetOperation
- func MinValidatorFixture(t *testing.T) stakingtypes.Validator
- func ModuleLogger(ctx sdk.Context) log.Logger
- func NewIntegrityHandler(k maxCapSource) wasmkeeper.MessageHandlerFunc
- func NewMsgServer(k *Keeper) *msgServer
- func NewQuerier(cdc codec.Codec, k *Keeper) *querier
- func NewQueryDecorator(k viewKeeper, stk stakingKeeper, slk slashingKeeper) func(wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
- type AuthSource
- type AuthSourceFn
- type BankKeeperAdapter
- type CustomMsgHandler
- type ExecResult
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
- type Keeper
- func (k Keeper) ClearPipedValsetOperations(ctx sdk.Context)
- func (k Keeper) ClearTombstonedStatus(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) Delegate(pCtx sdk.Context, actor sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Coin) (sdk.Dec, error)
- func (k Keeper) DeleteAllScheduledTasks(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress) error
- func (k Keeper) ExecScheduledTasks(pCtx sdk.Context, tp types.SchedulerTaskType, epochLength uint64, cb executor) ([]ExecResult, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllDelegations(ctx sdk.Context, actor sdk.AccAddress, maxRetrieve uint32) (delegations []types.Delegation)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetDelegation(ctx sdk.Context, actor, delAddr sdk.AccAddress, valAddr sdk.ValAddress) types.Delegation
- func (k Keeper) GetMaxCapLimit(ctx sdk.Context, actor sdk.AccAddress) sdk.Coin
- func (k Keeper) GetMaxSudoGas(ctx sdk.Context) sdk.Gas
- func (k Keeper) GetNextScheduledTaskHeight(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress) (height uint64, found bool)
- func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params)
- func (k Keeper) GetRebalanceEpochLength(ctx sdk.Context) uint64
- func (k Keeper) GetTotalContractsMaxCap(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetTotalDelegated(ctx sdk.Context, actor sdk.AccAddress) sdk.Coin
- func (k Keeper) HasMaxCapLimit(ctx sdk.Context, actor sdk.AccAddress) bool
- func (k Keeper) HasScheduledTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, ...) bool
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
- func (k Keeper) IsTombstonedStatus(ctx sdk.Context, valAddr sdk.ValAddress) bool
- func (k Keeper) IterateMaxCapLimit(ctx sdk.Context, cb func(sdk.AccAddress, math.Int) bool)
- func (k Keeper) IterateScheduledTasks(ctx sdk.Context, tp types.SchedulerTaskType, maxHeight uint64, ...) error
- func (k Keeper) ScheduleBonded(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) ScheduleJailed(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) ScheduleModified(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) ScheduleOneShotTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, ...) error
- func (k Keeper) ScheduleRegularHandleEpochTask(ctx sdk.Context, contract sdk.AccAddress) error
- func (k Keeper) ScheduleRepeatingTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, ...) error
- func (k Keeper) ScheduleSlashed(ctx sdk.Context, addr sdk.ValAddress, power int64, height int64, ...) error
- func (k Keeper) ScheduleTombstoned(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) ScheduleUnbonded(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) ScheduleUnjailed(ctx sdk.Context, addr sdk.ValAddress) error
- func (k Keeper) SendHandleEpoch(ctx sdk.Context, contractAddr sdk.AccAddress) error
- func (k Keeper) SendValsetUpdate(ctx sdk.Context, contractAddr sdk.AccAddress, v contract.HandleValsetUpdate) error
- func (k Keeper) SetMaxCapLimit(ctx sdk.Context, contract sdk.AccAddress, newAmount sdk.Coin) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetTombstonedStatus(ctx sdk.Context, valAddr sdk.ValAddress)
- func (k Keeper) Undelegate(pCtx sdk.Context, actor sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Coin) error
- func (k Keeper) UpdateDelegation(pCtx sdk.Context, actor, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...)
- func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (outmessage.HandleValsetUpdate, error)
- type MockWasmKeeper
- type Option
- type QueryHandlerFn
- type SlashingKeeperDecorator
- type StakingDecorator
- func (s StakingDecorator) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)
- func (s StakingDecorator) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, ...) math.Int
- func (s StakingDecorator) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, ...) math.Int
- func (s StakingDecorator) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)
- type StakingHooks
- type StakingKeeperAdapter
- type TestKeepers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainedCustomQuerier ¶
func ChainedCustomQuerier(k viewKeeper, stk stakingKeeper, slk slashingKeeper, next wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
ChainedCustomQuerier implements the mesh-security custom query handler. The given WasmVMQueryHandler is receiving all unhandled queries and must therefore not be nil.
This CustomQuerier is designed as an extension point. See the NewQueryDecorator impl how to set this up for wasmd.
func ConvertSdkValidatorToWasm ¶
func ConvertSdkValidatorToWasm(v stakingtypes.Validator) wasmvmtypes.Validator
ConvertSdkValidatorToWasm helper method
func FetchAllStoredOperations ¶
func FetchAllStoredOperations(t *testing.T, ctx sdk.Context, msKeeper *Keeper) map[string][]types.PipedValsetOperation
FetchAllStoredOperations load all ops from temp db
func MinValidatorFixture ¶
func MinValidatorFixture(t *testing.T) stakingtypes.Validator
MinValidatorFixture creates minimal sdk validator object
func ModuleLogger ¶
ModuleLogger returns logger with module attribute
func NewIntegrityHandler ¶
func NewIntegrityHandler(k maxCapSource) wasmkeeper.MessageHandlerFunc
NewIntegrityHandler prevents any contract with max cap set to use staking or stargate messages. This ensures that staked "virtual" tokens are not bypassing the instant undelegate and burn mechanism provided by mesh-security.
This handler should be chained before any other.
func NewQueryDecorator ¶
func NewQueryDecorator(k viewKeeper, stk stakingKeeper, slk slashingKeeper) func(wasmkeeper.WasmVMQueryHandler) wasmkeeper.WasmVMQueryHandler
NewQueryDecorator constructor to build a chained custom querier. The mesh-security custom query handler is placed at the first position and delegates to the next in chain for any queries that do not match the mesh-security custom query namespace.
To be used with `wasmkeeper.WithQueryHandlerDecorator(meshseckeeper.NewQueryDecorator(app.MeshSecKeeper)))`
Types ¶
type AuthSource ¶
type AuthSource interface { // IsAuthorized returns if the contract authorized to execute a virtual stake message IsAuthorized(ctx sdk.Context, contractAddr sdk.AccAddress) bool }
AuthSource abstract type that provides contract authorization. This is an extension point for custom implementations.
type AuthSourceFn ¶
type AuthSourceFn func(ctx sdk.Context, contractAddr sdk.AccAddress) bool
AuthSourceFn is helper for simple AuthSource types
func (AuthSourceFn) IsAuthorized ¶
func (a AuthSourceFn) IsAuthorized(ctx sdk.Context, contractAddr sdk.AccAddress) bool
IsAuthorized returns if the contract authorized to execute a virtual stake message
type BankKeeperAdapter ¶
type BankKeeperAdapter struct {
types.SDKBankKeeper
}
BankKeeperAdapter adapter to vanilla SDK bank keeper
func NewBankKeeperAdapter ¶
func NewBankKeeperAdapter(k types.SDKBankKeeper) *BankKeeperAdapter
NewBankKeeperAdapter constructor
func (BankKeeperAdapter) AddSupplyOffset ¶
AddSupplyOffset noop
type CustomMsgHandler ¶
type CustomMsgHandler struct {
// contains filtered or unexported fields
}
func NewCustomMsgHandler ¶
func NewCustomMsgHandler(k msKeeper, auth AuthSource) *CustomMsgHandler
NewCustomMsgHandler constructor to set up CustomMsgHandler with an individual auth source. This is an extension point for non default contract authorization logic.
func NewDefaultCustomMsgHandler ¶
func NewDefaultCustomMsgHandler(k *Keeper) *CustomMsgHandler
NewDefaultCustomMsgHandler constructor to set up the CustomMsgHandler with default max cap authorization
func (CustomMsgHandler) DispatchMsg ¶
func (h CustomMsgHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error)
DispatchMsg handle contract message of type Custom in the mesh-security namespace
type ExecResult ¶
type ExecResult struct { Contract sdk.AccAddress ExecErr error RescheduleErr error DeleteTaskErr error GasUsed sdk.Gas GasLimit sdk.Gas NextRunHeight uint64 }
ExecResult are the results of a task execution
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for slashing keeper
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
AfterDelegationModified noop
func (Hooks) AfterUnbondingInitiated ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
AfterValidatorCreated noop
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
AfterValidatorRemoved noop
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
BeforeDelegationCreated noop
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
BeforeDelegationRemoved noop
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
BeforeDelegationSharesModified noop
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct { Staking types.XStakingKeeper // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, storeKey storetypes.StoreKey, memoryStoreKey storetypes.StoreKey, bank types.SDKBankKeeper, staking types.SDKStakingKeeper, wasm types.WasmKeeper, authority string, opts ...Option, ) *Keeper
NewKeeper constructor with vanilla sdk keepers
func NewKeeperX ¶
func NewKeeperX( cdc codec.Codec, storeKey storetypes.StoreKey, memoryStoreKey storetypes.StoreKey, bank types.XBankKeeper, staking types.XStakingKeeper, wasm types.WasmKeeper, authority string, opts ...Option, ) *Keeper
NewKeeperX constructor with extended Osmosis SDK keepers
func (Keeper) ClearPipedValsetOperations ¶
ClearPipedValsetOperations delete all entries from the temporary store that contains the valset updates.
func (Keeper) ClearTombstonedStatus ¶
func (k Keeper) ClearTombstonedStatus(ctx sdk.Context, valAddr sdk.ValAddress)
ClearTombstonedStatus delete all entries from the temporary store that contains the validator status.
func (Keeper) Delegate ¶
func (k Keeper) Delegate(pCtx sdk.Context, actor sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Coin) (sdk.Dec, error)
Delegate mints new "virtual" bonding tokens and delegates them to the given validator. The amount minted is removed from the SupplyOffset (so that it will become negative), when supported. Authorization of the actor should be handled before entering this method.
func (Keeper) DeleteAllScheduledTasks ¶
func (k Keeper) DeleteAllScheduledTasks(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress) error
DeleteAllScheduledTasks deletes all tasks of given type for the contract.
func (Keeper) ExecScheduledTasks ¶
func (k Keeper) ExecScheduledTasks(pCtx sdk.Context, tp types.SchedulerTaskType, epochLength uint64, cb executor) ([]ExecResult, error)
ExecScheduledTasks execute scheduled task at current height The executor function is called within the scope of a new cached store. Any failure on execution reverts the state of this sub call. Rescheduling or other state changes due to the scheduler provisioning are not affected. The result type contains more details information of execution or provisioning errors. The given epoch length is used for re-scheduling the task, when set on the task and value >0
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
func (Keeper) GetAllDelegations ¶
func (k Keeper) GetAllDelegations(ctx sdk.Context, actor sdk.AccAddress, maxRetrieve uint32) (delegations []types.Delegation)
GetAllDelegations returns all delegations for a specific contract
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetDelegation ¶
func (k Keeper) GetDelegation(ctx sdk.Context, actor, delAddr sdk.AccAddress, valAddr sdk.ValAddress) types.Delegation
GetDelegation returns contract delegation for a specified delegator bond with validator.
func (Keeper) GetMaxCapLimit ¶
GetMaxCapLimit the cap limit is set per consumer contract. Different providers can have different limits Returns zero amount when no limit is stored.
func (Keeper) GetNextScheduledTaskHeight ¶
func (k Keeper) GetNextScheduledTaskHeight(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress) (height uint64, found bool)
GetNextScheduledTaskHeight returns height for task to execute
func (Keeper) GetRebalanceEpochLength ¶
func (Keeper) GetTotalContractsMaxCap ¶
func (Keeper) GetTotalDelegated ¶
GetTotalDelegated returns the total amount delegated by the given consumer contract. This amount can be 0 is never negative.
func (Keeper) HasMaxCapLimit ¶
HasMaxCapLimit returns true when any max cap limit was set. The amount is not taken into account for the result. A 0 value would be true as well.
func (Keeper) HasScheduledTask ¶
func (k Keeper) HasScheduledTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, repeat bool) bool
HasScheduledTask returns true if the contract has a task scheduled of the given type and repeat setting
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
func (Keeper) IsTombstonedStatus ¶
IsTombstonedStatus returns whether validator is tombstoned or not
func (Keeper) IterateMaxCapLimit ¶
IterateMaxCapLimit iterate over contract addresses with max cap limit set Callback can return true to stop early
func (Keeper) IterateScheduledTasks ¶
func (k Keeper) IterateScheduledTasks(ctx sdk.Context, tp types.SchedulerTaskType, maxHeight uint64, cb func(addr sdk.AccAddress, height uint64, repeat bool) bool) error
IterateScheduledTasks iterate of all scheduled task executions for the given type up to given block height (included)
func (Keeper) ScheduleBonded ¶
ScheduleBonded store a validator update to bonded status for the valset update report
func (Keeper) ScheduleJailed ¶
ScheduleJailed store a validator update to jailed status for the valset update report
func (Keeper) ScheduleModified ¶
ScheduleModified store a validator metadata update for the valset update report
func (Keeper) ScheduleOneShotTask ¶
func (k Keeper) ScheduleOneShotTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, execBlockHeight uint64) error
ScheduleOneShotTask register a new task to be executed at given block height. The task is not repeating and registered only once for a given contract and height. Duplicates are silently ignored
func (Keeper) ScheduleRegularHandleEpochTask ¶
ScheduleRegularHandleEpochTask schedule a handle epoch task for the given virtual staking contract using params defined epoch length
func (Keeper) ScheduleRepeatingTask ¶
func (k Keeper) ScheduleRepeatingTask(ctx sdk.Context, tp types.SchedulerTaskType, contract sdk.AccAddress, execBlockHeight uint64) error
ScheduleRepeatingTask register a recurring task to be executed at given block height. Duplicates are overwritten
func (Keeper) ScheduleSlashed ¶
func (k Keeper) ScheduleSlashed(ctx sdk.Context, addr sdk.ValAddress, power int64, height int64, totalSlashAmount math.Int, slashRatio sdk.Dec) error
ScheduleSlashed store a validator slash event / data for the valset update report
func (Keeper) ScheduleTombstoned ¶
ScheduleTombstoned store a validator update to tombstoned status for the valset update report
func (Keeper) ScheduleUnbonded ¶
ScheduleUnbonded store a validator update to unbonded status for the valset update report
func (Keeper) ScheduleUnjailed ¶
ScheduleUnjailed store a validator update to unjailed status for the valset update report
func (Keeper) SendHandleEpoch ¶
SendHandleEpoch send epoch handling message to virtual staking contract via sudo
func (Keeper) SendValsetUpdate ¶
func (k Keeper) SendValsetUpdate(ctx sdk.Context, contractAddr sdk.AccAddress, v contract.HandleValsetUpdate) error
SendValsetUpdate submit the valset update report to the virtual staking contract via sudo
func (Keeper) SetMaxCapLimit ¶
SetMaxCapLimit stores the max cap limit for the given contract address. Any existing limit for this contract will be overwritten
func (Keeper) SetTombstonedStatus ¶
func (k Keeper) SetTombstonedStatus(ctx sdk.Context, valAddr sdk.ValAddress)
SetTombstonedStatus sets Tombstoned status for the given validator address in the provided store.
func (Keeper) Undelegate ¶
func (k Keeper) Undelegate(pCtx sdk.Context, actor sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Coin) error
Undelegate executes an instant undelegate and burns the released virtual staking tokens. The amount burned is added to the (negative) SupplyOffset, when supported. Authorization of the actor should be handled before entering this method.
func (Keeper) UpdateDelegation ¶
func (k Keeper) UpdateDelegation(pCtx sdk.Context, actor, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdk.Coin, isDeduct bool)
func (Keeper) ValsetUpdateReport ¶
func (k Keeper) ValsetUpdateReport(ctx sdk.Context) (outmessage.HandleValsetUpdate, error)
ValsetUpdateReport aggregate all stored changes of the current block. Should be called by an end-blocker. The events reported are categorized by type and not time. Conflicting events as Bonded/ Unbonded are not supposed to happen within the same block
type MockWasmKeeper ¶
type MockWasmKeeper struct { SudoFn func(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) HasContractInfoFn func(ctx sdk.Context, contractAddress sdk.AccAddress) bool }
func (MockWasmKeeper) HasContractInfo ¶
func (m MockWasmKeeper) HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool
func (MockWasmKeeper) Sudo ¶
func (m MockWasmKeeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an extension point to instantiate keeper with non default values
func WithWasmKeeperDecorated ¶
func WithWasmKeeperDecorated(cb func(types.WasmKeeper) types.WasmKeeper) Option
WithWasmKeeperDecorated can set a decorator to the wasm keeper
type QueryHandlerFn ¶
type QueryHandlerFn func(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)
QueryHandlerFn helper type that implements wasmkeeper.WasmVMQueryHandler
func (QueryHandlerFn) HandleQuery ¶
func (q QueryHandlerFn) HandleQuery(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error)
HandleQuery handles contract query
type SlashingKeeperDecorator ¶
type SlashingKeeperDecorator struct { evidencetypes.SlashingKeeper // contains filtered or unexported fields }
SlashingKeeperDecorator to capture tombstone events
func CaptureTombstoneDecorator ¶
func CaptureTombstoneDecorator(k *Keeper, slashingKeeper evidencetypes.SlashingKeeper, stakingKeeper types.SDKStakingKeeper) *SlashingKeeperDecorator
CaptureTombstoneDecorator constructor
func (SlashingKeeperDecorator) Tombstone ¶
func (e SlashingKeeperDecorator) Tombstone(ctx sdk.Context, address sdk.ConsAddress)
Tombstone is executed in the end-blocker by the evidence module
type StakingDecorator ¶
type StakingDecorator struct { slashingtypes.StakingKeeper // contains filtered or unexported fields }
StakingDecorator decorate vanilla staking keeper to capture the jail and unjail events
func NewStakingDecorator ¶
func NewStakingDecorator(stakingKeeper slashingtypes.StakingKeeper, k *Keeper) *StakingDecorator
NewStakingDecorator constructor
func (StakingDecorator) Jail ¶
func (s StakingDecorator) Jail(ctx sdk.Context, consAddr sdk.ConsAddress)
Jail captures the jail event and calls the decorated staking keeper jail method
func (StakingDecorator) Slash ¶
func (s StakingDecorator) Slash(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec) math.Int
Slash captures the slash event and calls the decorated staking keeper slash method
func (StakingDecorator) SlashWithInfractionReason ¶
func (s StakingDecorator) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight int64, power int64, slashFactor sdk.Dec, infraction stakingtypes.Infraction) math.Int
SlashWithInfractionReason implementation doesn't require the infraction (types.Infraction) to work but is required by Interchain Security.
func (StakingDecorator) Unjail ¶
func (s StakingDecorator) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress)
Unjail captures the unjail event and calls the decorated staking keeper unjail method
type StakingHooks ¶
type StakingHooks struct{}
type StakingKeeperAdapter ¶
type StakingKeeperAdapter struct { types.SDKStakingKeeper // contains filtered or unexported fields }
StakingKeeperAdapter is an adapter to enhance the vanilla sdk staking keeper with additional functionality required for MS. The methods match Osmosis SDK fork.
func NewStakingKeeperAdapter ¶
func NewStakingKeeperAdapter(k types.SDKStakingKeeper, b types.SDKBankKeeper) *StakingKeeperAdapter
NewStakingKeeperAdapter constructor
func (StakingKeeperAdapter) InstantUndelegate ¶
func (s StakingKeeperAdapter) InstantUndelegate(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec) (sdk.Coins, error)
InstantUndelegate allows another module account to undelegate while bypassing unbonding time. This function is a combination of Undelegate and CompleteUnbonding, but skips the creation and deletion of UnbondingDelegationEntry
The code is copied from the Osmosis SDK fork https://github.com/osmosis-labs/cosmos-sdk/blob/v0.45.0x-osmo-v9.3/x/staking/keeper/delegation.go#L757
type TestKeepers ¶
type TestKeepers struct { StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper BankKeeper bankkeeper.Keeper StoreKey *storetypes.KVStoreKey EncodingConfig encodingConfig MeshKeeper *Keeper AccountKeeper authkeeper.AccountKeeper WasmKeeper *wasmkeeper.Keeper Faucet *wasmkeeper.TestFaucet }