Documentation
¶
Index ¶
- Constants
- Variables
- func GetAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.IrisAddress) ([]byte, uint64, error)
- func GetAccountRootHash(dividendAccounts []hmTypes.DividendAccount) ([]byte, error)
- func GetAccountTree(dividendAccounts []hmTypes.DividendAccount) (*merkletree.MerkleTree, error)
- func GetMilestoneID() string
- func ParamKeyTable() subspace.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func SetMilestoneID(id string)
- func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.IrisHash, checkpointLength uint64, ...) (bool, error)
- func ValidateGenesis(data GenesisState) error
- func ValidateMilestone(start uint64, end uint64, rootHash hmTypes.IrisHash, milestoneID string, ...) (bool, error)
- func VerifyAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.IrisAddress, ...) (bool, error)
- type Count
- 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.IrisHash
- func (msg MsgCheckpointAck) Route() string
- func (msg MsgCheckpointAck) Type() string
- func (msg MsgCheckpointAck) ValidateBasic() sdk.Error
- type MsgCheckpointAdjust
- func (msg MsgCheckpointAdjust) GetSideSignBytes() []byte
- func (msg MsgCheckpointAdjust) GetSignBytes() []byte
- func (msg MsgCheckpointAdjust) GetSigners() []sdk.AccAddress
- func (msg MsgCheckpointAdjust) Route() string
- func (msg MsgCheckpointAdjust) Type() string
- func (msg MsgCheckpointAdjust) ValidateBasic() sdk.Error
- type MsgCheckpointNoAck
- type MsgMilestone
- type MsgMilestoneTimeout
- type Params
- type QueryCheckpointParams
- type QueryMilestoneID
- type QueryMilestoneParams
- type QueryZenaChainID
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "checkpoint" // StoreKey is the store key string for zena StoreKey = ModuleName // RouterKey is the message route for zena RouterKey = ModuleName // QuerierRoute is the querier route for zena 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 DefaultChildBlockInterval uint64 = 10000 )
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
const ( QueryLatestMilestone = "milestone-latest" QueryMilestoneByNumber = "milestone-by-number" QueryCount = "count" QueryLatestNoAckMilestone = "latest-no-ack-milestone" QueryNoAckMilestoneByID = "no-ack-milestone-by-id" )
Variables ¶
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
var ( KeyCheckpointBufferTime = []byte("CheckpointBufferTime") KeyAvgCheckpointLength = []byte("AvgCheckpointLength") KeyMaxCheckpointLength = []byte("MaxCheckpointLength") KeyChildBlockInterval = []byte("ChildBlockInterval") )
Parameter keys
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func GetAccountProof ¶
func GetAccountProof(dividendAccounts []hmTypes.DividendAccount, userAddr hmTypes.IrisAddress) ([]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 ¶
func GetMilestoneID() string
func RegisterCodec ¶
func SetMilestoneID ¶
func SetMilestoneID(id string)
func ValidateCheckpoint ¶
func ValidateCheckpoint(start uint64, end uint64, rootHash hmTypes.IrisHash, 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 zena genesis data returning an error for any failed validation criteria.
func ValidateMilestone ¶
func ValidateMilestone(start uint64, end uint64, rootHash hmTypes.IrisHash, 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.IrisAddress, proofToVerify string) (bool, error)
VerifyAccountProof returns proof of dividend Account
Types ¶
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.IrisAddress `json:"proposer"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
RootHash types.IrisHash `json:"root_hash"`
AccountRootHash types.IrisHash `json:"account_root_hash"`
ZenaChainID string `json:"zena_chain_id"`
}
MsgCheckpoint represents checkpoint
func NewMsgCheckpointBlock ¶
func NewMsgCheckpointBlock( proposer types.IrisAddress, startBlock uint64, endBlock uint64, roothash types.IrisHash, accountRootHash types.IrisHash, zenaChainID string, ) MsgCheckpoint
NewMsgCheckpointBlock creates new checkpoint message using mentioned arguments
func (MsgCheckpoint) GetSideSignBytes ¶
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.IrisAddress `json:"from"`
Number uint64 `json:"number"`
Proposer types.IrisAddress `json:"proposer"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
RootHash types.IrisHash `json:"root_hash"`
TxHash types.IrisHash `json:"tx_hash"`
LogIndex uint64 `json:"log_index"`
}
MsgCheckpointAck Add mainchain commit transaction hash to MsgCheckpointAck
func NewMsgCheckpointAck ¶
func NewMsgCheckpointAck( from types.IrisAddress, number uint64, proposer types.IrisAddress, startBlock uint64, endBlock uint64, rootHash types.IrisHash, txHash types.IrisHash, logIndex uint64, ) MsgCheckpointAck
func (MsgCheckpointAck) GetLogIndex ¶
func (msg MsgCheckpointAck) GetLogIndex() uint64
GetLogIndex Returns log index
func (MsgCheckpointAck) GetSideSignBytes ¶
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.IrisHash
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 ¶
type MsgCheckpointAdjust struct {
HeaderIndex uint64 `json:"header_index"`
Proposer types.IrisAddress `json:"proposer"`
From types.IrisAddress `json:"from"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
RootHash types.IrisHash `json:"root_hash"`
}
MsgCheckpointAdjust represents checkpoint adjust
func NewMsgCheckpointAdjust ¶
func NewMsgCheckpointAdjust( headerIndex uint64, startBlock uint64, endBlock uint64, proposer types.IrisAddress, from types.IrisAddress, rootHash types.IrisHash, ) MsgCheckpointAdjust
NewMsgCheckpointAdjust adjust previous checkpoint
func (MsgCheckpointAdjust) GetSideSignBytes ¶
func (msg MsgCheckpointAdjust) GetSideSignBytes() []byte
GetSideSignBytes returns side sign bytes
func (MsgCheckpointAdjust) GetSignBytes ¶
func (msg MsgCheckpointAdjust) GetSignBytes() []byte
func (MsgCheckpointAdjust) GetSigners ¶
func (msg MsgCheckpointAdjust) GetSigners() []sdk.AccAddress
GetSigners returns address of the signer
func (MsgCheckpointAdjust) Route ¶
func (msg MsgCheckpointAdjust) Route() string
func (MsgCheckpointAdjust) Type ¶
func (msg MsgCheckpointAdjust) Type() string
Type returns message type
func (MsgCheckpointAdjust) ValidateBasic ¶
func (msg MsgCheckpointAdjust) ValidateBasic() sdk.Error
type MsgCheckpointNoAck ¶
type MsgCheckpointNoAck struct {
From types.IrisAddress `json:"from"`
}
func NewMsgCheckpointNoAck ¶
func NewMsgCheckpointNoAck(from types.IrisAddress) 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 ¶
type MsgMilestone struct {
Proposer types.IrisAddress `json:"proposer"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
Hash types.IrisHash `json:"hash"`
ZenaChainID string `json:"zena_chain_id"`
MilestoneID string `json:"milestone_id"`
}
MsgMilestone represents milestone
func NewMsgMilestoneBlock ¶
func NewMsgMilestoneBlock( proposer types.IrisAddress, startBlock uint64, endBlock uint64, hash types.IrisHash, zenaChainID string, milestoneID string, ) MsgMilestone
NewMsgMilestoneBlock creates new milestone message using mentioned arguments
func (MsgMilestone) GetSideSignBytes ¶
func (msg MsgMilestone) GetSideSignBytes() []byte
GetSideSignBytes returns side sign bytes
func (MsgMilestone) GetSignBytes ¶
func (msg MsgMilestone) GetSignBytes() []byte
func (MsgMilestone) GetSigners ¶
func (msg MsgMilestone) GetSigners() []sdk.AccAddress
GetSigners returns address of the signer
func (MsgMilestone) Route ¶
func (msg MsgMilestone) Route() string
func (MsgMilestone) ValidateBasic ¶
func (msg MsgMilestone) ValidateBasic() sdk.Error
type MsgMilestoneTimeout ¶
type MsgMilestoneTimeout struct {
From types.IrisAddress `json:"from"`
}
func NewMsgMilestoneTimeout ¶
func NewMsgMilestoneTimeout(from types.IrisAddress) MsgMilestoneTimeout
func (MsgMilestoneTimeout) GetSignBytes ¶
func (msg MsgMilestoneTimeout) GetSignBytes() []byte
func (MsgMilestoneTimeout) GetSigners ¶
func (msg MsgMilestoneTimeout) GetSigners() []sdk.AccAddress
func (MsgMilestoneTimeout) Route ¶
func (msg MsgMilestoneTimeout) Route() string
func (MsgMilestoneTimeout) Type ¶
func (msg MsgMilestoneTimeout) Type() string
func (MsgMilestoneTimeout) ValidateBasic ¶
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 NewParams ¶
func NewParams( checkpointBufferTime time.Duration, checkpointLength uint64, maxCheckpointLength uint64, childBlockInterval 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 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 ¶
type QueryMilestoneID struct {
MilestoneID string
}
func NewQueryMilestoneID ¶
func NewQueryMilestoneID(id string) QueryMilestoneID
NewQueryMilestoneParams creates a new instance of QueryMilestoneHeaderIndex.
type QueryMilestoneParams ¶
type QueryMilestoneParams struct {
Number uint64
}
QueryMilestoneParams defines the params for querying accounts.
func NewQueryMilestoneParams ¶
func NewQueryMilestoneParams(number uint64) QueryMilestoneParams
NewQueryMilestoneParams creates a new instance of QueryMilestoneHeaderIndex.
type QueryZenaChainID ¶
type QueryZenaChainID struct {
ZenaChainID string
}
QueryZenaChainID defines the params for querying with zena chain id
func NewQueryZenaChainID ¶
func NewQueryZenaChainID(chainID string) QueryZenaChainID
NewQueryZenaChainID creates a new instance of QueryZenaChainID with give chain id