Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIfBlocksExist(end uint64) bool
- func GetAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.HeimdallAddress) ([]byte, uint64, error)
- func GetAccountRootHash(dividendAccounts []hmTypes.DividendAccount) ([]byte, error)
- func GetAccountTree(dividendAccounts []hmTypes.DividendAccount) (*merkletree.MerkleTree, error)
- func ParamKeyTable() subspace.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.HeimdallHash, ...) (bool, error)
- func ValidateGenesis(data GenesisState) error
- func VerifyAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.HeimdallAddress, ...) (bool, error)
- type GenesisState
- type MsgCheckpoint
- type MsgCheckpointAck
- func (msg MsgCheckpointAck) GetLogIndex() uint64
- func (msg MsgCheckpointAck) GetSideSignBytes() []byte
- func (msg MsgCheckpointAck) GetSignBytes() []byte
- func (msg MsgCheckpointAck) GetSigners() []sdk.AccAddress
- func (msg MsgCheckpointAck) GetTxHash() types.HeimdallHash
- func (msg MsgCheckpointAck) Route() string
- func (msg MsgCheckpointAck) Type() string
- func (msg MsgCheckpointAck) ValidateBasic() sdk.Error
- type MsgCheckpointNoAck
- type Params
- type QueryBorChainID
- type QueryCheckpointParams
Constants ¶
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 )
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 )
Default parameter values
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
Variables ¶
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
var ( KeyCheckpointBufferTime = []byte("CheckpointBufferTime") KeyAvgCheckpointLength = []byte("AvgCheckpointLength") KeyMaxCheckpointLength = []byte("MaxCheckpointLength") )
Parameter keys
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func CheckIfBlocksExist ¶
CheckIfBlocksExist - check if latest block number is greater than end block
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 RegisterCodec ¶
func ValidateCheckpoint ¶
func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.HeimdallHash, checkpointLength uint64, contractCaller helper.IContractCaller) (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, userAddr hmTypes.HeimdallAddress, 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:"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) ValidateBasic ¶
func (msg MsgCheckpoint) ValidateBasic() sdk.Error
type MsgCheckpointAck ¶
type MsgCheckpointAck struct { From types.HeimdallAddress `json:"from"` HeaderBlock uint64 `json:"headerBlock"` 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, headerBlock 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 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"` AvgCheckpointLength uint64 `json:"avg_checkpoint_length" yaml:"avg_checkpoint_length"` MaxCheckpointLength uint64 `json:"max_checkpoint_length" yaml:"max_checkpoint_length"` }
Params defines the parameters for the auth module.
func NewParams ¶
func NewParams( checkpointBufferTime time.Duration, checkpointLength uint64, maxCheckpointLength uint64, ) Params
NewParams creates a new Params object
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
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 {
HeaderIndex uint64
}
QueryCheckpointParams defines the params for querying accounts.
func NewQueryCheckpointParams ¶
func NewQueryCheckpointParams(headerIndex uint64) QueryCheckpointParams
NewQueryCheckpointParams creates a new instance of QueryCheckpointHeaderIndex.