types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "checkpoint"

	// StoreKey is the store key string for bor
	StoreKey = ModuleName

	// RouterKey is the message route for bor
	RouterKey = ModuleName

	// QuerierRoute is the querier route for bor
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName
)
View Source
const (
	QueryParams           = "params"
	QueryAckCount         = "ack-count"
	QueryCheckpoint       = "checkpoint"
	QueryCheckpointBuffer = "checkpoint-buffer"
	QueryLastNoAck        = "last-no-ack"
	QueryCheckpointList   = "checkpoint-list"
)

query endpoints supported by the auth Querier

View Source
const (
	DefaultCheckpointBufferTime time.Duration = 1000 * time.Second // Time checkpoint is allowed to stay in buffer (1000 seconds ~ 17 mins)
)

Default parameter values

Variables

View Source
var (
	EventTypeCheckpoint      = "checkpoint"
	EventTypeCheckpointAck   = "checkpoint-ack"
	EventTypeCheckpointNoAck = "checkpoint-noack"

	AttributeKeyProposer    = "proposer"
	AttributeKeyStartBlock  = "start-block"
	AttributeKeyEndBlock    = "end-block"
	AttributeKeyHeaderIndex = "header-index"
	AttributeKeyNewProposer = "new-proposer"

	AttributeValueCategory = ModuleName
)

Checkpoint tags

View Source
var (
	KeyCheckpointBufferTime = []byte("CheckpointBufferTime")
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func CheckIfBlocksExist

func CheckIfBlocksExist(end uint64) bool

CheckIfBlocksExist - check if latest block number is greater than end block

func GetAccountProof

func GetAccountProof(dividendAccounts []hmTypes.DividendAccount, dividendAccountID hmTypes.DividendAccountID) ([]byte, error)

GetAccountProof returns proof of dividend Account

func GetAccountRootHash

func GetAccountRootHash(dividendAccounts []hmTypes.DividendAccount) ([]byte, error)

GetAccountRootHash returns roothash of Validator Account State Tree

func GetAccountTree

func GetAccountTree(dividendAccounts []hmTypes.DividendAccount) (*merkletree.MerkleTree, error)

GetAccountTree returns roothash of Validator Account State Tree

func GetHeaders

func GetHeaders(start uint64, end uint64) ([]byte, error)

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func RegisterPulp

func RegisterPulp(pulp *authTypes.Pulp)

func ValidateCheckpoint

func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.HeimdallHash) (bool, error)

ValidateCheckpoint - Validates if checkpoint rootHash matches or not

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of bor genesis data returning an error for any failed validation criteria.

func VerifyAccountProof

func VerifyAccountProof(dividendAccounts []hmTypes.DividendAccount, dividendAccountID hmTypes.DividendAccountID, proofToVerify string) (bool, error)

VerifyAccountProof returns proof of dividend Account

Types

type GenesisState

type GenesisState struct {
	Params Params `json:"params" yaml:"params"`

	BufferedCheckpoint *hmTypes.CheckpointBlockHeader  `json:"buffered_checkpoint" yaml:"buffered_checkpoint"`
	LastNoACK          uint64                          `json:"last_no_ack" yaml:"last_no_ack"`
	AckCount           uint64                          `json:"ack_count" yaml:"ack_count"`
	Headers            []hmTypes.CheckpointBlockHeader `json:"headers" yaml:"headers"`
}

GenesisState is the checkpoint state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns staking GenesisState given raw application genesis state

func NewGenesisState

func NewGenesisState(
	params Params,
	bufferedCheckpoint *hmTypes.CheckpointBlockHeader,
	lastNoACK uint64,
	ackCount uint64,
	headers []hmTypes.CheckpointBlockHeader,
) GenesisState

NewGenesisState creates a new genesis state.

type MsgCheckpoint

type MsgCheckpoint struct {
	Proposer        types.HeimdallAddress `json:"proposer"`
	StartBlock      uint64                `json:"startBlock"`
	EndBlock        uint64                `json:"endBlock"`
	RootHash        types.HeimdallHash    `json:"rootHash"`
	AccountRootHash types.HeimdallHash    `json:"accountRootHash"`
}

MsgCheckpoint represents checkpoint

func NewMsgCheckpointBlock

func NewMsgCheckpointBlock(
	proposer types.HeimdallAddress,
	startBlock uint64,
	endBlock uint64,
	roothash types.HeimdallHash,
	accountRootHash types.HeimdallHash,
) MsgCheckpoint

NewMsgCheckpointBlock creates new checkpoint message using mentioned arguments

func (MsgCheckpoint) GetSignBytes

func (msg MsgCheckpoint) GetSignBytes() []byte

func (MsgCheckpoint) GetSigners

func (msg MsgCheckpoint) GetSigners() []sdk.AccAddress

GetSigners returns address of the signer

func (MsgCheckpoint) Route

func (msg MsgCheckpoint) Route() string

func (MsgCheckpoint) Type

func (msg MsgCheckpoint) Type() string

Type returns message type

func (MsgCheckpoint) ValidateBasic

func (msg MsgCheckpoint) ValidateBasic() sdk.Error

type MsgCheckpointAck

type MsgCheckpointAck struct {
	From        types.HeimdallAddress `json:"from"`
	HeaderBlock uint64                `json:"headerBlock"`
	TxHash      types.HeimdallHash    `json:"tx_hash"`
	LogIndex    uint64                `json:"log_index"`
}

MsgCheckpointAck Add mainchain commit transaction hash to MsgCheckpointAck

func NewMsgCheckpointAck

func NewMsgCheckpointAck(from types.HeimdallAddress, headerBlock uint64, txHash types.HeimdallHash, logIndex uint64) MsgCheckpointAck

func (MsgCheckpointAck) GetLogIndex

func (msg MsgCheckpointAck) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgCheckpointAck) GetSignBytes

func (msg MsgCheckpointAck) GetSignBytes() []byte

func (MsgCheckpointAck) GetSigners

func (msg MsgCheckpointAck) GetSigners() []sdk.AccAddress

func (MsgCheckpointAck) GetTxHash

func (msg MsgCheckpointAck) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgCheckpointAck) Route

func (msg MsgCheckpointAck) Route() string

func (MsgCheckpointAck) Type

func (msg MsgCheckpointAck) Type() string

func (MsgCheckpointAck) ValidateBasic

func (msg MsgCheckpointAck) ValidateBasic() sdk.Error

type MsgCheckpointNoAck

type MsgCheckpointNoAck struct {
	From types.HeimdallAddress `json:"from"`
}

func NewMsgCheckpointNoAck

func NewMsgCheckpointNoAck(from types.HeimdallAddress) MsgCheckpointNoAck

func (MsgCheckpointNoAck) GetSignBytes

func (msg MsgCheckpointNoAck) GetSignBytes() []byte

func (MsgCheckpointNoAck) GetSigners

func (msg MsgCheckpointNoAck) GetSigners() []sdk.AccAddress

func (MsgCheckpointNoAck) Route

func (msg MsgCheckpointNoAck) Route() string

func (MsgCheckpointNoAck) Type

func (msg MsgCheckpointNoAck) Type() string

func (MsgCheckpointNoAck) ValidateBasic

func (msg MsgCheckpointNoAck) ValidateBasic() sdk.Error

type Params

type Params struct {
	CheckpointBufferTime time.Duration `json:"checkpoint_buffer_time" yaml:"checkpoint_buffer_time"`
}

Params defines the parameters for the auth module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams(
	checkpointBufferTime time.Duration,
) Params

NewParams creates a new Params object

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() subspace.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements the stringer interface.

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

type QueryCheckpointParams

type QueryCheckpointParams struct {
	HeaderIndex uint64
}

QueryCheckpointParams defines the params for querying accounts.

func NewQueryCheckpointParams

func NewQueryCheckpointParams(headerIndex uint64) QueryCheckpointParams

NewQueryCheckpointParams creates a new instance of QueryCheckpointHeaderIndex.

Jump to

Keyboard shortcuts

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