fix(indexer): align tradeParser's topic with the contract event convention#667
Merged
Mimah97 merged 2 commits intoJun 30, 2026
Merged
Conversation
…ntion Every event currently published by contracts/market/src/events.rs follows the same pattern: Soroban's #[contractevent] macro snake-cases the event struct name including its literal "Event" suffix (MarketCreatedEvent -> "market_created_event", MarketResolvedEvent -> "market_resolved_event", CollateralDepositedEvent -> "collateral_deposited_event", etc. — confirmed against each event's own unit test in events.rs). tradeParser.ts's "trade_executed" discriminator was the one outlier guessing the unsuffixed form. The contract doesn't publish a trade execution event yet — trades are currently matched off-chain by the CLOB (see the Trade/IndexedTrade Prisma models and ingestion.ts's comments) — so this isn't fixing a live ingestion bug the way Vatix-Protocol#589/Vatix-Protocol#590 were. It aligns the parser with the established convention now, so that whenever TradeExecutedEvent ships it isn't silently dropped the same way market_created and market_resolved events were before this round of fixes. Updated tradeParser.test.ts, ingestion.test.ts's TRADE_TOPIC fixture, docs/indexer-event-mapping.md, and contract-event-vectors.json to the corrected discriminator. Closes Vatix-Protocol#588
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
contracts/market/src/events.rsfollows the same pattern: Soroban's#[contractevent]macro snake-cases the event struct name including its literalEventsuffix —MarketCreatedEvent→market_created_event,MarketResolvedEvent→market_resolved_event,CollateralDepositedEvent→collateral_deposited_event, etc. (confirmed against each event's own unit test inevents.rs).tradeParser.ts's"trade_executed"discriminator was the one outlier still guessing the unsuffixed form — it's now"trade_executed_event", consistent with every other parser in this module after Fix resolutionParser for u32 bool u64 payload #589 and Wire market_created parser into ingestion loop #590.Trade/IndexedTradePrisma models). This aligns the parser with the established naming convention now, so that wheneverTradeExecutedEventships on-chain, it isn't silently dropped the same waymarket_created_eventandmarket_resolved_eventwere before this round of fixes.Why
Closing out the same class of topic-naming drift across all four indexer parsers for consistency, now that #589 and #590 established the real convention from the contract source.
Test plan
apps/indexer/src/tradeParser.test.tsandapps/indexer/src/ingestion.test.ts'sTRADE_TOPICfixture to the corrected discriminator.npx vitest run apps/indexer/src— all pass except 3 pre-existing, unrelated failures already present ondev(collateralDepositedParser.test.ts,storage.test.ts).docs/indexer-event-mapping.mdandapps/indexer/fixtures/contract-event-vectors.jsonto document the corrected topic and note that this anticipates a not-yet-implemented on-chain event.Closes #588