fix(docs): correct Dune analytics SQL to the real Stellar event schema#97
Conversation
The queries merged in #80 return zero rows against Dune: they filtered on JSON_EXTRACT_SCALAR(topics_decoded,'$[0]') (an ScVal object, never the event name) and read data_decoded as flat $.field (it's a type-wrapped ScVal map). Both silently yield null, so every dashboard panel is empty. Verified the real stellar.history_contract_events shapes on live Dune data and rewrote all 10 dune-queries/*.sql to: - filter the event name via topics_decoded '$[0].symbol' - decode fields by rebuilding data_decoded '$.map' into MAP(field -> ScVal JSON) with map_from_entries(), then reading each by ScVal type ($.u64, $.i128, $.address, $.string, $.vec[0].symbol) - add the closed_at_date partition filter (avoids full-table scans) - to_hex(transaction_hash) (it is varbinary) Every primitive was executed against live Soroban events on Dune. The one field that can't be checked without a real Boundless event — pillar's unit- enum encoding — is emitted as pillar_raw in the decode test for confirmation. Doc fixes: rewrote the §1 decoding reference; corrected the fee accounting (escrow holds the full budget, fee charged on top; fee revenue is not in the events); added the ManagerProposed/ManagerChanged/PendingManagerCancelled events (#88); pointed §4 at the canonical .sql files instead of duplicating now-corrected SQL inline.
Quota reachedYour plan allows 300 CI/CD file units per month. You've used 297 and this scan would add 11 more (total: 308). |
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #80. The merged queries are syntactically valid but functionally broken — they return zero rows against Dune, so every dashboard panel renders empty. I verified this and the fix against live Dune data.
Root cause (verified on
stellar.history_contract_events)Two wrong assumptions, both silently returning
null(no SQL error):JSON_EXTRACT_SCALAR(topics_decoded, '$[0]'). The real value is an array of ScVal objects:[{"symbol":"EventCreated"}], so$[0]is an object →null→ the= 'EventCreated'filter never matches.data_decoded '$.id','$.amount', etc. The real value is a type-wrapped ScVal map:{"map":[{"key":{"symbol":"id"},"val":{"u64":"7"}}, ...]}. There is no top-level$.id.Fix (all 10
dune-queries/*.sqlrewritten)topics_decoded '$[0].symbol'.MAP(field → ScVal JSON)withmap_from_entries(transform(...)), then reading each by ScVal type ($.u64,$.i128,$.address,$.string,$.vec[0].symbol).closed_at_datepartition filter (the queries previously full-scanned every Stellar contract event).to_hex(transaction_hash)(it'svarbinary).Validation
Every primitive was executed against live Soroban events on Dune (map extraction,
i128→DECIMAL/DOUBLE,$.string,$.vec[0]path,to_hex) — all run clean and return correctly decoded values. The one field I can't verify without a real Boundless event —pillar's unit-enum encoding — is surfaced aspillar_rawin10_event_created_decode_test.sqlso it can be confirmed on the first live event and the path adjusted if needed.Doc corrections (
dune-analytics.md)map_from_entriesrecipe.ManagerProposed,ManagerChanged,PendingManagerCancelled)..sqlfiles rather than duplicating (previously broken) SQL inline.Docs-only.
buildnow runs on docs PRs (from #80's workflow change), so CI gates this.🤖 Generated with Claude Code