Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAD-3693] Expose events api via foldBlocks, chainSyncClientWithLedgerState, and chainSyncClientPipelinedWithLedgerState #3374

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

DavidEichmann
Copy link
Contributor

This simply exposes the [LedgerEvent] that comes with applying blocks. This should be useful for db-sync in the future.

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API looks great. I've not checked anything else carefully.

@@ -222,11 +222,12 @@ foldBlocks
-> ValidationMode
-> a
-- ^ The initial accumulator state.
-> (Env -> LedgerState -> BlockInMode CardanoMode -> a -> IO a)
-> (Env -> LedgerState -> [LedgerEvent] -> BlockInMode CardanoMode -> a -> IO a)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice!

@@ -86,21 +86,21 @@ main = do
-- | Defines the client side of the chain sync protocol.
chainSyncClient
:: ChainSyncClient
(BlockInMode CardanoMode, Either Text LedgerState)
(BlockInMode CardanoMode, Either Text (LedgerState, [LedgerEvent]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

BTW, remind me what the Either Text is about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might get an error when applying blocks. The error will be either a HardForkLedgerError '[...] from calling tickThenApplyLedgerResult or an hash miss-match. I think I originally just used Text here out of laziness/simplicity but am happy to use a structured error instead (I'd do that in a separate PR).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A structured error would be great 👍

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -86,21 +86,21 @@ main = do
-- | Defines the client side of the chain sync protocol.
chainSyncClient
:: ChainSyncClient
(BlockInMode CardanoMode, Either Text LedgerState)
(BlockInMode CardanoMode, Either Text (LedgerState, [LedgerEvent]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A structured error would be great 👍

@DavidEichmann
Copy link
Contributor Author

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 22, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit b91eb99 into master Nov 22, 2021
@DavidEichmann DavidEichmann changed the title Expose events api via foldBlocks, chainSyncClientWithLedgerState, and chainSyncClientPipelinedWithLedgerState [CAD-3693] Expose events api via foldBlocks, chainSyncClientWithLedgerState, and chainSyncClientPipelinedWithLedgerState Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants