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

Chain Index: users can configure to only store txs from a block no onward #72

Merged
merged 4 commits into from Nov 15, 2021

Conversation

kk-hainq
Copy link
Contributor

@kk-hainq kk-hainq commented Oct 31, 2021

This PR is a quick proof-of-concept for #73 on allowing users to choose which batch of transactions to store in the DB. In this specific instance, the application can choose to only store transactions from Alonzo onward. Given that tip and UTXO processing is unaffected, most of these configurations are pretty safe to the functioning of the chain index?

I attempted this as a dApp developer wanting to configure the chain index, hence keeping as many decisions in app as possible instead of extending the chain index effects.

If this makes sense, I would love to clean it and add a few tests first. A possible next step will then be listing exclusive script addresses to track.

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Relevant tickets are mentioned in commit messages
    • Formatting, materialized Nix files, PNG optimization, etc. are updated
  • PR
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@kk-hainq kk-hainq marked this pull request as draft October 31, 2021 17:29
@kk-hainq kk-hainq changed the title ChainIndex: users can configure to only store txs from Alonzo onward Chain Index: users can configure to only store txs from Alonzo onward Oct 31, 2021
@kk-hainq kk-hainq force-pushed the chain-index-alonzo-onward-config branch from a2ce982 to 96c3277 Compare October 31, 2021 18:18
@silky
Copy link
Contributor

silky commented Nov 8, 2021

@kk-hainq Thanks for proposing this! It looks interesting.

What about instead of specifying an era, we specify a block number, and only start storing transactions from that point forward? This would make the code a bit more generic. Then, you can provide some hints on how to run that for the specific eras, etc.

Thoughts?

@kk-hainq kk-hainq force-pushed the chain-index-alonzo-onward-config branch from 96c3277 to 6c13212 Compare November 9, 2021 13:15
@kk-hainq kk-hainq marked this pull request as ready for review November 9, 2021 13:16
@kk-hainq
Copy link
Contributor Author

kk-hainq commented Nov 9, 2021

@silky Awesome! it is not just more generic and clean for the code and users, it allows dApps to specify the block that they launch at for swift syncing before that! I have updated the code as suggested.

@kk-hainq kk-hainq changed the title Chain Index: users can configure to only store txs from Alonzo onward Chain Index: users can configure to only store txs from a block no onward Nov 9, 2021
@silky silky self-requested a review November 9, 2021 13:49
Copy link
Contributor

@silky silky left a comment

Choose a reason for hiding this comment

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

Nice; looks great! Just one minor change request.

Two other things:

  • Do you think it's possible to add a test somewhere?
  • Maybe we could have a comment somewhere listing a few block numbers people might like to use (i.e. the one you'd use to only save transactions from the Alonzo era and beyond.)

Thanks for working on this! :)

plutus-chain-index-core/src/Plutus/ChainIndex/Effects.hs Outdated Show resolved Hide resolved
@kk-hainq kk-hainq force-pushed the chain-index-alonzo-onward-config branch from 6c13212 to e7f560c Compare November 13, 2021 13:27
@silky silky merged commit c30527e into IntersectMBO:main Nov 15, 2021
@silky
Copy link
Contributor

silky commented Nov 15, 2021

Thanks @kk-hainq ! :)

@kk-hainq kk-hainq deleted the chain-index-alonzo-onward-config branch November 15, 2021 12:51
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

2 participants