[indexer]: Index BidPlaced events from the intents-coprocessor pallet#1060
Merged
Conversation
Adds a FillerBid entity recording who bid on which order commitment, along with the raw bid payload. The payload is read out of the place_bid extrinsic in the same block rather than from intents_getBidsForOrder: that RPC pins the chain head internally and has no `at` parameter, and the pallet's offchain copy expires, so on any backfill it would answer with today's live bids and silently attribute them to a historical block. The RPC remains as a fallback for when the call cannot be decoded. place_bid may arrive wrapped in batch/proxy/sudo, so the call tree is walked to find it, matching on commitment — one batch can carry bids for several orders. Handler is registered on hyperbridge chains rather than under enablePriceIndexing, which is mainnet-only, since the pallet runs on gargantua too.
subscribePhantomOrders watched system.events over the WsProvider. When the socket dropped, polkadot-js reconnected the transport but did not reliably re-establish the storage subscription, and every event emitted while disconnected was lost with no error. The only error handling was a catch at startup, so nothing ever checked liveness again. With a bid window measured in a handful of blocks, that meant silently missed bids. pollPhantomOrders reads the head each tick and scans every block between the last one processed and that head, so the block cursor rather than the connection determines what has been seen. This is gap-free rather than merely self-healing: an outage delays orders but cannot drop them, since the cursor only advances past a block whose events were actually read, and recovery replays the backlog. The cursor advances per block rather than per range, so a failure partway through a catch-up re-scans only the unread blocks. maxBlocksPerPoll bounds a single scan so a long outage catches up over several ticks, and lookbackBlocks lets a restarting process pick up orders whose window is still open. Note this tracks the best head, not the finalized head: a reorg can drop a block whose order was already bid on. The deposit is retractable, and waiting for finality would miss the shorter bid windows entirely.
Wizdave97
marked this pull request as ready for review
July 21, 2026 09:40
ddboy19912
approved these changes
Jul 21, 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.
Adds a FillerBid entity recording who bid on which order commitment, along with the raw bid payload.
The payload is read out of the place_bid extrinsic in the same block rather than from intents_getBidsForOrder: that RPC pins the chain head internally and has no
atparameter, and the pallet's offchain copy expires, so on any backfill it would answer with today's live bids and silently attribute them to a historical block. The RPC remains as a fallback for when the call cannot be decoded.place_bid may arrive wrapped in batch/proxy/sudo, so the call tree is walked to find it, matching on commitment — one batch can carry bids for several orders. Handler is registered on hyperbridge chains rather than under enablePriceIndexing, which is mainnet-only, since the pallet runs on gargantua too.