Documentation ¶
Index ¶
- Constants
- Variables
- func GetPublicKeyAndVerifier(signer crypto.Signer) ([]byte, crypto.Verifier, error)
- func NewDistributedRootGenesis(rootGenesis []*genesis.RootGenesis) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)
- func NewPartitionRecordFromNodes(nodes []*genesis.PartitionNode) ([]*genesis.PartitionRecord, error)
- func NewRootGenesis(id string, s crypto.Signer, encPubKey []byte, ...) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)
- type CertRequestStore
- func (c *CertRequestStore) Add(request *certification.BlockCertificationRequest) error
- func (c *CertRequestStore) Clear(id p.SystemIdentifier)
- func (c *CertRequestStore) GetRequests(id p.SystemIdentifier) []*certification.BlockCertificationRequest
- func (c *CertRequestStore) IsConsensusReceived(id p.SystemIdentifier, nrOfNodes int) (*certificates.InputRecord, bool)
- func (c *CertRequestStore) Reset()
- type CertificationRequestStore
- type GenesisOption
- type Net
- type Option
- type RootChain
- type RootNodeInfo
- type State
- func (s *State) CopyOldInputRecords(id p.SystemIdentifier)
- func (s *State) CreateUnicityCertificates() (*store.RootState, error)
- func (s *State) GetLatestUnicityCertificate(id p.SystemIdentifier) (*certificates.UnicityCertificate, error)
- func (s *State) HandleBlockCertificationRequest(req *certification.BlockCertificationRequest) (*certificates.UnicityCertificate, error)
- type StateStore
Constants ¶
const ( ErrEncryptionPubKeyIsNil = "encryption public key is nil" ErrQuorumThresholdOnlyDistributed = "quorum threshold must only be less than total nodes in root chain" )
Variables ¶
var ErrSignerIsNil = errors.New("signer is nil")
Functions ¶
func GetPublicKeyAndVerifier ¶
func NewDistributedRootGenesis ¶ added in v0.1.1
func NewDistributedRootGenesis(rootGenesis []*genesis.RootGenesis) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)
func NewPartitionRecordFromNodes ¶ added in v0.1.1
func NewPartitionRecordFromNodes(nodes []*genesis.PartitionNode) ([]*genesis.PartitionRecord, error)
func NewRootGenesis ¶ added in v0.1.1
func NewRootGenesis(id string, s crypto.Signer, encPubKey []byte, partitions []*genesis.PartitionRecord, opts ...GenesisOption) (*genesis.RootGenesis, []*genesis.PartitionGenesis, error)
Types ¶
type CertRequestStore ¶ added in v0.1.1
type CertRequestStore struct {
// contains filtered or unexported fields
}
func NewCertificationRequestStore ¶ added in v0.1.1
func NewCertificationRequestStore() *CertRequestStore
NewCertificationRequestStore create new certification requests store
func (*CertRequestStore) Add ¶ added in v0.1.1
func (c *CertRequestStore) Add(request *certification.BlockCertificationRequest) error
Add request to certification store. Per node id first valid request is stored. Rest are either duplicate or equivocating and in both cases error is returned. Clear or Reset in order to receive new requests
func (*CertRequestStore) Clear ¶ added in v0.1.1
func (c *CertRequestStore) Clear(id p.SystemIdentifier)
Clear clears requests in one partition
func (*CertRequestStore) GetRequests ¶ added in v0.1.1
func (c *CertRequestStore) GetRequests(id p.SystemIdentifier) []*certification.BlockCertificationRequest
GetRequests returns all stored requests per system identifier
func (*CertRequestStore) IsConsensusReceived ¶ added in v0.1.1
func (c *CertRequestStore) IsConsensusReceived(id p.SystemIdentifier, nrOfNodes int) (*certificates.InputRecord, bool)
IsConsensusReceived has partition with id reached consensus. Required nrOfNodes as input to calculate consensus
func (*CertRequestStore) Reset ¶ added in v0.1.1
func (c *CertRequestStore) Reset()
Reset removed all incoming requests from all stores
type CertificationRequestStore ¶ added in v0.1.1
type CertificationRequestStore interface { Add(request *certification.BlockCertificationRequest) error IsConsensusReceived(id p.SystemIdentifier, nrOfNodes int) (*certificates.InputRecord, bool) GetRequests(id p.SystemIdentifier) []*certification.BlockCertificationRequest Reset() Clear(id p.SystemIdentifier) }
type GenesisOption ¶ added in v0.1.1
type GenesisOption func(c *rootGenesisConf)
func WithBlockRate ¶ added in v0.1.1
func WithBlockRate(rate uint32) GenesisOption
func WithConsensusTimeout ¶ added in v0.1.1
func WithConsensusTimeout(timeoutMs uint32) GenesisOption
func WithHashAlgorithm ¶ added in v0.1.1
func WithHashAlgorithm(hashAlgorithm gocrypto.Hash) GenesisOption
WithHashAlgorithm set custom hash algorithm (unused for now, remove?)
func WithQuorumThreshold ¶ added in v0.1.1
func WithQuorumThreshold(threshold uint32) GenesisOption
func WithTotalNodes ¶ added in v0.1.1
func WithTotalNodes(rootValidators uint32) GenesisOption
type Net ¶
type Net interface { Send(msg network.OutputMessage, receivers []peer.ID) error ReceivedChannel() <-chan network.ReceivedMessage }
Net provides an interface for sending messages to and receiving messages from other nodes in the network.
type Option ¶
type Option func(c *rootChainConf)
func WithStateStore ¶ added in v0.1.1
func WithStateStore(store StateStore) Option
func WithT3Timeout ¶
type RootChain ¶
type RootChain struct {
// contains filtered or unexported fields
}
type RootNodeInfo ¶ added in v0.1.1
type RootNodeInfo struct {
// contains filtered or unexported fields
}
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds the State of the root chain.
func NewState ¶ added in v0.1.1
func NewState(g *genesis.RootGenesis, self string, signer crypto.Signer, stateStore StateStore) (*State, error)
func NewStateFromPartitionRecords ¶
func NewStateFromPartitionRecords(partitions []*genesis.PartitionRecord, nodeId string, signer crypto.Signer, hashAlgorithm gocrypto.Hash) (*State, error)
NewStateFromPartitionRecords creates the State from the genesis.PartitionRecord array. The State returned by this method is usually used to generate genesis file.
func (*State) CopyOldInputRecords ¶
func (s *State) CopyOldInputRecords(id p.SystemIdentifier)
CopyOldInputRecords copies input records from the latest unicity certificate
func (*State) CreateUnicityCertificates ¶
CreateUnicityCertificates certifies input records and returns state containing changes (new root, round, UCs changed)
func (*State) GetLatestUnicityCertificate ¶
func (s *State) GetLatestUnicityCertificate(id p.SystemIdentifier) (*certificates.UnicityCertificate, error)
GetLatestUnicityCertificate returns last UC for system identifier
func (*State) HandleBlockCertificationRequest ¶
func (s *State) HandleBlockCertificationRequest(req *certification.BlockCertificationRequest) (*certificates.UnicityCertificate, error)