Skip to content

Add TSM, CEG feeds.#8

Open
Siddharth2207 wants to merge 3 commits into
2025-09-26-stox-price-pusherfrom
2026-05-18-tsm-ceg
Open

Add TSM, CEG feeds.#8
Siddharth2207 wants to merge 3 commits into
2025-09-26-stox-price-pusherfrom
2026-05-18-tsm-ceg

Conversation

@Siddharth2207
Copy link
Copy Markdown
Collaborator

@Siddharth2207 Siddharth2207 commented May 18, 2026

Add TSM, CEG feeds.

Summary by CodeRabbit

  • Breaking Changes

    • Removed the latest TWAP price endpoint from the client API.
  • Improvements

    • Enhanced startup sequence with initial price update detection before processing.
    • Extended price availability detection window to 24 hours.
    • Expanded default price feed configuration with additional instruments and optimized parameters.
    • Added enhanced logging for better debugging and monitoring.

Review Change Stack

@Siddharth2207 Siddharth2207 changed the base branch from main to 2025-09-26-stox-price-pusher May 18, 2026 10:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 27737d42-ccc0-421d-8f30-e4976bab1299

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR removes unused TWAP functionality from the Hermes client, enhances the price listener with startup synchronization and improved freshness validation, improves EVM gas handling, containerizes the price-pusher application via Docker, expands the price configuration, and adjusts development environment setup for cross-platform compatibility.

Changes

Price Pusher Docker Deployment and Improvements

Layer / File(s) Summary
Hermes client API cleanup
apps/hermes/client/js/src/HermesClient.ts, apps/hermes/client/js/src/examples/HermesClient.ts
Removed exported TwapsResponse type and getLatestTwaps() method; added exported PublisherCaps type; removed corresponding example code.
Price listener reliability and observability
apps/price_pusher/src/pyth-price-listener.ts
Updated start() to await startListening() completion; extended price freshness window from ~60 seconds to 24 hours using publish_time age computation; added diagnostic logging for price IDs, event source creation, and price freshness checks; added waitForFirstPriceUpdate(timeoutMs) async method for startup blocking.
EVM transaction gas handling and logging
apps/price_pusher/src/evm/evm.ts
Added initial gas price logging; replaced debug log with detailed final gas price message including nonce and fee; introduced gasLimitToUse (defaults to 1,000,000) and always pass it to transaction simulation instead of conditionally omitting gas parameter.
Startup synchronization and initialization
apps/price_pusher/src/evm/command.ts
Updated EVM command startup to await PythPriceListener.start() and invoke waitForFirstPriceUpdate(15000) before creating EVM client, with console logging of timeout or success.
Docker image build and deployment
.github/workflows/rainix-docker.yml, Dockerfile
Added GitHub Actions workflow ("Docker image CI") that builds dependencies with Nix/pnpm, builds the price-pusher package via Turborepo, sets up Docker Buildx, authenticates to Docker Hub, and pushes image tag derived from workflow input. Dockerfile uses node:22.14 base, maps build args to runtime environment variables, copies repository, switches to apps/price_pusher, and defines startup command that runs npm run start evm with environment variable parameters and mnemonic file provisioning.
Price configuration and monitoring
apps/price_pusher/price-config.stable.sample.yaml
Replaced sample instruments (BTC/USD, BNB/USD, PYTH/USD) with expanded set (GOOG/USD, AMZN/USD, AAPL/USD, MSFT/USD, TSLA/USD, with .PRE/.POST variants). All entries standardized to time_difference 240s, price_deviation 0.05%, confidence_ratio 200; each includes early_update block with time_difference 150s and price_deviation 0.03%.
Development environment platform support
flake.nix
Refactored devShells.default.buildInputs to use with pkgs; syntax with lib.optionals for Linux-only (udev, libusb1) and Darwin-only (IOKit, CoreFoundation) dependencies. Replaced python3Packages.distutils with python3Packages.setuptools.
Test fixture data
test.json
Added JSON fixture containing two price update records pairing hex-encoded binary data with parsed price, EMA price, and metadata structures for testing price ingestion.

Sequence Diagram(s)

sequenceDiagram
    participant Startup as EVM Startup
    participant Listener as PythPriceListener
    participant Hermes as Hermes Stream
    participant EVM as EVM Client
    participant ContractSim as Contract Simulation

    Startup->>Listener: start()
    Listener->>Listener: await startListening()
    Listener->>Hermes: subscribe to price updates
    Hermes-->>Listener: onMessage(priceUpdate)
    Listener->>Listener: validate publish_time (24hr freshness)
    Listener->>Listener: store in latestPriceInfo
    Startup->>Listener: waitForFirstPriceUpdate(15s)
    Listener-->>Startup: true (got first update)
    Startup->>EVM: initialize client
    Startup->>ContractSim: begin updatePriceFeed loop
    ContractSim->>ContractSim: compute gasPrice, gasLimitToUse
    ContractSim->>ContractSim: log Initial/Final gas price
    ContractSim-->>ContractSim: simulation complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • rainlanguage/pyth-crosschain#5: Overlapping Docker infrastructure, EVM command startup, and price listener changes suggest a related or closely coordinated PR addressing the same price-pusher deployment and reliability improvements.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning Description is entirely missing required sections (Summary, Rationale, Testing) and contains only a bare title repetition. Complete the pull request description template with Summary, Rationale, and Testing sections explaining the changes, their necessity, and verification approach.
Title check ❓ Inconclusive Title is vague and non-specific; it names two ticker symbols without clarifying the nature of the changes or the actual scope of modifications. Provide a more descriptive title that explains what was added (e.g., 'Add TSM and CEG price feeds to configuration' or 'Expand price feeds with TSM and CEG support').
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-05-18-tsm-ceg

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Siddharth2207 Siddharth2207 self-assigned this May 18, 2026
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