types

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: GPL-3.0 Imports: 20 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 (
	DefaultCheckpointBufferTime time.Duration = 1000 * time.Second // Time checkpoint is allowed to stay in buffer (1000 seconds ~ 17 mins)
	DefaultAvgCheckpointLength  uint64        = 256
	DefaultMaxCheckpointLength  uint64        = 1024
	DefaultChildBlockInterval   uint64        = 10000
)

Default parameter values

View Source
const (
	QueryParams           = "params"
	QueryAckCount         = "ack-count"
	QueryCheckpoint       = "checkpoint"
	QueryCheckpointBuffer = "checkpoint-buffer"
	QueryLastNoAck        = "last-no-ack"
	QueryCheckpointList   = "checkpoint-list"
	QueryNextCheckpoint   = "next-checkpoint"
	QueryProposer         = "is-proposer"
	QueryCurrentProposer  = "current-proposer"
	StakingQuerierRoute   = "staking"
)

query endpoints supported by the auth Querier

View Source
const (
	QueryLatestMilestone      = "milestone-latest"
	QueryMilestoneByNumber    = "milestone-by-number"
	QueryCount                = "count"
	QueryLatestNoAckMilestone = "latest-no-ack-milestone"
	QueryNoAckMilestoneByID   = "no-ack-milestone-by-id"
)

Variables

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

	AttributeKeyProposer    = "proposer"
	AttributeKeyStartBlock  = "start-block"
	AttributeKeyEndBlock    = "end-block"
	AttributeKeyHeaderIndex = "header-index"
	AttributeKeyNewProposer = "new-proposer"
	AttributeKeyRootHash    = "root-hash"
	AttributeKeyAccountHash = "account-hash"
	AttributeKeyHash        = "hash"

	EventTypeMilestone        = "milestone"
	EventTypeMilestoneTimeout = "milestone-timeout"

	AttributeKeyMilestoneID = "milestone-id"

	AttributeValueCategory = ModuleName
)

Checkpoint tags

View Source
var (
	KeyCheckpointBufferTime = []byte("CheckpointBufferTime")
	KeyAvgCheckpointLength  = []byte("AvgCheckpointLength")
	KeyMaxCheckpointLength  = []byte("MaxCheckpointLength")
	KeyChildBlockInterval   = []byte("ChildBlockInterval")
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func GetAccountProof

func GetAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.HeimdallAddress) ([]byte, uint64, 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 GetMilestoneID added in v1.0.1

func GetMilestoneID() string

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable for auth module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SetMilestoneID added in v1.0.1

func SetMilestoneID(id string)

func ValidateCheckpoint

func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.HeimdallHash, checkpointLength uint64, contractCaller helper.IContractCaller, confirmations uint64) (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 ValidateMilestone added in v1.0.1

func ValidateMilestone(start uint64, end uint64, rootHash hmTypes.HeimdallHash, milestoneID string, contractCaller helper.IContractCaller, milestoneLength uint64, confirmations uint64) (bool, error)

ValidateMilestone validates the structure of the milestone

func VerifyAccountProof

func VerifyAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.HeimdallAddress, proofToVerify string) (bool, error)

VerifyAccountProof returns proof of dividend Account

Types

type Count added in v1.0.1

type Count struct {
	Count uint64 `json:"count" yaml:"count"`
}

type GenesisState

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

	BufferedCheckpoint *hmTypes.Checkpoint  `json:"buffered_checkpoint" yaml:"buffered_checkpoint"`
	LastNoACK          uint64               `json:"last_no_ack" yaml:"last_no_ack"`
	AckCount           uint64               `json:"ack_count" yaml:"ack_count"`
	Checkpoints        []hmTypes.Checkpoint `json:"checkpoints" yaml:"checkpoints"`
}

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.Checkpoint,
	lastNoACK uint64,
	ackCount uint64,
	checkpoints []hmTypes.Checkpoint,
) GenesisState

NewGenesisState creates a new genesis state.

type MsgCheckpoint

type MsgCheckpoint struct {
	Proposer        types.HeimdallAddress `json:"proposer"`
	StartBlock      uint64                `json:"start_block"`
	EndBlock        uint64                `json:"end_block"`
	RootHash        types.HeimdallHash    `json:"root_hash"`
	AccountRootHash types.HeimdallHash    `json:"account_root_hash"`
	BorChainID      string                `json:"bor_chain_id"`
}

MsgCheckpoint represents checkpoint

func NewMsgCheckpointBlock

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

NewMsgCheckpointBlock creates new checkpoint message using mentioned arguments

func (MsgCheckpoint) GetSideSignBytes added in v0.1.7

func (msg MsgCheckpoint) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

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"`
	Number     uint64                `json:"number"`
	Proposer   types.HeimdallAddress `json:"proposer"`
	StartBlock uint64                `json:"start_block"`
	EndBlock   uint64                `json:"end_block"`
	RootHash   types.HeimdallHash    `json:"root_hash"`
	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,
	number uint64,
	proposer types.HeimdallAddress,
	startBlock uint64,
	endBlock uint64,
	rootHash types.HeimdallHash,
	txHash types.HeimdallHash,
	logIndex uint64,
) MsgCheckpointAck

func (MsgCheckpointAck) GetLogIndex

func (msg MsgCheckpointAck) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgCheckpointAck) GetSideSignBytes added in v0.1.7

func (msg MsgCheckpointAck) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgCheckpointAck) GetSignBytes

func (msg MsgCheckpointAck) GetSignBytes() []byte

GetSignBytes returns sign bytes

func (MsgCheckpointAck) GetSigners

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

GetSigners returns signers

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

ValidateBasic validate basic

type MsgCheckpointAdjust added in v0.2.3

type MsgCheckpointAdjust struct {
	HeaderIndex uint64                `json:"header_index"`
	Proposer    types.HeimdallAddress `json:"proposer"`
	From        types.HeimdallAddress `json:"from"`
	StartBlock  uint64                `json:"start_block"`
	EndBlock    uint64                `json:"end_block"`
	RootHash    types.HeimdallHash    `json:"root_hash"`
}

MsgCheckpointAdjust represents checkpoint adjust

func NewMsgCheckpointAdjust added in v0.2.3

func NewMsgCheckpointAdjust(
	headerIndex uint64,
	startBlock uint64,
	endBlock uint64,
	proposer types.HeimdallAddress,
	from types.HeimdallAddress,
	rootHash types.HeimdallHash,
) MsgCheckpointAdjust

NewMsgCheckpointAdjust adjust previous checkpoint

func (MsgCheckpointAdjust) GetSideSignBytes added in v0.2.3

func (msg MsgCheckpointAdjust) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgCheckpointAdjust) GetSignBytes added in v0.2.3

func (msg MsgCheckpointAdjust) GetSignBytes() []byte

func (MsgCheckpointAdjust) GetSigners added in v0.2.3

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

GetSigners returns address of the signer

func (MsgCheckpointAdjust) Route added in v0.2.3

func (msg MsgCheckpointAdjust) Route() string

func (MsgCheckpointAdjust) Type added in v0.2.3

func (msg MsgCheckpointAdjust) Type() string

Type returns message type

func (MsgCheckpointAdjust) ValidateBasic added in v0.2.3

func (msg MsgCheckpointAdjust) 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 MsgMilestone added in v1.0.1

type MsgMilestone struct {
	Proposer    types.HeimdallAddress `json:"proposer"`
	StartBlock  uint64                `json:"start_block"`
	EndBlock    uint64                `json:"end_block"`
	Hash        types.HeimdallHash    `json:"hash"`
	BorChainID  string                `json:"bor_chain_id"`
	MilestoneID string                `json:"milestone_id"`
}

MsgMilestone represents milestone

func NewMsgMilestoneBlock added in v1.0.1

func NewMsgMilestoneBlock(
	proposer types.HeimdallAddress,
	startBlock uint64,
	endBlock uint64,
	hash types.HeimdallHash,
	borChainID string,
	milestoneID string,
) MsgMilestone

NewMsgMilestoneBlock creates new milestone message using mentioned arguments

func (MsgMilestone) GetSideSignBytes added in v1.0.1

func (msg MsgMilestone) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgMilestone) GetSignBytes added in v1.0.1

func (msg MsgMilestone) GetSignBytes() []byte

func (MsgMilestone) GetSigners added in v1.0.1

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

GetSigners returns address of the signer

func (MsgMilestone) Route added in v1.0.1

func (msg MsgMilestone) Route() string

func (MsgMilestone) Type added in v1.0.1

func (msg MsgMilestone) Type() string

Type returns message type

func (MsgMilestone) ValidateBasic added in v1.0.1

func (msg MsgMilestone) ValidateBasic() sdk.Error

type MsgMilestoneTimeout added in v1.0.1

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

func NewMsgMilestoneTimeout added in v1.0.1

func NewMsgMilestoneTimeout(from types.HeimdallAddress) MsgMilestoneTimeout

func (MsgMilestoneTimeout) GetSignBytes added in v1.0.1

func (msg MsgMilestoneTimeout) GetSignBytes() []byte

func (MsgMilestoneTimeout) GetSigners added in v1.0.1

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

func (MsgMilestoneTimeout) Route added in v1.0.1

func (msg MsgMilestoneTimeout) Route() string

func (MsgMilestoneTimeout) Type added in v1.0.1

func (msg MsgMilestoneTimeout) Type() string

func (MsgMilestoneTimeout) ValidateBasic added in v1.0.1

func (msg MsgMilestoneTimeout) ValidateBasic() sdk.Error

type Params

type Params struct {
	CheckpointBufferTime time.Duration `json:"checkpoint_buffer_time" yaml:"checkpoint_buffer_time"`
	AvgCheckpointLength  uint64        `json:"avg_checkpoint_length" yaml:"avg_checkpoint_length"`
	MaxCheckpointLength  uint64        `json:"max_checkpoint_length" yaml:"max_checkpoint_length"`
	ChildBlockInterval   uint64        `json:"child_chain_block_interval" yaml:"child_chain_block_interval"`
}

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,
	checkpointLength uint64,
	maxCheckpointLength uint64,
	childBlockInterval uint64,
) 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 QueryBorChainID added in v0.1.7

type QueryBorChainID struct {
	BorChainID string
}

QueryBorChainID defines the params for querying with bor chain id

func NewQueryBorChainID added in v0.1.7

func NewQueryBorChainID(chainID string) QueryBorChainID

NewQueryBorChainID creates a new instance of QueryBorChainID with give chain id

type QueryCheckpointParams

type QueryCheckpointParams struct {
	Number uint64
}

QueryCheckpointParams defines the params for querying accounts.

func NewQueryCheckpointParams

func NewQueryCheckpointParams(number uint64) QueryCheckpointParams

NewQueryCheckpointParams creates a new instance of QueryCheckpointHeaderIndex.

type QueryMilestoneID added in v1.0.1

type QueryMilestoneID struct {
	MilestoneID string
}

func NewQueryMilestoneID added in v1.0.1

func NewQueryMilestoneID(id string) QueryMilestoneID

NewQueryMilestoneParams creates a new instance of QueryMilestoneHeaderIndex.

type QueryMilestoneParams added in v1.0.1

type QueryMilestoneParams struct {
	Number uint64
}

QueryMilestoneParams defines the params for querying accounts.

func NewQueryMilestoneParams added in v1.0.1

func NewQueryMilestoneParams(number uint64) QueryMilestoneParams

NewQueryMilestoneParams creates a new instance of QueryMilestoneHeaderIndex.

Jump to

Keyboard shortcuts

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