-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add epoch stakepool size indexer #850
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main issue with foldBlocks
is that you can't resume. You always need to start from genesis whenever you stop and restart the indexer. I guess we want to work on this later?
Also, thanks for the tests :) Learned more about stake pool registration
Ran it on mainnet, preliminary info here https://input-output.atlassian.net/browse/PLT-171?focusedCommentId=136344 |
@raduom The comment on rollbackRingBuffer went outdated as it was removed, but the answer to why it was here in the first place is here #850 (comment) |
Here are some more elaborate ideas that could help with it:
Aside from issue linked above, there has been a proposal by @erikd to pass pieces of ledger state over the chainsync protocol. But I think having a protocol to pass info over a socket in a situation where both a node and dbsync are typically running on the same machine, is just overhead -- just compile the node into the indexer, and the problems of double memory use, serializing and deserializing ledger state, coming up with a protocol on how to query for pieces of ledger state, etc. would all go away. |
You still have some conflicts |
Rebased on to lates master and pushed. These PRs in cardano-node would still be needed to be merged:
The CI seems to fail for unrelated reasons there (as far as I can tell). |
, base >=4.9 && <5 | ||
, base16-bytestring | ||
, bytestring | ||
, cardano-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these IOG dependencies?
sqlite :: SQL.Connection -> S.Stream (S.Of Event) IO r -> S.Stream (S.Of Event) IO r | ||
sqlite c source = do | ||
lift $ SQL.execute_ c | ||
"CREATE TABLE IF NOT EXISTS stakepool_delegation (poolId BLOB NOT NULL, lovelace INT NOT NULL, epochNo INT NOT NULL)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may need a primary key on this table, or some indicator that make a ROW unique, besides the implicit SQLite Row-Id.
We don't drop the table, we recreate if it doesn't exist, and start inserting it to it, so it is possible to insert the same events multiple times which I don't think is correct
…no-api - Cardano.Streaming.Callbacks: Add primitive callback based versions of local chainsync to Cardano.Streaming. `blocksCallback` and `blocksCallbackPipelined` both take a callback when iterating over the received blocks from local chainsync connection - Cardano.Streaming: streaming package's versions to stream blocks or ledger states. `foldLedgerState` does essentially what `foldBlocks` does in cardano-api:Cardano.Api.LedgerState, with the difference that it doesn't drop connection when it's up to date with regarding to the node, but keeps listening.
The `toEvents` and `getStakeMap` make up the core of the implementation in Marconi.Index.EpochStakepoolSize.
* Add suffixes to sqlite databases * Add ledger state streaming, equivalent to foldBlocks defined in cardano-api - Cardano.Streaming.Callbacks: Add primitive callback based versions of local chainsync to Cardano.Streaming. `blocksCallback` and `blocksCallbackPipelined` both take a callback when iterating over the received blocks from local chainsync connection - Cardano.Streaming: streaming package's versions to stream blocks or ledger states. `foldLedgerState` does essentially what `foldBlocks` does in cardano-api:Cardano.Api.LedgerState, with the difference that it doesn't drop connection when it's up to date with regarding to the node, but keeps listening. * Add epoch stakepool size indexer The `toEvents` and `getStakeMap` make up the core of the implementation in Marconi.Index.EpochStakepoolSize. * Refactor marconi test for reuse in epoch stakepool size indexer * Add test for epoch stakepool size indexer * Add changelog entry * Disable test and add TODO * Fix warnings * Fix marconi.cabal
PLT-171: marconi indexer: stake pool delegation of a particular epoch
Diff is easiest to review by looking at the separate commits as they do isolated things.
Also added a longer commit messages for the
foldBlocks
adaption commit 440ff75.Test with:
cabal run marconi-test -- -p '/prop_epoch_stakepool_size/'
Run on testnet or mainnet:
Depends on these PRs on cardano-node repo (same content, one is just for the 1.35 release branch):
foldBlocks
, backported to 1.35 release branch cardano-node#4680foldBlocks
cardano-node#4679Pre-submit checklist: