Feature/0.1.33 events#78
Merged
Merged
Conversation
…ttlementBatch) Sync proto from poktroll to support new settlement aggregation fields on EventClaimSettled (settled_upokt, mint_ratio, session_id, supplier_owner, num_estimated_relays, minted_upokt, overservicing/deflation losses, and reward_distribution_detailed), new fields on EventApplicationOverserviced (service_id, session_end_block_height, spend_limit_exceeded), and new EventSettlementBatch event type. All new schema fields are nullable for backward compatibility with pre-upgrade blocks.
- Removed `EventSettlementBatch` handler and related schema definitions from codebase. - Consolidated settlement processing by enhancing `_handleEventClaimSettled` with modular utility functions and optimized computation of settlement components. - Updated schema to remove unused entities and fields (`rewardDistributionDetailed`, `EventSettlementBatch`).
- Readded `EventSettlementBatch` handler and its integration into the event processing pipeline. - Improved settlement logic by refining record structure and adding modular components for handling mint, burn, and transfer operations. - Updated schema and mappings to remove deprecated entities while aligning with new functionality. - Added validation for essential settlement data (`inflationAmount` and `reimbursementAmount`) with informative failure handling.
a0fb129 to
fd62e7d
Compare
- Enhanced `modToAcctTransfers` handling by introducing `summarizeTransfers`. - Updated logic to perform bulk insert of both raw and summarized transfers for improved data tracking.
…ked suppliers and Support new protocol opReason values for inflation and mint_burn in supply stats
jorgecuesta
approved these changes
Apr 20, 2026
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.
Summary
EventClaimSettled(settled/minted/overservicing/deflation amounts, mint ratio, supplier owner)EventApplicationOverserviced(service, session end block height, spend limit exceeded)SettlementOpReasonenum with new relay burn-equals-mint and global mint TLM distribution reasonsreward_distribution_detailedpath by reading values directly from chainop_reasonentries instead of broken mathEventSettlementBatchto save batched validator/delegator rewards asModToAcctTransferrecords_handleEventClaimSettledinto smaller, focused functionsDetail
schema.graphql:EventClaimSettled:settledAmount,settledDenom,mintRatio,supplierOwner,mintedAmount,mintedDenom,overservicingLossAmount,overservicingLossDenom,deflationLossAmount,deflationLossDenomEventApplicationOverserviced:service,sessionEndBlockHeight,spendLimitExceededSettlementOpReasonenum with relay burn-equals-mint and global mint TLM distribution reasons (DAO, source owner, application, validator, delegator, tokenomics mint)proto/pocket/tokenomics/event.proto:RewardDistributionDetailmessageEventSettlementBatchmessagesrc/mappings/pocket/relays.ts:reward_distribution_detailed,settled_upokt,minted_upokt,mint_ratio,supplier_owner_address,overservicing_loss_upokt,deflation_loss_upokt,num_estimated_relays_handleEventClaimSettledinto smaller functions:_resolveSettlementParts_buildClaimSettledProps_buildSettlementFromResult_buildSettlementFromDetailedDistribution_buildSettlementFromDistribution_computeNumEstimatedRelays_computeDeflationLoss_computeOverservicingLossreward_distribution_detailedop_reasonentries instead of deriving them mathematicallyhandleEventSettlementBatchto save batched validator/delegator rewards asModToAcctTransferrecordssrc/mappings/handlers.ts:handleEventSettlementBatchtopocket.tokenomics.EventSettlementBatchsrc/mappings/indexer.manager.ts:pocket.tokenomics.EventSettlementBatchevent typeproject.ts:EventSettlementBatchevent handlerIssue
The previous implementation derived inflation and reimbursement mint amounts by computing
sum(reward_distribution) - (effectiveBurn × mintRatio). This broke at height 153753 (beta) becausereward_distribution_detailedexcludes proposer/validator rewards (they are batched separately viaEventSettlementBatch), making the total less thanminted_upoktand producing a negative value.The fix:
reward_distribution_detailedentries byop_reason(TLM_GLOBAL_MINT_DAO_REWARD_DISTRIBUTIONandTLM_GLOBAL_MINT_REIMBURSEMENT_REQUEST_ESCROW_DAO_TRANSFER)EventSettlementBatchasModToAcctTransferrecordsType of change
Select one or more:
Sanity Checklist