partitions

package
v1.0.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeInfo

type NodeInfo struct {
	NodeID  string    `json:"nodeId"`  // libp2p node id (hash of libp2p encryption public key)
	AuthKey hex.Bytes `json:"authKey"` // libp2p encryption public key
	SigKey  hex.Bytes `json:"sigKey"`  // alphabill signing public key
	// contains filtered or unexported fields
}

func NewVARNodeFromGenesisNode

func NewVARNodeFromGenesisNode(pn *genesis.PartitionNode) NodeInfo

func (*NodeInfo) Verify

func (v *NodeInfo) Verify() error

Verify verifies the node id is derived from the auth key

type Orchestration

type Orchestration struct {
	// contains filtered or unexported fields
}

func NewOrchestration

func NewOrchestration(seed *genesis.RootGenesis, dbFile string) (*Orchestration, error)

NewOrchestration creates new boltDB implementation of shard validator orchestration.

  • seed is the root genesis file used to generate db schema and the first VARs.
  • dbFile is filename (full path) to the Bolt DB file to use for storage, if the file does not exist it will be created;

func (*Orchestration) AddShardConfig

func (o *Orchestration) AddShardConfig(rec *ValidatorAssignmentRecord) error

AddShardConfig verifies and stores the given VAR.

Validation rules:

  • The network ID must match
  • The partition ID must match one of the existing partitions
  • The shard ID must be 0x80 (CBOR encoding of the empty bitstring)
  • The new epoch number must be one greater than the current epoch of the only shard in the specified partition
  • The activation round number must be strictly greater than the current round of the only shard in the specified partition
  • The node identifiers must match their authentication keys

func (*Orchestration) Close

func (o *Orchestration) Close() error

func (*Orchestration) PartitionDescription

func (o *Orchestration) PartitionDescription(partitionID types.PartitionID, epoch uint64) (*types.PartitionDescriptionRecord, error)

func (*Orchestration) RoundPartitions

func (o *Orchestration) RoundPartitions(rootRound uint64) ([]*types.PartitionDescriptionRecord, error)

RoundPartitions returns Partition Descriptions active on the given RootChain round.

func (*Orchestration) ShardConfig

func (o *Orchestration) ShardConfig(partition types.PartitionID, shard types.ShardID, epoch uint64) (*ValidatorAssignmentRecord, error)

ShardConfig returns VAR for the given shard epoch.

func (*Orchestration) ShardEpoch

func (o *Orchestration) ShardEpoch(partition types.PartitionID, shard types.ShardID, shardRound uint64) (uint64, error)

ShardEpoch returns the active epoch number for the given round in a shard.

type TrustBase

type TrustBase struct {
	PartitionTrustBase map[string]abcrypto.Verifier
}

func NewPartitionTrustBase

func NewPartitionTrustBase(tb map[string]abcrypto.Verifier) *TrustBase

func (*TrustBase) GetQuorum

func (v *TrustBase) GetQuorum() uint64

GetQuorum calculates and returns minimum number of nodes required for a quorum

func (*TrustBase) GetTotalNodes

func (v *TrustBase) GetTotalNodes() uint64

GetTotalNodes returns total number of registered validator nodes

func (*TrustBase) NodeIDs

func (v *TrustBase) NodeIDs() []string

func (*TrustBase) Verify

func (v *TrustBase) Verify(nodeId string, f func(v abcrypto.Verifier) error) error

type ValidatorAssignmentRecord

type ValidatorAssignmentRecord struct {
	NetworkID   types.NetworkID   `json:"networkId"`
	PartitionID types.PartitionID `json:"partitionId"`
	ShardID     types.ShardID     `json:"shardId"`
	EpochNumber uint64            `json:"epochNo"`
	RoundNumber uint64            `json:"roundNo"`
	Nodes       []NodeInfo        `json:"nodes"`
	// contains filtered or unexported fields
}

func NewVARFromGenesis

TODO partition genesis record should support multi-shard nodes i.e. currently we create one VAR per partition, but should create one VAR per shard

func (*ValidatorAssignmentRecord) Verify

Verify verifies the provided VAR extends the previous VAR.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL