checkpoint

package
v0.3.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultValue = []byte{0x01} // Value to store in CacheCheckpoint and CacheCheckpointACK & ValidatorSetChange Flag

	ACKCountKey         = []byte{0x11} // key to store ACK count
	BufferCheckpointKey = []byte{0x12} // Key to store checkpoint in buffer
	CheckpointKey       = []byte{0x13} // prefix key for when storing checkpoint after ACK
	LastNoACKKey        = []byte{0x14} // key to store last no-ack
)

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func GetCheckpointKey added in v0.2.0

func GetCheckpointKey(checkpointNumber uint64) []byte

GetCheckpointKey appends prefix to checkpointNumber

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)

InitGenesis sets distribution information for genesis.

func NewHandler

func NewHandler(k Keeper, contractCaller helper.IContractCaller) sdk.Handler

NewHandler creates new handler for handling messages for checkpoint module

func NewPostTxHandler added in v0.1.7

func NewPostTxHandler(k Keeper, contractCaller helper.IContractCaller) hmTypes.PostTxHandler

NewPostTxHandler returns a side handler for "bank" type messages.

func NewQuerier

func NewQuerier(keeper Keeper, stakingKeeper staking.Keeper, topupKeeper topup.Keeper, contractCaller helper.IContractCaller) sdk.Querier

NewQuerier creates a querier for auth REST endpoints

func NewSideTxHandler added in v0.1.7

func NewSideTxHandler(k Keeper, contractCaller helper.IContractCaller) hmTypes.SideTxHandler

NewSideTxHandler returns a side handler for "bank" type messages.

func PostHandleMsgCheckpoint added in v0.1.7

func PostHandleMsgCheckpoint(ctx sdk.Context, k Keeper, msg types.MsgCheckpoint, sideTxResult abci.SideTxResultType) sdk.Result

PostHandleMsgCheckpoint handles msg checkpoint

func PostHandleMsgCheckpointAck added in v0.1.7

func PostHandleMsgCheckpointAck(ctx sdk.Context, k Keeper, msg types.MsgCheckpointAck, sideTxResult abci.SideTxResultType) sdk.Result

PostHandleMsgCheckpointAck handles msg checkpoint ack

func PostHandleMsgCheckpointAdjust added in v0.2.3

func PostHandleMsgCheckpointAdjust(ctx sdk.Context, k Keeper, msg types.MsgCheckpointAdjust, sideTxResult abci.SideTxResultType, contractCaller helper.IContractCaller) sdk.Result

PostHandleMsgCheckpointAdjust handles msg checkpoint adjust

func SideHandleMsgCheckpoint added in v0.1.7

func SideHandleMsgCheckpoint(ctx sdk.Context, k Keeper, msg types.MsgCheckpoint, contractCaller helper.IContractCaller) (result abci.ResponseDeliverSideTx)

SideHandleMsgCheckpoint handles MsgCheckpoint message for external call

func SideHandleMsgCheckpointAck added in v0.1.7

func SideHandleMsgCheckpointAck(ctx sdk.Context, k Keeper, msg types.MsgCheckpointAck, contractCaller helper.IContractCaller) (result abci.ResponseDeliverSideTx)

SideHandleMsgCheckpointAck handles MsgCheckpointAck message for external call

func SideHandleMsgCheckpointAdjust added in v0.2.3

func SideHandleMsgCheckpointAdjust(ctx sdk.Context, k Keeper, msg types.MsgCheckpointAdjust, contractCaller helper.IContractCaller) (result abci.ResponseDeliverSideTx)

SideHandleMsgCheckpointAdjust handles MsgCheckpointAdjust message for external call

Types

type AppModule

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

AppModule implements an application module for the checkpoint module.

func NewAppModule

func NewAppModule(keeper Keeper, sk staking.Keeper, tk topup.Keeper, contractCaller helper.IContractCaller) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

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

BeginBlock returns the begin blocker for the auth module.

func (AppModule) EndBlock

EndBlock returns the end blocker for the auth module. It returns no validator updates.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

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

func (AppModule) GenerateGenesisState added in v0.1.8

func (AppModule) GenerateGenesisState(simState *hmModule.SimulationState)

GenerateGenesisState creates a randomized GenState of the Staking module

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the auth module. It returns no validator updates.

func (AppModule) Name

func (AppModule) Name() string

Name returns the auth module's name.

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler returns an sdk.Handler for the module.

func (AppModule) NewPostTxHandler added in v0.1.7

func (am AppModule) NewPostTxHandler() hmTypes.PostTxHandler

NewPostTxHandler side tx handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the auth module sdk.Querier.

func (AppModule) NewSideTxHandler added in v0.1.7

func (am AppModule) NewSideTxHandler() hmTypes.SideTxHandler

NewSideTxHandler side tx handler

func (AppModule) ProposalContents added in v0.1.8

func (AppModule) ProposalContents(simState hmModule.SimulationState) []simTypes.WeightedProposalContent

ProposalContents doesn't return any content functions.

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the auth module's querier route name.

func (AppModule) RandomizedParams added in v0.1.8

func (AppModule) RandomizedParams(r *rand.Rand) []simTypes.ParamChange

RandomizedParams creates randomized param changes for the simulator.

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

RegisterInvariants performs a no-op.

func (AppModule) RegisterStoreDecoder added in v0.1.8

func (AppModule) RegisterStoreDecoder(sdr hmModule.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for chainmanager module's types

func (AppModule) Route

func (AppModule) Route() string

Route returns the message routing key for the auth module.

func (AppModule) WeightedOperations added in v0.1.8

WeightedOperations doesn't return any chainmanager module operation.

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic defines the basic application module used by the auth module.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the auth module.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd returns the root query command for the auth module.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd returns the root tx command for the auth module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the auth module's name.

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the auth module's types for the given codec.

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the auth module.

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the auth module.

func (AppModuleBasic) VerifyGenesis

func (AppModuleBasic) VerifyGenesis(bz map[string]json.RawMessage) error

VerifyGenesis performs verification on auth module state.

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper stores all related data

func NewKeeper

func NewKeeper(
	cdc *codec.Codec,
	storeKey sdk.StoreKey,
	paramSpace subspace.Subspace,
	codespace sdk.CodespaceType,
	stakingKeeper staking.Keeper,
	chainKeeper chainmanager.Keeper,
	moduleCommunicator ModuleCommunicator,
) Keeper

NewKeeper create new keeper

func (*Keeper) AddCheckpoint

func (k *Keeper) AddCheckpoint(ctx sdk.Context, checkpointNumber uint64, checkpoint hmTypes.Checkpoint) error

AddCheckpoint adds checkpoint into final blocks

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

Codespace returns the codespace

func (*Keeper) FlushCheckpointBuffer

func (k *Keeper) FlushCheckpointBuffer(ctx sdk.Context)

FlushCheckpointBuffer flushes Checkpoint Buffer

func (Keeper) GetACKCount

func (k Keeper) GetACKCount(ctx sdk.Context) uint64

GetACKCount returns current ACK count

func (*Keeper) GetCheckpointByNumber added in v0.1.8

func (k *Keeper) GetCheckpointByNumber(ctx sdk.Context, number uint64) (hmTypes.Checkpoint, error)

GetCheckpointByNumber to get checkpoint by checkpoint number

func (*Keeper) GetCheckpointFromBuffer

func (k *Keeper) GetCheckpointFromBuffer(ctx sdk.Context) (*hmTypes.Checkpoint, error)

GetCheckpointFromBuffer gets checkpoint in buffer

func (*Keeper) GetCheckpointList

func (k *Keeper) GetCheckpointList(ctx sdk.Context, page uint64, limit uint64) ([]hmTypes.Checkpoint, error)

GetCheckpointList returns all checkpoints with params like page and limit

func (*Keeper) GetCheckpoints added in v0.1.8

func (k *Keeper) GetCheckpoints(ctx sdk.Context) []hmTypes.Checkpoint

GetCheckpoints get checkpoint all checkpoints

func (*Keeper) GetLastCheckpoint

func (k *Keeper) GetLastCheckpoint(ctx sdk.Context) (hmTypes.Checkpoint, error)

GetLastCheckpoint gets last checkpoint, checkpoint number = TotalACKs

func (*Keeper) GetLastNoAck

func (k *Keeper) GetLastNoAck(ctx sdk.Context) uint64

GetLastNoAck returns last no ack

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the auth module's parameters.

func (*Keeper) HasStoreValue

func (k *Keeper) HasStoreValue(ctx sdk.Context, key []byte) bool

HasStoreValue check if value exists in store or not

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger

func (*Keeper) SetCheckpointBuffer

func (k *Keeper) SetCheckpointBuffer(ctx sdk.Context, checkpoint hmTypes.Checkpoint) error

SetCheckpointBuffer flushes Checkpoint Buffer

func (*Keeper) SetLastNoAck

func (k *Keeper) SetLastNoAck(ctx sdk.Context, timestamp uint64)

SetLastNoAck set last no-ack object

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the auth module's parameters.

func (Keeper) UpdateACKCount

func (k Keeper) UpdateACKCount(ctx sdk.Context)

UpdateACKCount updates ACK count by 1

func (Keeper) UpdateACKCountWithValue

func (k Keeper) UpdateACKCountWithValue(ctx sdk.Context, value uint64)

UpdateACKCountWithValue updates ACK with value

type ModuleCommunicator added in v0.1.7

type ModuleCommunicator interface {
	GetAllDividendAccounts(ctx sdk.Context) []hmTypes.DividendAccount
}

ModuleCommunicator manages different module interaction

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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