Add deterministic local indexing smoke flow #241
Merged
Merged
Conversation
Introduce the shared scaffolding for the SO4 local indexing smoke flow: - types.ts defines the layered step/report model so a failing run names the broken layer (contracts deploy, contract action, indexer runtime, GraphQL, or frontend config) rather than just dumping a stack trace. - process.ts wraps child_process with capture and streaming modes plus a PATH binary probe used by preflight checks. - config.ts resolves smoke configuration from CLI flags, env vars, and local-friendly defaults (configurable contracts repo path, source/keeper keys, endpoints, and run mode).
- stellar.ts wraps the stellar CLI for key resolution, friendbot funding, and contract invokes, plus Soroban RPC / Horizon reachability probes. All signing stays in the CLI keystore so no raw secret keys touch the runner. - graphql.ts queries SubQuery for indexer metadata and entity counts, and waits for the indexer to catch up to a target ledger within a lag tolerance. - report.ts provides the step runner that times each action, tags it with a layer, promotes the first failure, and serializes the JSON smoke report.
- deployment.ts reads and validates the contract repo's .deployed/<network>.env and tokens-<network>.env outputs: it checks required core contract IDs, resolves a market token triplet for a long/short code pair, and resolves test tokens by ticker. This is what lets the smoke flow detect a usable existing deployment. - protocol.ts implements the on-chain composites the smoke flow exercises: fixed local oracle price submission (set_prices_simple), faucet claims, approvals, deposit create/execute, MarketIncrease open, MarketDecrease close, and optional referral register/set. Argument JSON is built directly in TS, removing the python dependency the shell scripts carried.
local-smoke.ts sequences the full smoke flow as layered, timed steps: preflight (binaries, contracts repo, local signing keys with friendbot funding), service reachability (Soroban RPC, Horizon, GraphQL), deployment (validate an existing local deployment or deploy + bootstrap a fresh one via the contract repo make targets), manifest sync, indexer rebuild/restart, the on-chain action sequence (oracle prices, faucet, deposit, open, close, optional referral), and a GraphQL assertion that the expected entities were indexed. Every phase records artifacts and the first failure names the broken layer. project.ts now honors INDEXER_START_LEDGER so a fresh local network can backfill from an early ledger instead of the hardcoded testnet start block.
- Add smoke:local and smoke:clean package scripts so the flow and its reset run through the documented bun commands. - clean-local.ts tears down the indexer stack, drops the Postgres volume (with a container fallback for root-owned bind-mount files), and clears reports so the smoke flow is rerunnable without manual database cleanup. --keep-db and --reports variants are supported. - Ignore the .smoke report directory and the generated local contract manifest.
Add a Local Smoke Flow section covering the one-command entrypoint, the layered steps and which protocol actions run, the auto/fresh/existing run modes, common flags and SMOKE_* env equivalents, the JSON report (including the failure block that names the broken layer), and how to rerun cleanly with smoke:clean.
|
@0xsteins is attempting to deploy a commit to the Ijai's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@0xsteins Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
It is a god one, you passed... Link |
22 tasks
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
closes #184
Adds
smoke:local— one documented command that proves the SO4 contracts,SubQuery indexer, and GraphQL layer work together end to end. It drives real
protocol actions against a local deployment and then asserts the indexer turned
those on-chain events into GraphQL entities, writing a JSON report whose first
failure names the broken layer.