Documentation
¶
Overview ¶
Package consensus defines the node-wide consensus provider contract.
Index ¶
Constants ¶
View Source
const ( // PraosProviderName is the provider name used by existing networks and // databases. PraosProviderName = "praos" // PraosIdentity versions persisted and network-visible Praos semantics. PraosIdentity = "praos/v1" // DatabaseIdentitySyncKey is the sync-state key that binds a database to // the DatabaseIdentity of the provider that created it. It must outlive // any bulk sync-state cleanup: a database that loses it is read as an // unmarked Praos database on the next start. DatabaseIdentitySyncKey = "consensus_provider_identity" )
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
RegisterProvider registers the built-in Praos provider on host.
Types ¶
type HeaderVerifier ¶
type HeaderVerifier interface {
ValidatePraosHeader(
context.Context,
ledgerpkg.Block,
bool,
bool,
) error
}
HeaderVerifier exposes the ledger-owned Praos header checks to a provider. The provider chooses the algorithm; the ledger retains all state access.
type LeaderScheduler ¶
type LeaderScheduler interface {
Start(context.Context) error
Stop() error
ShouldProduceBlock(uint64) bool
NextLeaderSlot(uint64) (uint64, bool)
}
LeaderScheduler is the production schedule selected by a Provider.
type LeaderSchedulerFactory ¶
type LeaderSchedulerFactory func(scheduleIdentity string) (LeaderScheduler, error)
LeaderSchedulerFactory lets application composition construct the concrete scheduler chosen by a provider without making the provider contract depend on ledger implementation packages.
type Provider ¶
type Provider interface {
Name() string
NetworkIdentity() string
DatabaseIdentity() string
ScheduleIdentity() string
ValidateHeader(
context.Context,
HeaderVerifier,
ledgerpkg.Block,
bool,
bool,
) error
CompareTips(
ochainsync.Tip,
ochainsync.Tip,
praos.PraosTiebreakerView,
praos.PraosTiebreakerView,
) praos.ChainComparisonResult
NewLeaderScheduler(LeaderSchedulerFactory) (LeaderScheduler, error)
}
Provider makes every consensus decision for one node instance.
func NewPraosProvider ¶
func NewPraosProvider() Provider
NewPraosProvider returns the built-in Praos provider.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package peras is the home for Dingo's Ouroboros Peras (CIP-0140) consensus support.
|
Package peras is the home for Dingo's Ouroboros Peras (CIP-0140) consensus support. |
|
Package praos contains pure Praos chain-selection primitives: the select view projected from a Shelley-family block header, VRF output extraction, and the equal-length tiebreaker comparison functions that mirror ouroboros-consensus' PraosTiebreakerView and preferCandidate logic.
|
Package praos contains pure Praos chain-selection primitives: the select view projected from a Shelley-family block header, VRF output extraction, and the equal-length tiebreaker comparison functions that mirror ouroboros-consensus' PraosTiebreakerView and preferCandidate logic. |
Click to show internal directories.
Click to hide internal directories.