Skip to content

test(oracle): add deterministic Binance quorum E2E - #805

Merged
ByteYue merged 1 commit into
mainfrom
codex/oracle-binance-deterministic-e2e
Aug 3, 2026
Merged

test(oracle): add deterministic Binance quorum E2E#805
ByteYue merged 1 commit into
mainfrom
codex/oracle-binance-deterministic-e2e

Conversation

@ByteYue

@ByteYue ByteYue commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Add one deterministic, merge-gating E2E suite for the complete multi-validator Binance price-feed path. This PR intentionally keeps the localhost provider fixture, reusable oracle helpers, cluster definition, and E2E assertions together so the workflow can be reviewed and run as one unit.

The suite also pins gravity-reth to the merged generic relayer runtime through Galxe/gravity-reth#419.

Workflow under test

  1. Start four equal-voting-power Gravity validators.
  2. Deploy PriceFeedResolver and register two sourceType=3 tasks through the on-chain governance lifecycle.
  3. Have every validator discover the tasks and fetch the same explicit, closed one-minute indexPriceKlines buckets for NVDAUSDT and TSLAUSDT.
  4. Form JWK consensus from at least three certifying validators.
  5. Execute the agreed bytes through NativeOracle and its resolver callback.
  6. Verify observer startup, quorum evidence, per-validator relayer progress, resolver values, and identical contract state through all four RPC endpoints at one block.

Determinism and network boundary

  • The Binance-compatible endpoint binds to 127.0.0.1 only.
  • Requests must include the exact pair, interval, startTime, endTime, and limit=1 closed-bucket coordinates.
  • Prices are deterministic fixed-point values keyed by pair and bucket.
  • The test uses no Binance API key, secret, or public Binance endpoint.
  • The mock request counters prove that multiple validators independently fetched each feed.

Cross-repository revisions

Run

From the SDK repository root, after building gravity_node and gravity_cli:

PATH="$HOME/.foundry/bin:$PWD/target/quick-release:$PATH" \
  ./gravity_e2e/run_test.sh \
    binance_price_feed_multivalidator \
    --force-init \
    --log-cli-level=INFO

Expected terminal evidence includes all four validators active, observer/certifier/quorum assertions passing for both feeds, stored round 29720875 for the fixed fixture bucket, and All suites passed! after all four nodes stop.

Validation

  • cargo build --bin gravity_node --bin gravity_cli --profile quick-release with the repository-required Rust flags
  • python3 -m pytest -q gravity_e2e/gravity_e2e/utils/test_mock_binance_index.py (3 passed)
  • ./gravity_e2e/run_test.sh binance_price_feed_multivalidator --log-cli-level=INFO (1 passed in 40.65s)
  • Python compile checks, TOML/JSON parse checks, and git diff --check

Refs Galxe/gravity-audit#1038
Refs Galxe/gravity-audit#1033

Pin the merged generic relayer runtime and exercise two closed Binance index-price buckets across four equal-power validators.

The suite registers tasks through governance, verifies observer and voting-power quorum evidence, checks NativeOracle and resolver state on every RPC, and uses a localhost-only fixture with no credentials or public network dependency.

Refs Galxe/gravity-audit#1038
@ByteYue
ByteYue merged commit fc7cb8f into main Aug 3, 2026
12 checks passed
@ByteYue
ByteYue deleted the codex/oracle-binance-deterministic-e2e branch August 3, 2026 14:33
ByteYue added a commit that referenced this pull request Aug 3, 2026
## Summary

- pin the SDK runtime to merged gravity-reth #420
- add a deterministic localhost Polygon JSON-RPC fixture with a
separately controlled finalized head
- add one four-validator merge-gating E2E for the complete Polymarket
settlement transport path
- document the exact local run command and scope boundaries

Tracks Galxe/gravity-audit#1038 and preserves the split requested by
Galxe/gravity-audit#1033.

## Dependency baseline

- gravity-aptos #79: `a64f8adc274bf2681df796766ef9a5b195fee44b`
- gravity_chain_core_contracts #115:
`f447687bf6f6f9efabd92626b588aeda94148f88`
- gravity-reth #420: `0c038e180cc26ae400f3fb2e6199e6f079f68fbc`
- gravity-sdk main / #805: `fc7cb8f4b665e524e132f0921d5b99dc7cde6929`

Both the direct `greth` dependency and the `reth-primitives-traits`
patch point at the same merged reth revision. The lockfile changes are
limited to replacing the previous gravity-reth source revision.

## Workflow covered

1. Start four validators with equal voting power.
2. Governance deploys `PolymarketSettlementResolver`, binds source type
6, registers one CTF mirror, and activates the task.
3. Every validator independently polls the same localhost Polygon
fixture.
4. The CTF event exists at `latest`, while `finalized` remains one block
behind.
5. All validators persist an empty-scan cursor and no settlement reaches
`NativeOracle`.
6. The fixture advances `finalized`; validators derive byte-identical
observations.
7. At least three validators certify, JWK consensus reaches a
voting-power quorum, and execution records nonce `1`.
8. The resolver stores winner slot `1` and canonical Polygon provenance.
9. All four relayer checkpoints become terminal and all four Gravity
RPCs return identical contract state at the same block.

The fixture uses the canonical Polygon CTF `ConditionResolution` ABI and
validates the derived condition ID, topic layout, dynamic payout
encoding, filter behavior, and finalized/latest separation.

## Deliberate exclusions

- no prediction-market betting/product contract
- no live Polygon RPC or credentials
- no frontend/demo/soak test
- no new Aptos or reth runtime behavior

The oracle data-source runtime path is localhost-only. A fresh build may
still download repository dependencies.

## Validation

- `make MODE=quick-release gravity_node gravity_cli`
- fixture unit tests: `3 passed`
- four-validator Polymarket E2E: `1 passed` in `46.57s`
- TOML/JSON parsing, Python bytecode compilation, `git diff --check`,
and credential/user-path scans passed
- no Rust source files changed

## Run

```bash
make MODE=quick-release gravity_node gravity_cli

PATH="$HOME/.foundry/bin:$PWD/target/quick-release:$PATH" \
  ./gravity_e2e/run_test.sh \
    polymarket_settlement_multivalidator \
    --force-init \
    --log-cli-level=INFO
```
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.

3 participants