cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone




Re-exports of Pos.Ssc.Class.* modules.



class Ssc ssc => SscListenersClass ssc where Source #

Class for defining listeners in DHT SSC implementation.

Minimal complete definition

sscListeners, sscStubListeners

type LocalQuery ssc a = forall m. (MonadReader (SscLocalData ssc) m, WithLogger m) => m a Source #

type LocalUpdate ssc a = forall m. (MonadState (SscLocalData ssc) m, WithLogger m) => m a Source #

class Ssc ssc => SscLocalDataClass ssc where Source #

This type class abstracts local data used for SSC. Local means that it is not stored in blocks.


sscGetLocalPayloadQ :: SlotId -> LocalQuery ssc (SscPayload ssc) Source #

Get local payload to be put into main block and for given SlotId. If payload for given SlotId can't be constructed, empty payload can be returned.

sscNormalizeU :: EpochIndex -> RichmenStake -> SscGlobalState ssc -> LocalUpdate ssc () Source #

Make SscLocalData valid for given epoch, richmen and global state. of best known chain).

sscNewLocalData :: (MonadSlots m, MonadDB m) => m (SscLocalData ssc) Source #

Create new (empty) local data. We are using this function instead of Default class, because it gives more flexibility. For instance, one can read something from DB or get current slot.


class Ssc ssc => SscGStateClass ssc where Source #


sscLoadGlobalState :: (MonadDB m, WithLogger m) => m (SscGlobalState ssc) Source #

Load global state from DB by recreating it from recent blocks.

sscGlobalStateToBatch :: SscGlobalState ssc -> Tagged ssc [SomeBatchOp] Source #

Dump global state to DB.

sscRollbackU :: NewestFirst NE (Block ssc) -> SscGlobalUpdate ssc () Source #

Rollback application of blocks.

sscVerifyAndApplyBlocks :: RichmenStake -> OldestFirst NE (Block ssc) -> SscVerifier ssc () Source #

Verify SSC-related part of given blocks with respect to current GState and apply them on success. Blocks must be from the same epoch.

sscCalculateSeedQ :: EpochIndex -> RichmenStake -> SscGlobalQuery ssc (Either (SscSeedError ssc) SharedSeed) Source #

Calculate SharedSeed for given epoch using SscGlobalState.

type SscGlobalQuery ssc a = forall m. (MonadReader (SscGlobalState ssc) m, WithLogger m) => m a Source #

type SscGlobalUpdate ssc a = forall m. (MonadState (SscGlobalState ssc) m, WithLogger m) => m a Source #

type SscVerifier ssc a = forall m. SscVerifyMode ssc m => m a Source #

class (Typeable ssc, Typeable (SscPayload ssc), Typeable (SscProof ssc), Typeable (SscSeedError ssc), Eq (SscProof ssc), Eq (SscGlobalState ssc), Show (SscProof ssc), Show (SscPayload ssc), Buildable (SscPayload ssc), Buildable (SscSeedError ssc), Buildable (SscVerifyError ssc), Buildable (SscGlobalState ssc), Bi (SscProof ssc), Bi (SscPayload ssc), NFData (SscPayload ssc), NFData (SscProof ssc)) => Ssc ssc where Source #

Main Shared Seed Calculation type class. Stores all needed type parameters for general implementation of SSC.

Minimal complete definition

mkSscProof, sscCreateNodeContext

Associated Types

type SscLocalData ssc Source #

Internal SSC state stored in memory

type SscPayload ssc Source #

Payload which will be stored in main blocks

type SscGlobalState ssc Source #

Global state, which is formed from all known blocks

type SscProof ssc Source #

Proof that SSC payload is correct (it'll be included into block header)

type SscSeedError ssc Source #

Error that can happen when calculating the seed

type SscNodeContext ssc Source #

SSC specific context in NodeContext

type SscParams ssc Source #

Needed options for creating SscNodeContext

type SscVerifyError ssc Source #

Type for verification error


mkSscProof :: Tagged ssc (SscPayload ssc -> SscProof ssc) Source #

Create proof (for inclusion into block header) from payload

sscCreateNodeContext :: MonadIO m => Tagged ssc (SscParams ssc -> m (SscNodeContext ssc)) Source #

Create SscNodeContext

class Ssc ssc => SscWorkersClass ssc where Source #

Class for SSC workers.

Minimal complete definition

sscWorkers, sscLrcConsumers


sscWorkers :: WorkMode ssc m => m (Set NodeId) -> Tagged ssc ([WorkerSpec m], OutSpecs) Source #

All workers specific to SSC.

sscLrcConsumers :: (WorkMode ssc m, MonadDBCore m) => Tagged ssc [LrcConsumer m] Source #