Skip to content

[codex] Add combined Binance and Polymarket oracle E2E#758

Draft
ByteYue wants to merge 2 commits into
mainfrom
codex/sports-score-oracle-poc
Draft

[codex] Add combined Binance and Polymarket oracle E2E#758
ByteYue wants to merge 2 commits into
mainfrom
codex/sports-score-oracle-poc

Conversation

@ByteYue

@ByteYue ByteYue commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR consolidates the Gravity Oracle E2E surface around two capabilities:

  • Binance USD-M indexPriceKlines closed buckets through sourceType=3;
  • finalized Polygon Polymarket CTF settlements through sourceType=6.

It adds a combined oracle_demo suite that runs both paths in one Gravity cluster and emits one frontend runtime config.

Combined workflow

The suite:

  1. starts deterministic local Binance and Polygon JSON-RPC mocks;
  2. registers price and settlement tasks through governance;
  3. waits for the JWK observer/consensus path to publish canonical bytes;
  4. deploys PriceFeedResolver, PolymarketSettlementResolver, and a binary market;
  5. verifies NVDA and TSLA closed-bucket rounds;
  6. mirrors a Fed July CTF resolution and settles the Gravity market;
  7. writes demo-config.json for the dashboard.

Contract artifact builds are targeted to the source files declared by each Oracle E2E, so unrelated contract tests cannot break the suite.

Continuous-only Binance task model

binance_index_kline_v1 is a long-running feed by definition. The task URI no longer carries continuous=true; the reth adapter rejects both legacy continuous=true and continuous=false so validators cannot disagree between one-shot and continuous nonce semantics.

For each feedId, bucketStartMs and interval are immutable. Use a new feedId when either changes. This keeps delivery nonce, bucket time, and confirmed cursor reconciliation monotonic and addresses the failure mode reported in Galxe/gravity-audit#913.

Follow-up commit 00668611b6 (test(oracle): align demos with continuous-only Binance feeds) updates both E2E configurations, live URI generation, shared test helpers, runbooks, and Cargo.lock. The lockfile now pins gravity-reth commit d8cb206f6 from Galxe/gravity-reth#368.

Run the deterministic combined demo

Build the binaries, then run:

RUSTFLAGS="--cfg tokio_unstable" cargo build -p gravity_node --profile quick-release

PATH="$HOME/.foundry/bin:$PWD/target/quick-release:$PATH" \
  ./gravity_e2e/run_test.sh oracle_demo \
    --force-init \
    --keep-running \
    --demo-config-out ../gravity_price_feed_demo_web/public/demo-config.json \
    --log-cli-level=INFO

A later restart can omit --force-init to reuse cached genesis artifacts.

Expected successful assertions include:

Price feed resolved: feedId=1001 roundId=29720877 price=19612645000
Price feed resolved: feedId=1002 roundId=29720877 price=40117545000
Combined oracle demo resolved: NVDA/TSLA roundId=29720877, polymarket marketId=1 YES claimable=300000000000000000000
Suite oracle_demo PASSED
All suites passed!

Stop the retained cluster with:

bash cluster/stop.sh --config gravity_e2e/cluster_test_cases/oracle_demo/cluster.toml

Live Binance mode

The standalone binance_price_feed suite also supports BINANCE_PRICE_FEED_MODE=live for manual demos. Live mode reads recent closed one-minute buckets from Binance public market data and continues writing subsequent closed buckets. It is intentionally separate from deterministic CI and makes outbound requests.

BINANCE_API_KEY and BINANCE_SECRET_KEY are not required for this public endpoint.

Validation

  • RUSTFLAGS="--cfg tokio_unstable" cargo check -p gravity_node --locked: passed against gravity-reth d8cb206f6.
  • Both relayer JSON files parse successfully.
  • Modified Python hook and URI helper files pass py_compile.
  • No continuous=true or continuous=false task URI remains.
  • git diff --check: passed.

The full oracle_demo flow previously passed with one deterministic combined test; this follow-up changes only the Binance URI contract and dependency pin. The reth PR independently passes its relayer and execution-layer test suites after removing fixed mode.

Scope boundary

The deterministic E2E proves the complete Gravity transport and contract-consumption path. It does not implement generic intra-epoch dynamic request discovery or automatic mirroring of arbitrary Polymarket UI markets.

@ByteYue
ByteYue force-pushed the codex/sports-score-oracle-poc branch from 65d73c4 to 459ebc7 Compare June 28, 2026 14:47
@ByteYue ByteYue changed the title [codex] Add runnable Polymarket oracle mock E2E [codex] Add Hype price feed E2E Jun 30, 2026
@ByteYue ByteYue changed the title [codex] Add Hype price feed E2E [codex] Add Binance index-kline price feed E2E Jul 7, 2026
@ByteYue ByteYue changed the title [codex] Add Binance index-kline price feed E2E [codex] Add combined Binance and Polymarket oracle E2E Jul 12, 2026
@ByteYue
ByteYue force-pushed the codex/sports-score-oracle-poc branch from 3dee0eb to 57c27c8 Compare July 14, 2026 08:13
@ByteYue
ByteYue force-pushed the codex/sports-score-oracle-poc branch from 57c27c8 to 6b80d5d Compare July 18, 2026 10:08
Remove the legacy continuous query parameter from Binance task URIs and document that binance_index_kline_v1 is inherently continuous. Pin the SDK lockfile to gravity-reth d8cb206f6, and require a new feedId whenever the bucket origin or interval changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant