Documentation
¶
Index ¶
- Constants
- Variables
- func CalcCurrentBorSpanId(latestBorBlock uint64, latestHeimdallSpan *hmTypes.Span) (uint64, error)
- func GenerateBorCommittedSpans(latestBorBlock uint64, latestBorUsedSpan *hmTypes.Span) []hmTypes.Span
- func IsBlockCloseToSpanEnd(blockNumber, spanEnd uint64) bool
- func ParamKeyTable() subspace.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func SetGenesisStateToAppState(appState map[string]json.RawMessage, currentValSet hmTypes.ValidatorSet) (map[string]json.RawMessage, error)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type HeimdallSpan
- type MsgBackfillSpans
- func (msg MsgBackfillSpans) GetSideSignBytes() []byte
- func (msg MsgBackfillSpans) GetSignBytes() []byte
- func (msg MsgBackfillSpans) GetSigners() []sdk.AccAddress
- func (msg MsgBackfillSpans) Route() string
- func (msg MsgBackfillSpans) Type() string
- func (msg MsgBackfillSpans) ValidateBasic() sdk.Error
- type MsgProposeSpan
- type MsgProposeSpanV2
- func (msg MsgProposeSpanV2) GetSideSignBytes() []byte
- func (msg MsgProposeSpanV2) GetSignBytes() []byte
- func (msg MsgProposeSpanV2) GetSigners() []sdk.AccAddress
- func (msg MsgProposeSpanV2) Route() string
- func (msg MsgProposeSpanV2) Type() string
- func (msg MsgProposeSpanV2) ValidateBasic() sdk.Error
- type Params
- type QuerySpanParams
- type QuerySpanSeedResponse
- type ResponseWithHeight
- type Span
- type Validator
- type ValidatorSet
Constants ¶
const ( EventTypeProposeSpan = "propose-span" AttributeKeySuccess = "success" AttributeKeySpanID = "span-id" AttributeKeySpanStartBlock = "start-block" AttributeKeySpanEndBlock = "end-block" AttributesKeyLatestSpanId = "latest-span-id" AttributesKeyLatestBorSpanId = "latest-bor-span-id" AttributeValueCategory = ModuleName )
staking module event types
const ( // ModuleName is the name of the module ModuleName = "bor" // 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 ( DefaultSprintDuration uint64 = 16 DefaultSpanDuration uint64 = 100 * DefaultSprintDuration DefaultFirstSpanDuration uint64 = 256 DefaultProducerCount uint64 = 4 )
Default parameter values
const ( QueryParams = "params" QuerySpan = "span" QuerySpanList = "span-list" QueryLatestSpan = "latest-span" QueryNextSpan = "next-span" QueryNextProducers = "next-producers" QueryNextSpanSeed = "next-span-seed" ParamSpan = "span" ParamSprint = "sprint" ParamProducerCount = "producer-count" ParamLastEthBlock = "last-eth-block" )
query endpoints supported by the auth Querier
const ( // SlotCost cost for validator SlotCost int64 = 1 )
Variables ¶
var ( KeySprintDuration = []byte("SprintDuration") KeySpanDuration = []byte("SpanDuration") KeyProducerCount = []byte("ProducerCount") )
Parameter keys
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func CalcCurrentBorSpanId ¶ added in v1.5.0
CalcCurrentBorSpanId computes the Bor span ID corresponding to latestBorBlock, using latestHeimdallSpan as the reference. It returns an error if inputs are invalid (nil span, zero or negative span length) or if arithmetic overflow is detected.
func GenerateBorCommittedSpans ¶ added in v1.5.0
func IsBlockCloseToSpanEnd ¶ added in v1.5.0
func RegisterCodec ¶
func SetGenesisStateToAppState ¶
func SetGenesisStateToAppState(appState map[string]json.RawMessage, currentValSet hmTypes.ValidatorSet) (map[string]json.RawMessage, error)
SetGenesisStateToAppState sets state into app state
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of bor genesis data returning an error for any failed validation criteria.
Types ¶
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
Spans []*hmTypes.Span `json:"spans" yaml:"spans"` // list of spans
}
GenesisState is the bor 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, spans []*hmTypes.Span) GenesisState
NewGenesisState creates a new genesis state.
type HeimdallSpan ¶ added in v0.3.3
type HeimdallSpan struct {
Span
ValidatorSet ValidatorSet `json:"validator_set" yaml:"validator_set"`
SelectedProducers []Validator `json:"selected_producers" yaml:"selected_producers"`
ChainID string `json:"bor_chain_id" yaml:"bor_chain_id"`
}
type MsgBackfillSpans ¶ added in v1.5.0
type MsgBackfillSpans struct {
Proposer hmTypes.HeimdallAddress `json:"proposer"`
ChainID string `json:"chain_id"`
LatestSpanID uint64 `json:"latest_span_id"`
LatestBorSpanID uint64 `json:"latest_bor_span_id"`
}
func NewMsgBackfillSpans ¶ added in v1.5.0
func NewMsgBackfillSpans(proposer hmTypes.HeimdallAddress, chainID string, latestSpanID, latestBorSpanID uint64) MsgBackfillSpans
func (MsgBackfillSpans) GetSideSignBytes ¶ added in v1.5.0
func (msg MsgBackfillSpans) GetSideSignBytes() []byte
func (MsgBackfillSpans) GetSignBytes ¶ added in v1.5.0
func (msg MsgBackfillSpans) GetSignBytes() []byte
func (MsgBackfillSpans) GetSigners ¶ added in v1.5.0
func (msg MsgBackfillSpans) GetSigners() []sdk.AccAddress
func (MsgBackfillSpans) Route ¶ added in v1.5.0
func (msg MsgBackfillSpans) Route() string
func (MsgBackfillSpans) Type ¶ added in v1.5.0
func (msg MsgBackfillSpans) Type() string
func (MsgBackfillSpans) ValidateBasic ¶ added in v1.5.0
func (msg MsgBackfillSpans) ValidateBasic() sdk.Error
type MsgProposeSpan ¶
type MsgProposeSpan struct {
ID uint64 `json:"span_id"`
Proposer hmTypes.HeimdallAddress `json:"proposer"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
ChainID string `json:"bor_chain_id"`
Seed common.Hash `json:"seed"`
}
MsgProposeSpan creates msg propose span
func NewMsgProposeSpan ¶
func NewMsgProposeSpan( id uint64, proposer hmTypes.HeimdallAddress, startBlock uint64, endBlock uint64, chainID string, seed common.Hash, ) MsgProposeSpan
NewMsgProposeSpan creates new propose span message
func (MsgProposeSpan) GetSideSignBytes ¶ added in v0.1.7
func (msg MsgProposeSpan) GetSideSignBytes() []byte
GetSideSignBytes returns side sign bytes
func (MsgProposeSpan) GetSignBytes ¶
func (msg MsgProposeSpan) GetSignBytes() []byte
GetSignBytes returns sign bytes for proposeSpan message type
func (MsgProposeSpan) GetSigners ¶
func (msg MsgProposeSpan) GetSigners() []sdk.AccAddress
GetSigners returns address of the signer
func (MsgProposeSpan) Route ¶
func (msg MsgProposeSpan) Route() string
Route returns route for message
func (MsgProposeSpan) ValidateBasic ¶
func (msg MsgProposeSpan) ValidateBasic() sdk.Error
ValidateBasic validates the message and returns error
type MsgProposeSpanV2 ¶ added in v1.2.0
type MsgProposeSpanV2 struct {
ID uint64 `json:"span_id"`
Proposer hmTypes.HeimdallAddress `json:"proposer"`
StartBlock uint64 `json:"start_block"`
EndBlock uint64 `json:"end_block"`
ChainID string `json:"bor_chain_id"`
Seed common.Hash `json:"seed"`
SeedAuthor common.Address `json:"seed_author"`
}
MsgProposeSpanV2 creates msg propose span
func NewMsgProposeSpanV2 ¶ added in v1.2.0
func NewMsgProposeSpanV2( id uint64, proposer hmTypes.HeimdallAddress, startBlock uint64, endBlock uint64, chainID string, seed common.Hash, seedAuthor common.Address, ) MsgProposeSpanV2
NewMsgProposeSpan creates new propose span message
func (MsgProposeSpanV2) GetSideSignBytes ¶ added in v1.2.0
func (msg MsgProposeSpanV2) GetSideSignBytes() []byte
GetSideSignBytes returns side sign bytes
func (MsgProposeSpanV2) GetSignBytes ¶ added in v1.2.0
func (msg MsgProposeSpanV2) GetSignBytes() []byte
GetSignBytes returns sign bytes for proposeSpan message type
func (MsgProposeSpanV2) GetSigners ¶ added in v1.2.0
func (msg MsgProposeSpanV2) GetSigners() []sdk.AccAddress
GetSigners returns address of the signer
func (MsgProposeSpanV2) Route ¶ added in v1.2.0
func (msg MsgProposeSpanV2) Route() string
Route returns route for message
func (MsgProposeSpanV2) Type ¶ added in v1.2.0
func (msg MsgProposeSpanV2) Type() string
Type returns message type
func (MsgProposeSpanV2) ValidateBasic ¶ added in v1.2.0
func (msg MsgProposeSpanV2) ValidateBasic() sdk.Error
ValidateBasic validates the message and returns error
type Params ¶
type Params struct {
SprintDuration uint64 `json:"sprint_duration" yaml:"sprint_duration"` // sprint duration
SpanDuration uint64 `json:"span_duration" yaml:"span_duration"` // span duration ie number of blocks for which val set is frozen on heimdall
ProducerCount uint64 `json:"producer_count" yaml:"producer_count"` // producer count per span
}
Params defines the parameters for the auth module.
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 QuerySpanParams ¶
type QuerySpanParams struct {
RecordID uint64
}
QuerySpanParams defines the params for querying accounts.
func NewQuerySpanParams ¶
func NewQuerySpanParams(recordID uint64) QuerySpanParams
NewQuerySpanParams creates a new instance of QuerySpanParams.
type QuerySpanSeedResponse ¶ added in v1.2.0
type QuerySpanSeedResponse struct {
Seed common.Hash `json:"seed"`
SeedAuthor common.Address `json:"seed_author"`
}
QuerySpanSeedResponse defines the response to a span seed query
func NewQuerySpanSeedResponse ¶ added in v1.2.0
func NewQuerySpanSeedResponse(seed common.Hash, seedAuthor common.Address) QuerySpanSeedResponse
NewQuerySpanSeedResponse creates a new instance of QuerySpanSeedResponse.
type ResponseWithHeight ¶ added in v0.3.3
type ResponseWithHeight struct {
Height string `json:"height"`
Result json.RawMessage `json:"result"`
}
ResponseWithHeight defines a response object type that wraps an original response with a height.
type Span ¶ added in v0.3.3
type Span struct {
ID uint64 `json:"span_id" yaml:"span_id"`
StartBlock uint64 `json:"start_block" yaml:"start_block"`
EndBlock uint64 `json:"end_block" yaml:"end_block"`
}
Span Bor represents a current bor span
type Validator ¶ added in v0.3.3
type Validator struct {
ID uint64 `json:"ID"`
Address common.Address `json:"signer"`
VotingPower int64 `json:"power"`
ProposerPriority int64 `json:"accum"`
}
Validator represents Volatile state for each Validator
type ValidatorSet ¶ added in v0.3.3
type ValidatorSet struct {
// NOTE: persisted via reflect, must be exported.
Validators []*Validator `json:"validators"`
Proposer *Validator `json:"proposer"`
// contains filtered or unexported fields
}
HeimdallSpan represents span from heimdall APIs