ouroboros-consensus-0.1.0.1: Consensus layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Protocol.PBFT.State

Description

PBFT chain state

Intended for qualified import.

Synopsis

Documentation

data PBftSigner c Source #

Slot and corresponding genesis key

Instances

Instances details
PBftCrypto c => Eq ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

PBftCrypto c => Show ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Generic ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Associated Types

type Rep ( PBftSigner c) :: Type -> Type Source #

PBftCrypto c => NoThunks ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Serialise ( PBftVerKeyHash c) => Serialise ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

type Rep ( PBftSigner c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

type Rep ( PBftSigner c) = D1 (' MetaData "PBftSigner" "Ouroboros.Consensus.Protocol.PBFT.State" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' False ) ( C1 (' MetaCons "PBftSigner" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "pbftSignerSlotNo") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo ) :*: S1 (' MetaSel (' Just "pbftSignerGenesisKey") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( PBftVerKeyHash c))))

data PBftState c Source #

PBFT state

For a window size of n , the PBFT chain state is a sequence of signatures over the last n slots

+-------------------------------------------+
|                signatures                 |
+-------------------------------------------+

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 window of n

We need the last n signatures to verify that no single key has signed more than a certain threshold percentage of the slots.

When near genesis, we will have less than n signatures in the history.

The window size itself is pretty much arbitrary and will be fixed by a particular blockchain specification (e.g., Byron).

Constructors

PBftState

Fields

Instances

Instances details
PBftCrypto c => Eq ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

PBftCrypto c => Show ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Generic ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Associated Types

type Rep ( PBftState c) :: Type -> Type Source #

PBftCrypto c => NoThunks ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

type Rep ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

type Rep ( PBftState c) = D1 (' MetaData "PBftState" "Ouroboros.Consensus.Protocol.PBFT.State" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' False ) ( C1 (' MetaCons "PBftState" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "inWindow") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( StrictSeq ( PBftSigner c))) :*: S1 (' MetaSel (' Just "counts") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map ( PBftVerKeyHash c) Word64 ))))
data Ticked ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT

data family Ticked st :: Type Source #

" Ticked " piece of state ( LedgerState , LedgerView , ChainIndepState )

Ticking refers to the passage of time (the ticking of the clock). When a piece of state is marked as ticked, it means that time-related changes have been applied to the state (or forecast).

Some examples of time related changes:

  • Scheduled delegations might have been applied in Byron
  • New leader schedule computed for Shelley
  • Transition from Byron to Shelley activated in the hard fork combinator.
  • Nonces switched out at the start of a new epoch.

Instances

Instances details
Show ( Ticked ()) Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

Show ( Ticked a) => Show ( Ticked ( K a x)) Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

( SListI xs, Show ( Ticked a)) => Show ( Ticked ( HardForkLedgerView_ ( K a :: Type -> Type ) xs)) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.LedgerView

Generic ( Ticked ( LedgerState ( HardForkBlock xs))) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

NoThunks ( Ticked ( LedgerState ( DualBlock m a))) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

CanHardFork xs => NoThunks ( Ticked ( LedgerState ( HardForkBlock xs))) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

Bridge m a => GetTip ( Ticked ( LedgerState ( DualBlock m a))) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

CanHardFork xs => GetTip ( Ticked ( LedgerState ( HardForkBlock xs))) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

IsLedger ( LedgerState blk) => GetTip ( Ticked ( ExtLedgerState blk)) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

IsLedger l => GetTip ( Ticked ( LedgerDB l)) Source #
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.InMemory

Isomorphic ( Ticked :.: LedgerState ) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

Show ( Ticked (f a)) => Show (( Ticked :.: f) a) Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

NoThunks ( Ticked (f a)) => NoThunks (( Ticked :.: f) a) Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

data Ticked () Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

type Rep ( Ticked ( LedgerState ( HardForkBlock xs))) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

type Rep ( Ticked ( LedgerState ( HardForkBlock xs))) = D1 (' MetaData "Ticked" "Ouroboros.Consensus.HardFork.Combinator.Ledger" "ouroboros-consensus-0.1.0.1-DT4Cvwf63DZKctsEvaJqCU" ' False ) ( C1 (' MetaCons "TickedHardForkLedgerState" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "tickedHardForkLedgerStateTransition") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TransitionInfo ) :*: S1 (' MetaSel (' Just "tickedHardForkLedgerStatePerEra") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( HardForkState ( Ticked :.: LedgerState ) xs))))
type HeaderHash ( Ticked l) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Basics

data Ticked ( LedgerState ( DualBlock m a)) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

data Ticked ( LedgerState ( HardForkBlock xs)) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

data Ticked ( HeaderState blk) Source #
Instance details

Defined in Ouroboros.Consensus.HeaderValidation

newtype Ticked ( WrapLedgerView blk) Source #
Instance details

Defined in Ouroboros.Consensus.TypeFamilyWrappers

newtype Ticked ( WrapChainDepState blk) Source #
Instance details

Defined in Ouroboros.Consensus.TypeFamilyWrappers

data Ticked ( ExtLedgerState blk) Source #
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

data Ticked ( LedgerDB l) Source #

Ticking the ledger DB just ticks the current state

We don't push the new state into the DB until we apply a block.

Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.InMemory

data Ticked ( HardForkChainDepState xs) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol

data Ticked ( PBftState c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT

newtype Ticked ( PBftLedgerView c) Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT

data Ticked ( HardForkLedgerView_ f xs) Source #
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol.LedgerView

newtype Ticked ( K a x) Source #
Instance details

Defined in Ouroboros.Consensus.Ticked

newtype WindowSize Source #

Window size

See PBftState itself for a detailed discussion on the window size versus the number of signatures.

Instances

Instances details
Enum WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Eq WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Integral WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Num WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Ord WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Real WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Show WindowSize Source #
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT.State

Construction

append :: forall c. PBftCrypto c => WindowSize -> PBftSigner c -> PBftState c -> PBftState c Source #

Append new signature

Drops the oldest signature, provided we have reached the required number.

empty :: PBftState c Source #

Empty PBFT chain state

In other words, the PBFT chain state corresponding to genesis.

Queries

countSignatures :: PBftState c -> Word64 Source #

Number of signatures in the window

This will be equal to the specified window size, unless near genesis

countSignedBy :: PBftCrypto c => PBftState c -> PBftVerKeyHash c -> Word64 Source #

The number of blocks signed by the specified genesis key

This only considers the signatures within the window, not in the pre-window; see PBftState for detailed discussion.

lastSignedSlot :: PBftState c -> WithOrigin SlotNo Source #

The last (most recent) signed slot in the window

Returns Origin if there are no signatures in the window (this will happen exactly at genesis only).

Unaffected by EBBs, since they're not signed.

Conversion

fromList :: PBftCrypto c => [ PBftSigner c] -> PBftState c Source #

Note: we are not checking the invariants because we don't want to require the WindowSize to be in the context, see #2383. When assertions are enabled, we would notice the invariant violation as soon as we append .

PRECONDITION: the slots of the signers are in ascending order.

Serialization