Documentation
¶
Overview ¶
Package polybft implements PBFT consensus algorithm integration and bridge feature
Index ¶
- Constants
- Variables
- func Factory(params *consensus.Params) (consensus.Consensus, error)
- func GenesisPostHookFactory(config *chain.Chain, engineName string) func(txn *state.Transition) error
- func GetIbftExtraClean(extraRaw []byte) ([]byte, error)
- func NewStateProvider(transition *state.Transition) contract.Provider
- func VerifyProof(index uint64, leaf []byte, proof []types.Hash, root types.Hash) error
- func VerifyProofUsing(index uint64, leaf []byte, proof []types.Hash, root types.Hash, hash hash.Hash) error
- type AccountSet
- func (as AccountSet) ApplyDelta(validatorsDelta *ValidatorSetDelta) (AccountSet, error)
- func (as AccountSet) AsGenericMaps() []map[string]interface{}
- func (as AccountSet) ContainsAddress(address types.Address) bool
- func (as AccountSet) ContainsNodeID(nodeID string) bool
- func (as AccountSet) Copy() AccountSet
- func (as AccountSet) GetAddresses() []types.Address
- func (as AccountSet) GetBlsKeys() []*bls.PublicKey
- func (as AccountSet) GetFilteredValidators(bitmap bitmap.Bitmap) (AccountSet, error)
- func (as AccountSet) GetValidatorMetadata(address types.Address) *ValidatorMetadata
- func (as AccountSet) Hash() (types.Hash, error)
- func (as AccountSet) Index(addr types.Address) int
- func (as AccountSet) Len() int
- func (as AccountSet) Marshal() ([]byte, error)
- func (as *AccountSet) Unmarshal(b []byte) error
- type BlockBuilder
- func (b *BlockBuilder) Block() *types.Block
- func (b *BlockBuilder) Build(handler func(h *types.Header)) (*StateBlock, error)
- func (b *BlockBuilder) Fill()
- func (b *BlockBuilder) GetState() *state.Transition
- func (b *BlockBuilder) Receipts() []*types.Receipt
- func (b *BlockBuilder) Reset() error
- func (b *BlockBuilder) WriteTx(tx *types.Transaction) error
- type BlockBuilderParams
- type BridgeConfig
- type BridgeTransport
- type Bundle
- type BundleProof
- type CheckpointData
- type CommitEpoch
- type Commitment
- type CommitmentMessage
- func (cm *CommitmentMessage) BundlesCount() uint64
- func (cm *CommitmentMessage) ContainsStateSync(stateSyncIndex uint64) bool
- func (cm *CommitmentMessage) GetBundleIdxFromStateSyncEventIdx(stateSyncEventIdx uint64) uint64
- func (cm *CommitmentMessage) GetFirstStateSyncIndexFromBundleIndex(bundleIndex uint64) uint64
- func (cm *CommitmentMessage) Hash() (types.Hash, error)
- func (cm CommitmentMessage) VerifyProof(bundle *BundleProof) error
- type CommitmentMessageSigned
- type DebugConfig
- type Epoch
- type ExitEvent
- type Extra
- type IBFTConsensusWrapper
- type MerkleTree
- type MessageSignature
- type PolyBFTConfig
- type Polybft
- func (p *Polybft) Close() error
- func (p *Polybft) GetBlockCreator(h *types.Header) (types.Address, error)
- func (p *Polybft) GetBridgeProvider() consensus.BridgeDataProvider
- func (p *Polybft) GetSyncProgression() *progress.Progression
- func (p *Polybft) GetValidators(blockNumber uint64, parents []*types.Header) (AccountSet, error)
- func (p *Polybft) Initialize() error
- func (p *Polybft) Multicast(msg *proto.Message)
- func (p *Polybft) PreCommitState(_ *types.Header, _ *state.Transition) error
- func (p *Polybft) ProcessHeaders(_ []*types.Header) error
- func (p *Polybft) Start() error
- func (p *Polybft) VerifyHeader(header *types.Header) error
- type Signature
- type State
- type StateBlock
- type StateSyncEvent
- type StateTransactionInput
- type StateTransactionType
- type SystemState
- type SystemStateImpl
- type TransportMessage
- type Uptime
- type Validator
- type ValidatorMetadata
- func (a ValidatorMetadata) Copy() *ValidatorMetadata
- func (a ValidatorMetadata) Equals(b *ValidatorMetadata) bool
- func (a ValidatorMetadata) MarshalRLPWith(ar *fastrlp.Arena) *fastrlp.Value
- func (a ValidatorMetadata) String() string
- func (a *ValidatorMetadata) UnmarshalRLPWith(v *fastrlp.Value) error
- type ValidatorSet
- type ValidatorSetDelta
- type ValidatorUptime
Constants ¶
const ( // ExtraVanity represents a fixed number of extra-data bytes reserved for proposer vanity ExtraVanity = 32 // ExtraSeal represents the fixed number of extra-data bytes reserved for proposer seal ExtraSeal = 65 )
Variables ¶
var PolyBFTMixDigest = types.StringToHash("adce6e5230abe012342a44e4e9b6d05997d6f015387ae0e59be924afc7ec70c1")
PolyBFTMixDigest represents a hash of "PolyBFT Mix" to identify whether the block is from PolyBFT consensus engine
Functions ¶
func GenesisPostHookFactory ¶
func GetIbftExtraClean ¶
GetIbftExtraClean returns unmarshaled extra field from the passed in header, but without signatures for the given header (it only includes signatures for the parent block)
func NewStateProvider ¶
func NewStateProvider(transition *state.Transition) contract.Provider
NewStateProvider initializes EVM against given state and chain config and returns stateProvider instance which is an abstraction for smart contract calls
func VerifyProof ¶
VerifyProof verifies a Merkle tree proof of membership for provided data using the default hash type (Keccak256)
Types ¶
type AccountSet ¶
type AccountSet []*ValidatorMetadata
AccountSet is a type alias for slice of ValidatorMetadata instances
func (AccountSet) ApplyDelta ¶
func (as AccountSet) ApplyDelta(validatorsDelta *ValidatorSetDelta) (AccountSet, error)
ApplyDelta receives ValidatorSetDelta and applies it to the values from the current AccountSet (removes the ones marked for deletion and adds the one which are being added by delta) Function returns new AccountSet with old and new data merged. AccountSet is immutable!
func (AccountSet) AsGenericMaps ¶
func (as AccountSet) AsGenericMaps() []map[string]interface{}
AsGenericMaps convert AccountSet object to slice of maps, where each key denotes field name mapped to a value
func (AccountSet) ContainsAddress ¶
func (as AccountSet) ContainsAddress(address types.Address) bool
ContainsAddress checks whether ValidatorMetadata with given address is present in the AccountSet
func (AccountSet) ContainsNodeID ¶
func (as AccountSet) ContainsNodeID(nodeID string) bool
ContainsNodeID checks whether ValidatorMetadata with given nodeID is present in the AccountSet
func (AccountSet) Copy ¶
func (as AccountSet) Copy() AccountSet
Copy returns deep copy of AccountSet
func (AccountSet) GetAddresses ¶
func (as AccountSet) GetAddresses() []types.Address
GetAddresses aggregates addresses for given AccountSet
func (AccountSet) GetBlsKeys ¶
func (as AccountSet) GetBlsKeys() []*bls.PublicKey
GetBlsKeys aggregates public BLS keys for given AccountSet
func (AccountSet) GetFilteredValidators ¶
func (as AccountSet) GetFilteredValidators(bitmap bitmap.Bitmap) (AccountSet, error)
GetFilteredValidators returns filtered validators based on provided bitmap. Filtered validators will contain validators whose index corresponds to the position in bitmap which has value set to 1.
func (AccountSet) GetValidatorMetadata ¶
func (as AccountSet) GetValidatorMetadata(address types.Address) *ValidatorMetadata
GetValidatorMetadata tries to retrieve validator account metadata by given address from the account set. It returns nil if such account is not found.
func (AccountSet) Hash ¶
func (as AccountSet) Hash() (types.Hash, error)
Hash returns hash value of the AccountSet
func (AccountSet) Index ¶
func (as AccountSet) Index(addr types.Address) int
Index returns index of the given ValidatorMetadata, identified by address within the AccountSet. If given ValidatorMetadata is not present, it returns -1.
func (AccountSet) Marshal ¶
func (as AccountSet) Marshal() ([]byte, error)
Marshal marshals AccountSet to JSON
func (*AccountSet) Unmarshal ¶
func (as *AccountSet) Unmarshal(b []byte) error
Unmarshal unmarshals AccountSet from JSON
type BlockBuilder ¶
type BlockBuilder struct {
// contains filtered or unexported fields
}
func NewBlockBuilder ¶
func NewBlockBuilder(params *BlockBuilderParams) (*BlockBuilder, error)
func (*BlockBuilder) Block ¶
func (b *BlockBuilder) Block() *types.Block
Block returns the built block if nil, it is not built yet
func (*BlockBuilder) Build ¶
func (b *BlockBuilder) Build(handler func(h *types.Header)) (*StateBlock, error)
Build creates the state and the final block
func (*BlockBuilder) Fill ¶
func (b *BlockBuilder) Fill()
Fill fills the block with transactions from the txpool
func (*BlockBuilder) GetState ¶
func (b *BlockBuilder) GetState() *state.Transition
GetState returns Transition reference
func (*BlockBuilder) Receipts ¶
func (b *BlockBuilder) Receipts() []*types.Receipt
Receipts returns the collection of transaction receipts for given block
func (*BlockBuilder) Reset ¶
func (b *BlockBuilder) Reset() error
Reset is used to indicate that the current block building has been interrupted and it has to clean any data
func (*BlockBuilder) WriteTx ¶
func (b *BlockBuilder) WriteTx(tx *types.Transaction) error
WriteTx applies given transaction to the state. If transaction apply fails, it reverts the saved snapshot.
type BlockBuilderParams ¶
type BlockBuilderParams struct { // Parent block Parent *types.Header // Executor Executor *state.Executor // Coinbase that is signing the block Coinbase types.Address // Vanity extra for the block Extra []byte // GasLimit is the gas limit for the block GasLimit uint64 // duration for one block BlockTime time.Duration // Logger Logger hcf.Logger // txPoolInterface implementation TxPool txPoolInterface }
BlockBuilderParams are fields for the block that cannot be changed
type BridgeConfig ¶
type BridgeConfig struct { BridgeAddr types.Address `json:"bridgeAddr"` CheckpointAddr types.Address `json:"checkpointAddr"` JSONRPCEndpoint string `json:"jsonRPCEndpoint"` }
BridgeConfig is the configuration for the bridge
type BridgeTransport ¶
type BridgeTransport interface {
Multicast(msg interface{})
}
BridgeTransport is an abstraction of network layer for a bridge
type BundleProof ¶
BundleProof contains the proof of a bundle
func (*BundleProof) DecodeAbi ¶
func (bp *BundleProof) DecodeAbi(txData []byte) error
DecodeAbi contains logic for decoding given ABI data
func (*BundleProof) EncodeAbi ¶
func (bp *BundleProof) EncodeAbi() ([]byte, error)
EncodeAbi contains logic for encoding arbitrary data into ABI format
func (*BundleProof) ID ¶
func (bp *BundleProof) ID() uint64
ID returns identificator of bundle proof, which correspond to its first state sync id
func (*BundleProof) Type ¶
func (bp *BundleProof) Type() StateTransactionType
Type returns type of state transaction input
type CheckpointData ¶
type CheckpointData struct { BlockRound uint64 EpochNumber uint64 CurrentValidatorsHash types.Hash NextValidatorsHash types.Hash EventRoot types.Hash }
CheckpointData represents data needed for checkpointing mechanism
func (*CheckpointData) Copy ¶
func (c *CheckpointData) Copy() *CheckpointData
Copy returns deep copy of CheckpointData instance
func (*CheckpointData) Hash ¶
func (c *CheckpointData) Hash(chainID uint64, blockNumber uint64, blockHash types.Hash) (types.Hash, error)
Hash calculates keccak256 hash of the CheckpointData. CheckpointData is ABI encoded and then hashed.
func (*CheckpointData) MarshalRLPWith ¶
func (c *CheckpointData) MarshalRLPWith(ar *fastrlp.Arena) *fastrlp.Value
MarshalRLPWith defines the marshal function implementation for CheckpointData
func (*CheckpointData) UnmarshalRLPWith ¶
func (c *CheckpointData) UnmarshalRLPWith(v *fastrlp.Value) error
UnmarshalRLPWith unmarshals CheckpointData object from the RLP format
type CommitEpoch ¶
type CommitEpoch struct { EpochID uint64 `abi:"epochid"` Epoch Epoch `abi:"epoch"` Uptime Uptime `abi:"uptime"` }
CommitEpoch contains data that is sent to ChildValidatorSet contract to distribute rewards on the end of an epoch
func (*CommitEpoch) DecodeAbi ¶
func (c *CommitEpoch) DecodeAbi(txData []byte) error
DecodeAbi decodes the commit epoch object from the given transaction
func (*CommitEpoch) EncodeAbi ¶
func (c *CommitEpoch) EncodeAbi() ([]byte, error)
EncodeAbi encodes the commit epoch object to be placed in a transaction
func (*CommitEpoch) Type ¶
func (c *CommitEpoch) Type() StateTransactionType
Type returns the state transaction type for given data
type Commitment ¶
type Commitment struct { MerkleTree *MerkleTree Epoch uint64 FromIndex uint64 ToIndex uint64 LeavesNum uint64 }
Commitment holds merkle trie of bridge transactions accompanied by epoch number
func NewCommitment ¶
func NewCommitment(epoch, fromIndex, toIndex, bundleSize uint64, stateSyncEvents []*StateSyncEvent) (*Commitment, error)
NewCommitment creates a new commitment object
type CommitmentMessage ¶
type CommitmentMessage struct { MerkleRootHash types.Hash FromIndex uint64 ToIndex uint64 Epoch uint64 BundleSize uint64 }
CommitmentMessage holds metadata for bridge transactions
func NewCommitmentMessage ¶
func NewCommitmentMessage(merkleRootHash types.Hash, fromIndex, toIndex, bundleSize uint64) *CommitmentMessage
NewCommitmentMessage creates a new commitment message based on provided merkle root hash where fromIndex represents an id of the first state event index in commitment where toIndex represents an id of the last state event index in commitment where bundleSize represents the number of bundles (leafs) in commitment
func (*CommitmentMessage) BundlesCount ¶
func (cm *CommitmentMessage) BundlesCount() uint64
BundlesCount calculates bundles count contained in given CommitmentMessge
func (*CommitmentMessage) ContainsStateSync ¶
func (cm *CommitmentMessage) ContainsStateSync(stateSyncIndex uint64) bool
ContainsStateSync checks whether CommitmentMessage contains state sync event identified by index, by comparing given state sync index with the bounds of CommitmentMessage
func (*CommitmentMessage) GetBundleIdxFromStateSyncEventIdx ¶
func (cm *CommitmentMessage) GetBundleIdxFromStateSyncEventIdx(stateSyncEventIdx uint64) uint64
GetBundleIdxFromStateSyncEventIdx resolves bundle index based on given state sync event index
func (*CommitmentMessage) GetFirstStateSyncIndexFromBundleIndex ¶
func (cm *CommitmentMessage) GetFirstStateSyncIndexFromBundleIndex(bundleIndex uint64) uint64
GetFirstStateSyncIndexFromBundleIndex returns first state sync index based on bundle size and given bundle index (offseted by FromIndex in CommitmentMessage)
func (*CommitmentMessage) Hash ¶
func (cm *CommitmentMessage) Hash() (types.Hash, error)
Hash calculates hash value for commitment object.
func (CommitmentMessage) VerifyProof ¶
func (cm CommitmentMessage) VerifyProof(bundle *BundleProof) error
VerifyProof validates given bundle proof against merkle trie root hash contained in the CommitmentMessage
type CommitmentMessageSigned ¶
type CommitmentMessageSigned struct { Message *CommitmentMessage AggSignature Signature PublicKeys [][]byte }
CommitmentMessageSigned encapsulates commitment message with aggregated signatures
func (*CommitmentMessageSigned) DecodeAbi ¶
func (cm *CommitmentMessageSigned) DecodeAbi(txData []byte) error
DecodeAbi contains logic for decoding given ABI data
func (*CommitmentMessageSigned) EncodeAbi ¶
func (cm *CommitmentMessageSigned) EncodeAbi() ([]byte, error)
EncodeAbi contains logic for encoding arbitrary data into ABI format
func (*CommitmentMessageSigned) Type ¶
func (cm *CommitmentMessageSigned) Type() StateTransactionType
Type returns type of state transaction input
type DebugConfig ¶
type DebugConfig struct {
ValidatorSetSize uint64 `json:"validatorSetSize"`
}
DebugConfig is a struct used for test configuration in init genesis
type Epoch ¶
type Epoch struct { StartBlock uint64 `abi:"startblock"` EndBlock uint64 `abi:"endblock"` EpochRoot types.Hash `abi:"epochroot"` }
Epoch holds the data about epoch execution (when it started and when it ended)
type ExitEvent ¶
type ExitEvent struct { // ID is the decoded 'index' field from the event ID uint64 `abi:"id"` // Sender is the decoded 'sender' field from the event Sender ethgo.Address `abi:"sender"` // Receiver is the decoded 'receiver' field from the event Receiver ethgo.Address `abi:"receiver"` // Data is the decoded 'data' field from the event Data []byte `abi:"data"` // EpochNumber is the epoch number in which exit event was added EpochNumber uint64 `abi:"-"` // BlockNumber is the block in which exit event was added BlockNumber uint64 `abi:"-"` }
ExitEvent is an event emitted by Exit contract
type Extra ¶
type Extra struct { Validators *ValidatorSetDelta Seal []byte Parent *Signature Committed *Signature Checkpoint *CheckpointData }
Extra defines the structure of the extra field for Istanbul
func GetIbftExtra ¶
GetIbftExtra returns the istanbul extra data field from the passed in header
func (*Extra) MarshalRLPTo ¶
MarshalRLPTo defines the marshal function wrapper for Extra
func (*Extra) MarshalRLPWith ¶
MarshalRLPWith defines the marshal function implementation for Extra
func (*Extra) UnmarshalRLP ¶
UnmarshalRLP defines the unmarshal function wrapper for Extra
type IBFTConsensusWrapper ¶
IBFTConsensusWrapper is a convenience wrapper for the go-ibft package
type MerkleTree ¶
type MerkleTree struct {
// contains filtered or unexported fields
}
MerkleTree is the structure for the Merkle tree.
func NewMerkleTree ¶
func NewMerkleTree(data [][]byte) (*MerkleTree, error)
NewMerkleTree creates a new Merkle tree from the provided data and using the default hashing (Keccak256).
func NewMerkleTreeWithHashing ¶
func NewMerkleTreeWithHashing(data [][]byte, hash hash.Hash) (*MerkleTree, error)
NewMerkleTreeWithHashing creates a new Merkle tree from the provided data and hash type
func (*MerkleTree) GenerateProof ¶
func (t *MerkleTree) GenerateProof(index uint64, height int) []types.Hash
GenerateProof generates the proof of membership for a piece of data in the Merkle tree.
func (*MerkleTree) GenerateProofForLeaf ¶
GenerateProofForLeaf generates the proof of membership for a piece of data in the Merkle tree. If the data is not present in the tree this will return an error
func (*MerkleTree) LeafIndex ¶
func (t *MerkleTree) LeafIndex(leaf []byte) (uint64, error)
LeafIndex returns the index of given leaf if found in tree
func (*MerkleTree) String ¶
func (t *MerkleTree) String() string
String implements the stringer interface
type MessageSignature ¶
type MessageSignature struct { // Signer of the vote From string // Signature of the message Signature []byte }
MessageSignature encapsulates sender identifier and its signature
type PolyBFTConfig ¶
type PolyBFTConfig struct { InitialValidatorSet []*Validator `json:"initialValidatorSet"` Bridge *BridgeConfig `json:"bridge"` ValidatorSetSize int `json:"validatorSetSize"` // Address of the system contracts, as of now (testing) this is populated automatically during genesis ValidatorSetAddr types.Address `json:"validatorSetAddr"` StateReceiverAddr types.Address `json:"stateReceiverAddr"` // size of the epoch and sprint EpochSize uint64 `json:"epochSize"` SprintSize uint64 `json:"sprintSize"` BlockTime time.Duration `json:"blockTime"` // Governance is the initial governance address Governance types.Address `json:"governance"` }
PolyBFTConfig is the configuration file for the Polybft consensus protocol.
func (*PolyBFTConfig) IsBridgeEnabled ¶
func (p *PolyBFTConfig) IsBridgeEnabled() bool
type Polybft ¶
type Polybft struct {
// contains filtered or unexported fields
}
func (*Polybft) GetBlockCreator ¶
GetBlockCreator retrieves the block creator (or signer) given the block header
func (*Polybft) GetBridgeProvider ¶
func (p *Polybft) GetBridgeProvider() consensus.BridgeDataProvider
GetBridgeProvider returns an instance of BridgeDataProvider
func (*Polybft) GetSyncProgression ¶
func (p *Polybft) GetSyncProgression() *progress.Progression
GetSyncProgression retrieves the current sync progression, if any
func (*Polybft) GetValidators ¶
func (*Polybft) Initialize ¶
Initialize initializes the consensus (e.g. setup data)
func (*Polybft) PreCommitState ¶
PreCommitState a hook to be called before finalizing state transition on inserting block
func (*Polybft) ProcessHeaders ¶
ProcessHeaders updates the snapshot based on the verified headers
type Signature ¶
Signature represents aggregated signatures of signers accompanied with a bitmap (in order to be able to determine identities of each signer)
func (*Signature) MarshalRLPWith ¶
MarshalRLPWith marshals Signature object into RLP format
func (*Signature) UnmarshalRLPWith ¶
UnmarshalRLPWith unmarshals Signature object from the RLP format
func (*Signature) VerifyCommittedFields ¶
func (s *Signature) VerifyCommittedFields(validatorSet AccountSet, hash types.Hash) error
VerifyCommittedFields is checking for consensus proof in the header
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents a persistence layer which persists consensus data off-chain
type StateBlock ¶
StateBlock is a block with the full state it modifies
type StateSyncEvent ¶
type StateSyncEvent struct { // ID is the decoded 'index' field from the event ID uint64 // Sender is the decoded 'sender' field from the event Sender ethgo.Address // Receiver is the decoded 'receiver' field from the event Receiver ethgo.Address // Data is the decoded 'data' field from the event Data []byte // Skip is the decoded 'skip' field from the event Skip bool }
StateSyncEvent is a bridge event from the rootchain
func (*StateSyncEvent) String ¶
func (s *StateSyncEvent) String() string
type StateTransactionInput ¶
type StateTransactionInput interface { // EncodeAbi contains logic for encoding arbitrary data into ABI format EncodeAbi() ([]byte, error) // DecodeAbi contains logic for decoding given ABI data DecodeAbi(b []byte) error // Type returns type of state transaction input Type() StateTransactionType }
StateTransactionInput is an abstraction for different state transaction inputs
type StateTransactionType ¶
type StateTransactionType string
StateTransactionType is a type, which represents state transaction type
type SystemState ¶
type SystemState interface { // GetValidatorSet retrieves current validator set from the smart contract GetValidatorSet() (AccountSet, error) // GetEpoch retrieves current epoch number from the smart contract GetEpoch() (uint64, error) // GetNextExecutionIndex retrieves next bridge state sync index GetNextExecutionIndex() (uint64, error) // GetNextCommittedIndex retrieves next committed bridge state sync index GetNextCommittedIndex() (uint64, error) }
SystemState is an interface to interact with the consensus system contracts in the chain
type SystemStateImpl ¶
type SystemStateImpl struct {
// contains filtered or unexported fields
}
SystemStateImpl is implementation of SystemState interface
func NewSystemState ¶
func NewSystemState(config *PolyBFTConfig, provider contract.Provider) *SystemStateImpl
NewSystemState initializes new instance of systemState which abstracts smart contracts functions
func (*SystemStateImpl) GetEpoch ¶
func (s *SystemStateImpl) GetEpoch() (uint64, error)
GetEpoch retrieves current epoch number from the smart contract
func (*SystemStateImpl) GetNextCommittedIndex ¶
func (s *SystemStateImpl) GetNextCommittedIndex() (uint64, error)
GetNextCommittedIndex retrieves next committed bridge state sync index
func (*SystemStateImpl) GetNextExecutionIndex ¶
func (s *SystemStateImpl) GetNextExecutionIndex() (uint64, error)
GetNextExecutionIndex retrieves next bridge state sync index
func (*SystemStateImpl) GetValidatorSet ¶
func (s *SystemStateImpl) GetValidatorSet() (AccountSet, error)
GetValidatorSet retrieves current validator set from the smart contract
type TransportMessage ¶
type TransportMessage struct { // Hash is encoded data Hash []byte // Message signature Signature []byte // Node identifier NodeID string // Number of epoch EpochNumber uint64 }
TransportMessage represents the payload which is gossiped across the network
type Uptime ¶
type Uptime struct { EpochID uint64 `abi:"epochid"` UptimeData []ValidatorUptime `abi:"uptimedata"` TotalUptime uint64 `abi:"totaluptime"` }
Uptime holds the data about number of times validators sealed blocks in a given epoch
type Validator ¶
type Validator struct { Address types.Address `json:"address"` BlsKey string `json:"blsKey"` Balance *big.Int `json:"balance"` }
func (*Validator) MarshalJSON ¶
func (*Validator) UnmarshalJSON ¶
type ValidatorMetadata ¶
ValidatorMetadata represents a validator metadata (its public identity)
func (ValidatorMetadata) Copy ¶
func (a ValidatorMetadata) Copy() *ValidatorMetadata
Copy returns a deep copy of ValidatorMetadata
func (ValidatorMetadata) Equals ¶
func (a ValidatorMetadata) Equals(b *ValidatorMetadata) bool
Equals compares ValidatorMetadata equality
func (ValidatorMetadata) MarshalRLPWith ¶
func (a ValidatorMetadata) MarshalRLPWith(ar *fastrlp.Arena) *fastrlp.Value
MarshalRLPWith marshals ValidatorMetadata to the RLP format
func (ValidatorMetadata) String ¶
func (a ValidatorMetadata) String() string
fmt.Stringer implementation
func (*ValidatorMetadata) UnmarshalRLPWith ¶
func (a *ValidatorMetadata) UnmarshalRLPWith(v *fastrlp.Value) error
UnmarshalRLPWith unmarshals ValidatorMetadata from the RLP format
type ValidatorSet ¶
type ValidatorSet interface { // CalcProposer calculates next proposer based on the passed round CalcProposer(round uint64) types.Address // Includes checks if the passed address in included in the current validator set Includes(address types.Address) bool // Len returns the size of the validator set Len() int // Accounts returns the list of the ValidatorMetadata Accounts() AccountSet }
ValidatorSet interface of the current validator set
type ValidatorSetDelta ¶
type ValidatorSetDelta struct { // Added is the list of new validators for the epoch Added AccountSet // Removed is a bitmap of the validators removed from the set Removed bitmap.Bitmap }
ValidatorSetDelta holds information about added and removed validators compared to the previous epoch
func (*ValidatorSetDelta) Copy ¶
func (d *ValidatorSetDelta) Copy() *ValidatorSetDelta
Copy creates deep copy of ValidatorSetDelta
func (*ValidatorSetDelta) IsEmpty ¶
func (d *ValidatorSetDelta) IsEmpty() bool
IsEmpty returns indication whether delta is empty (namely added and removed slices are empty)
func (*ValidatorSetDelta) MarshalRLPWith ¶
func (d *ValidatorSetDelta) MarshalRLPWith(ar *fastrlp.Arena) *fastrlp.Value
MarshalRLPWith marshals ValidatorSetDelta to RLP format
func (*ValidatorSetDelta) String ¶
func (d *ValidatorSetDelta) String() string
fmt.Stringer interface implementation
func (*ValidatorSetDelta) UnmarshalRLPWith ¶
func (d *ValidatorSetDelta) UnmarshalRLPWith(v *fastrlp.Value) error
UnmarshalRLPWith unmarshals ValidatorSetDelta from RLP format
type ValidatorUptime ¶
ValidatorUptime contains data about how many blocks a given validator has sealed in a single period (epoch)
Source Files
¶
- block_builder.go
- blockchain_wrapper.go
- checkpoint_manager.go
- consensus_runtime.go
- contracts_initializer.go
- event_tracker.go
- extra.go
- fsm.go
- hash.go
- ibft_consensus.go
- merkle_tree.go
- polybft.go
- polybft_config.go
- runtime_helpers.go
- state.go
- state_transaction.go
- system_state.go
- transport.go
- validator_metadata.go
- validator_set.go
- validators_snapshot.go