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

feat: chain sync projection primitives #520

Merged
merged 16 commits into from Nov 18, 2022
Merged

Conversation

mkazlauskas
Copy link
Member

@mkazlauskas mkazlauskas commented Nov 13, 2022

Context

In order to create a database that is optimized for our provider queries, we'll need to project events from Chain Sync protocol

Proposed Solution

See README of the new projection package and the last commit (cc4bcea)

Important Changes Introduced

See the commit log.

Follow-up work

projection:

  • Create an abstraction for "store projectors" and implementation for stake pools and stake keys
  • Implement postgres store/repository for stake pools and stake keys

ogmios:

  • Complete the Ogmios transaction to core mapping. This PR only added mapping of certificates, the rest of transaction fields are currently not mapped.
  • Create a source observable from Ogmios ChainSync client. Also, create an abstraction to initialize evtCache$ for withRolledBackEvents

golden-test-generator:

  • Write tests for existing functionality
  • Start Ogmios ChainSync from some block (not necessarily from origin)

@mkazlauskas mkazlauskas requested review from rhyslbw and a team November 13, 2022 18:29
Copy link
Member

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

Looks really nice so far @mkazlauskas!

  1. 8a41a2f seems like a fix.
  2. Let's drop cae91f0 given there's no implementation to give us test coverage.
  3. I think we should be keeping the projection package free from Ogmios implementations, as it makes sense for those to be scoped to the ogmios package.

yarn-project.nix Outdated Show resolved Hide resolved
packages/core/src/Provider/Provider.ts Show resolved Hide resolved
packages/projection/package.json Outdated Show resolved Hide resolved
packages/projection/src/operators/withRolledBackEvents.ts Outdated Show resolved Hide resolved
@mkazlauskas mkazlauskas force-pushed the feat/generalized-block-handler branch 2 times, most recently from ba7b405 to b548aec Compare November 14, 2022 14:48
@mkazlauskas
Copy link
Member Author

Addressed requested changes and added 1 of my own: b548aec replaced blockHeight with slot in CertificatePointer because this type is very similar to the pointer used in 'pointer addresses', and it uses slots. Better keep them aligned.

Ready for re-review.

@mkazlauskas mkazlauskas requested review from rhyslbw and a team November 14, 2022 15:00
mirceahasegan
mirceahasegan previously approved these changes Nov 16, 2022
Copy link
Contributor

@mirceahasegan mirceahasegan left a comment

Choose a reason for hiding this comment

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

My current review is a bit shallow, but it looks good to me 👽.
I would prefer a more in-depth re-review after the squash.

Copy link
Member

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

Now would be a good time to remove the ignore for the GTG package if it's able to be made compliant without to much effort.

packages/wallet/package.json Show resolved Hide resolved
packages/projection/package.json Show resolved Hide resolved
packages/projection/README.md Show resolved Hide resolved
packages/projection/README.md Show resolved Hide resolved
packages/golden-test-generator/src/index.ts Outdated Show resolved Hide resolved
rhyslbw
rhyslbw previously approved these changes Nov 18, 2022
Rename the existing 'get-blocks' command to 'chain-sync'
add extend it to support simulating rollbacks.

It can still be used to simply get blocks without
specifying any rollbacks, but command name and
the resulting data structure has changed.
… to use toSerializableObj util

add metadata for supplied blockHeights option

export getBlockHeaderAndHash
tsc was implicitly casting to an invalid type in some situations
implement coreToCsl genesis key delegation conversion
feat(core): add addressNetworkId and createRewardAccount utils

BREAKING CHANGE: rename block types
- CompactBlock -> BlockInfo
- Block -> ExtendedBlockInfo

BREAKING CHANGE: hoist ogmiosToCore to ogmios package
translating the entire block is a lot more expensive than just header
Copy link
Member

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

Stellar work @mkazlauskas 🚀

Copy link
Contributor

@mirceahasegan mirceahasegan left a comment

Choose a reason for hiding this comment

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

Great work! 🚀

@rhyslbw rhyslbw merged commit 91b0fc2 into master Nov 18, 2022
@rhyslbw rhyslbw deleted the feat/generalized-block-handler branch November 18, 2022 09:29
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.

None yet

3 participants