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

Expose Ledger events through the API. #3085

Merged
merged 1 commit into from
Sep 8, 2021
Merged

Expose Ledger events through the API. #3085

merged 1 commit into from
Sep 8, 2021

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented Aug 16, 2021

  • Add a function 'applyBlockWithEvents' which yields events along with a
    new ledger state.

stateOld = clsState oldState
if enableValidation
then tickThenApply config block stateOld
else tickThenReapplyCheckHash config block stateOld
Copy link
Contributor

Choose a reason for hiding this comment

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

New applyBlockWithEvents function.

Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

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

I just pushed a refined interface to PR IntersectMBO/ouroboros-network#3292 and left a couple comments here explaining what needs to change. HTH.

tickThenApply cfg block lsb
= either (Left . Text.pack . show) Right
$ runExcept
$ Ledger.tickThenApply cfg block lsb
Copy link
Contributor

Choose a reason for hiding this comment

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

I just pushed a refined interface to PR IntersectMBO/ouroboros-network#3292

I think this should now just be ... $ runExcept $ Ledger.tickThenApplyLedgerResult cfg block lsb, no need for runLedgerT.

tickThenReapplyCheckHash cfg block lsb =
if Consensus.blockPrevHash block == Ledger.ledgerTipHash lsb
then Right $ Ledger.tickThenReapply cfg block lsb
Copy link
Contributor

Choose a reason for hiding this comment

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

I just pushed a refined interface to PR IntersectMBO/ouroboros-network#3292

I think this should now just be ... $ Ledger.tickThenReapplyLedgerResult cfg block lsb, no need for runIdentity or runLedgerT.

@@ -47,6 +50,8 @@ data LedgerEvent
PoolReRegistration Certificate
| -- | Rewards are being distributed.
RewardsDistribution EpochNo (Map StakeCredential Lovelace)
| -- | MIR are being distributed.
MIRDistribution MIRDistributionDetails
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this constructor have an EpochNo field so that I know which epoch number that was paid in?

- Add a function 'applyBlockWithEvents' which yields events along with a
  new ledger state.
- Add two events, both needed by DB-sync. More events are available.
@nc6
Copy link
Contributor Author

nc6 commented Sep 8, 2021

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 8, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 7080ff0 into master Sep 8, 2021
@iohk-bors iohk-bors bot deleted the nc/ledgerEvents branch September 8, 2021 10:09
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.

4 participants