feat(oracle): add deterministic Binance index feed - #418
Conversation
Add the source type 3 Binance USD-M indexPriceKlines adapter with deterministic nonce-to-bucket mapping, exact closed-bucket validation, bounded HTTP responses, and fixed-point payload encoding. Reject task history mismatches during registration and runtime reconciliation, retain the existing 500,000 callback gas policy, and document the canonical PriceFeedResolver payload. Tests cover URI/config validation, restart mapping, response parsing, precision bounds, localhost HTTP transport, canonical wrapper encoding, manager reconciliation, and execution calldata.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 458c734350
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let expected = config.round_for_delivery_nonce(latest_onchain_nonce)?.source_position; | ||
| if latest_onchain_position != 0 && latest_onchain_position != expected { |
There was a problem hiding this comment.
Bind the market configuration to an active feed ID
When an existing feed URI is replaced with one that keeps the same feedId, bucket origin, and interval but changes pair, this check still succeeds because it validates only the derived timestamp. Subsequent payloads are tagged with the original feedId but contain prices from the new market, and the callback payload carries no pair identifier with which downstream code could detect the switch. Persist and verify the immutable market configuration, or require a new feedId for any pair change.
Useful? React with 👍 / 👎.
| "Reconciling local source with confirmed on-chain progress" | ||
| ); | ||
| source.reconcile_progress(onchain_nonce, onchain_position).await; | ||
| source.reconcile_progress(onchain_nonce, onchain_position).await?; |
There was a problem hiding this comment.
Validate positions when the confirmed nonce matches locally
When a price poll has already advanced local state to nonce n and the next call reports the same on-chain nonce with a conflicting nonzero source position, this fallible reconciliation is skipped by the guard above because current_position is already nonzero. The source therefore misses the advertised runtime history check and proceeds to emit nonce n + 1 from an incompatible history; reconciliation must also run, or explicitly error, when equal nonces have different positions.
Useful? React with 👍 / 👎.
Summary
Adds the independently reviewable Binance price provider described in Galxe/gravity-audit#1038.
sourceType=3with Binance USD-MindexPriceKlinesPricePayloadABIDepends on the merged generic Oracle core in #416/#417 and the merged
PriceFeedResolverin Galxe/gravity_chain_core_contracts#114.Deterministic mapping
For delivery nonce
n:The adapter requests exactly one bucket with
startTime,endTime, andlimit=1. It accepts exactly one row whoseopenTimeandcloseTimematch the requested bucket.Safety properties
Validation
cargo test -p reth-pipe-exec-layer-relayer: 39 passed, 1 pre-existing external-RPC test ignoredcargo test -p reth-pipe-exec-layer-ext-v2 onchain_config::jwk_oracle: 9 passedcargo fmt --all -- --check: passedcargo clippy -p reth-pipe-exec-layer-relayer --all-targets --no-deps: passed with five pre-existing warnings infactory.rs/eth_client.rs; no warnings in the new providercargo clippy -p reth-pipe-exec-layer-ext-v2 --lib --no-deps: completed with existing package warningsNon-goals
Tracks Galxe/gravity-audit#1038 and Galxe/gravity-audit#1033.