cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone
LanguageHaskell2010

Pos.Ssc.Extra

Contents

Synopsis

Documentation

askSscMem :: MonadSscMem ssc m => m (SscState ssc) Source #

runSscHolder :: forall ssc m a. SscState ssc -> SscHolder ssc m a -> m a Source #

Run SscHolder reading GState from DB (restoring from blocks) and using default (uninitialized) local state.

ignoreSscHolder :: SscHolder ssc m a -> m a Source #

Utilities

sscRunLocalQuery :: forall ssc m a. (MonadSscMem ssc m, MonadIO m) => ReaderT (SscLocalData ssc) m a -> m a Source #

Run something that reads SscLocalData in MonadSscMem. MonadIO is also needed to use stm.

sscRunLocalSTM :: forall ssc m a. (MonadSscMem ssc m, MonadIO m, WithLogger m) => StateT (SscLocalData ssc) (NamedPureLogger STM) a -> m a Source #

Run STM transaction which modifies SscLocalData and also can log.

sscRunGlobalQuery :: forall ssc m a. (MonadSscMem ssc m, MonadIO m) => ReaderT (SscGlobalState ssc) m a -> m a Source #

Run something that reads SscGlobalState in MonadSscMem. MonadIO is also needed to use stm.

Seed calculation

sscCalculateSeed :: forall ssc m. (MonadSscMem ssc m, MonadDB m, SscGStateClass ssc, HasContext LrcContext m, MonadIO m, WithLogger m) => EpochIndex -> m (Either (SscSeedError ssc) SharedSeed) Source #

Calculate SharedSeed for given epoch.

Local Data

sscGetLocalPayload :: forall ssc m. (MonadIO m, MonadSscMem ssc m, SscLocalDataClass ssc, WithLogger m) => SlotId -> m (SscPayload ssc) Source #

Get SscPayload for inclusion into main block with given SlotId.

sscNormalize :: forall ssc m. (MonadDB m, MonadSscMem ssc m, SscLocalDataClass ssc, HasContext LrcContext m, SscHelpersClass ssc, WithLogger m) => m () Source #

Update local data to be valid for current global state. This function is assumed to be called after applying block and before releasing lock on block application.

sscResetLocal :: forall ssc m. (MonadDB m, MonadSscMem ssc m, SscLocalDataClass ssc, MonadSlots m) => m () Source #

Reset local data to empty state. This function can be used when we detect that something is really bad. In this case it makes sense to remove all local data to be sure it's valid.

GState

sscApplyBlocks :: forall ssc m. SscGlobalApplyMode ssc m => OldestFirst NE (Block ssc) -> Maybe (SscGlobalState ssc) -> m [SomeBatchOp] Source #

Apply sequence of definitely valid blocks. Global state which is result of application of these blocks can be optionally passed as argument (it can be calculated in advance using sscVerifyBlocks).

sscRollbackBlocks :: forall ssc m. SscGlobalApplyMode ssc m => NewestFirst NE (Block ssc) -> m () Source #

Rollback application of given sequence of blocks. Bad things can happen if these blocks haven't been applied before.

sscVerifyBlocks :: forall ssc m. SscGlobalVerifyMode ssc m => OldestFirst NE (Block ssc) -> m (SscGlobalState ssc) Source #

Verify sequence of blocks and return global state which corresponds to application of given blocks. If blocks are invalid, this function will return it using MonadError type class. All blocks must be from the same epoch.

data SscState ssc Source #

Whole state of SSC. Stored only in-memory by design.

Constructors

SscState 

Fields