Documentation
¶
Overview ¶
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalHeight ¶
func GetCanonicalHeight(native *native.NativeService, chainID uint64) (height uint64, err error)
GetCanonicalHeight ...
Types ¶
type Handler ¶
type Handler struct { }
Handler ...
func (*Handler) SyncBlockHeader ¶
func (h *Handler) SyncBlockHeader(native *native.NativeService) error
SyncBlockHeader ...
func (*Handler) SyncCrossChainMsg ¶
func (h *Handler) SyncCrossChainMsg(native *native.NativeService) error
SyncCrossChainMsg ...
func (*Handler) SyncGenesisHeader ¶
func (h *Handler) SyncGenesisHeader(native *native.NativeService) (err error)
SyncGenesisHeader ...
type HeaderWithDifficultySum ¶
type HeaderWithDifficultySum struct { Header *types.Header `json:"header"` DifficultySum *big.Int `json:"difficultySum"` // 1. empty for epoch header // 2. for non-epoch headers, either points to epoch header or a vote header LastVoteParentOrEpoch *ecommon.Hash `json:"lastVoteParentOrEpoch"` }
HeaderWithDifficultySum ...
func GetCanonicalHeader ¶
func GetCanonicalHeader(native *native.NativeService, chainID uint64, height uint64) (headerWithSum *HeaderWithDifficultySum, err error)
GetCanonicalHeader ...
type Snapshot ¶
type Snapshot struct { Number uint64 `json:"number"` // Block number where the snapshot was created Hash common.Hash `json:"hash"` // Block hash where the snapshot was created Signers map[common.Address]struct{} `json:"signers"` // Set of authorized signers at this moment Votes []*Vote `json:"votes"` // List of votes cast in chronological order Tally map[common.Address]Tally `json:"tally"` // Current vote tally to avoid recalculating Ctx *Context }
Snapshot ...
type Tally ¶
type Tally struct { Authorize bool `json:"authorize"` // Whether the vote is about authorizing or kicking someone Votes int `json:"votes"` // Number of votes until now wanting to pass the proposal }
Tally is a simple vote tally to keep the current score of votes. Votes that go against the proposal aren't counted since it's equivalent to not voting.
type Vote ¶
type Vote struct { Signer common.Address `json:"signer"` // Authorized signer that cast this vote Block uint64 `json:"block"` // Block number the vote was cast in (expire old votes) Address common.Address `json:"address"` // Account being voted on to change its authorization Authorize bool `json:"authorize"` // Whether to authorize or deauthorize the voted account }
Vote represents a single vote that an authorized signer made to modify the list of authorizations.