Make the chain indexer#66
Open
clintjeff2 wants to merge 2 commits into
Open
Conversation
- Initialized `packages/contracts` with Membership ABI.
- Initialized `apps/access-api` with Prisma schema for events and memberships.
- Implemented `MembershipIndexer` with:
- Lagged finality window (configurable confirmation depth).
- Reorg detection via block hash verification.
- Automatic state rollback and reconciliation.
- Idempotent log processing with re-processing of reverted events.
- Implemented `MembershipService` to handle transactional updates and reverts.
- Updated `.env.example` with indexer configurations.
- Added tests for indexer initialization and reorg logic.
Co-authored-by: clintjeff2 <119521983+clintjeff2@users.noreply.github.com>
…2410485 Make the chain indexer reorg-safe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a production-ready, reorg-safe blockchain indexer for membership events. It ensures data consistency and resiliency against chain rollbacks while decoupling core indexing logic from application-specific business actions.
Linked Issue
Closes #52
Type of Change
Changes Made
INDEXER_CONFIRMATION_DEPTH). If a chain mismatch is detected, the indexer rolls back both its checkpoint and the application-state memberships to a known safe block.reverted.MembershipServiceto handle application-specific side effects, fully supporting bothapplyandrevertoperations.apps/access-apiworkspace andpackages/contractspackage to facilitate clean ABI sharing across the project.Checklist
npm run typecheckpasses with no errorsnpm run lintpasses (or issues are pre-existing and documented).env.example