Skip to content

Conversation

@Siddharth2207
Copy link
Contributor

@Siddharth2207 Siddharth2207 commented Dec 12, 2025

Motivation

MSTR,TSLA,NVDA,AMZN,COIN pre and post market

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • New Features

    • Added PRE/POST market-hour variants for multiple equity price feeds and added support for CRCL/USD and PPLT/USD.
  • Tests

    • Expanded test coverage and assertions for new PRE/POST variants and CRCL/PPLT; added tests exercising CRCL and PPLT scenarios and updated expected price data.
  • Chores

    • Updated fork base configuration to include new bases for CRCL and PPLT.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Adds PRE/POST variants for multiple US equity price feeds, introduces CRCL/USD and PPLT/USD feeds, updates LibPyth symbol→ID and contract resolution, adjusts test fork bases, and expands tests to cover new feeds and expected price/confidence values.

Changes

Cohort / File(s) Summary
Core library — Pyth feed constants & mapping
src/lib/pyth/LibPyth.sol
Adds PRICE_FEED_ID_* and PRICE_FEED_SYMBOL_INTORASTRING_* constants for PRE/POST variants (AMZN, TSLA, NVDA, MSTR, COIN, CRCL, PPLT); minor formatting tweaks; extends getPriceFeedId and getPriceFeedContract to map PRE/POST, CRCL, and PPLT variants.
Test config / forks
test/lib/LibFork.sol
Updates FORK_BLOCK_BASE and adds FORK_BLOCK_BASE_CRCL and FORK_BLOCK_BASE_PPLT constants.
Tests — constants & ID resolution
test/src/lib/pyth/LibPyth.constants.t.sol, test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol
Adds assertions and known-mapping checks for PRE/POST variants (COIN, AMZN, TSLA, NVDA, MSTR) and new CRCL/PPLT feeds; adjusts imports.
Tests — price queries / expectations
test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol
Updates many expected price/confidence values, adds PRE/POST expected data, and introduces testPriceNoOlderThanBaseCrcl() and testPriceNoOlderThanBasePplt() using the new fork bases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check new constants against upstream Pyth feed IDs and exact IntOrAString symbol strings.
  • Verify getPriceFeedId / getPriceFeedContract branches correctly handle PRE/POST, CRCL, and PPLT variants without collisions.
  • Validate updated test expectations and new fork-block constants in LibFork.sol.

Possibly related PRs

  • coin/usd feed #14 — Overlapping edits to LibPyth feed constants and getPriceFeedId mapping (COIN mapping additions).
  • sivr/usd #15 — Similar additions of price-feed constants and extensions to symbol→ID mapping in LibPyth.
  • GME, MSTR, SPLG, BRK-B feed #3 — Prior LibPyth changes that introduced MSTR and related feed lookup logic.

Suggested reviewers

  • thedavidmeister
  • hardyjosh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'pre, post market' directly relates to the main change: adding pre- and post-market price feeds for multiple equity tickers (AMZN, TSLA, NVDA, MSTR, COIN, CRCL, PPLT).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-12-12-pre-post

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3a049 and 638e09d.

📒 Files selected for processing (2)
  • test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (6 hunks)
  • test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: git-clean
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
🔇 Additional comments (6)
test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (4)

7-14: LGTM: Fork block constants properly imported.

The new fork block constants FORK_BLOCK_BASE_CRCL and FORK_BLOCK_BASE_PPLT are correctly imported and align with their usage in the new test functions below.


187-328: LGTM: Test data updated for new fork block.

The updated expected price and confidence values throughout testPriceNoOlderThanBase reflect the state at the new FORK_BLOCK_BASE, and the addition of PRE/POST market variants for AMZN, TSLA, NVDA, MSTR, and COIN properly expands test coverage for the new symbols introduced in the production code.


331-351: LGTM: CRCL test function with PRE/POST variants.

The new test function properly exercises the CRCL ticker with regular, pre-market, and post-market variants using the dedicated fork block constant.


353-361: PPLT PRE/POST feed IDs are not defined in the library.

The library only defines PRICE_FEED_ID_EQUITY_US_PPLT_USD for regular market hours. PRE/POST variants are available only for AMZN, TSLA, NVDA, MSTR, COIN, and CRCL. The test is correctly scoped to the available feed IDs.

Likely an incorrect or invalid review comment.

test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (2)

73-80: LGTM: PRE/POST feed ID mappings properly tested.

The assertions correctly verify that the new PRE/POST symbol variants for COIN, AMZN, TSLA, NVDA, and MSTR resolve to their expected feed IDs, providing good coverage for the expanded symbol-to-ID mappings.

Also applies to: 89-96, 109-116, 121-128, 141-148


193-226: LGTM: Fuzz test exclusions properly updated.

The exclusion list correctly includes all newly supported symbols (PRE/POST variants and new base tickers) to prevent false failures in the fuzz test that expects unknown symbols to revert.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (1)

167-208: Refactor vm.assume mega-predicate to a helper using the LibPyth symbol constants.
Current form is brittle and easy to desync when adding new feeds.

 contract LibPythGetPriceFeedIdTest is Test {
+    function _isKnownSymbol(uint256 u) internal pure returns (bool) {
+        return u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_ARB_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_BTC_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_WBTC_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_CBBTC_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_DOT_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_ENA_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_ETH_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_WETH_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_WSTETH_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_LINK_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_PEPE_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_PYTH_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_UNI_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_XAUT_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_CRYPTO_XRP_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_COIN_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_COIN_USD_PRE
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_COIN_USD_POST
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GOOG_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AMZN_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AMZN_USD_PRE
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AMZN_USD_POST
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_AAPL_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSFT_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_TSLA_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_TSLA_USD_PRE
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_TSLA_USD_POST
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_NVDA_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_NVDA_USD_PRE
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_NVDA_USD_POST
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_META_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_GME_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD_PRE
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_MSTR_USD_POST
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_BRK_B_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SPLG_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_IAU_USD
+            || u == LibPyth.PRICE_FEED_SYMBOL_INTORASTRING_EQUITY_US_SIVR_USD;
+    }
+
     function testPriceFeedIdUnknownMappings(IntOrAString symbol) external {
-        vm.assume(
-            IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Crypto.ARB/USD"))
-                && IntOrAString.unwrap(symbol) != IntOrAString.unwrap(LibIntOrAString.fromString2("Crypto.BTC/USD"))
-                ...
-        );
+        uint256 u = IntOrAString.unwrap(symbol);
+        vm.assume(!_isKnownSymbol(u));
         vm.expectRevert(UnsupportedFeedSymbol.selector);
         this.getPriceFeedIdExternal(symbol);
     }
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e7a4506 and 4dd1914.

📒 Files selected for processing (5)
  • src/lib/pyth/LibPyth.sol (5 hunks)
  • test/lib/LibFork.sol (1 hunks)
  • test/src/lib/pyth/LibPyth.constants.t.sol (5 hunks)
  • test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (5 hunks)
  • test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-03T13:50:23.519Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.pyth PR: 3
File: src/lib/pyth/LibPyth.sol:59-79
Timestamp: 2025-10-03T13:50:23.519Z
Learning: In the rain.pyth repository, the IntOrAString encoding scheme supports custom discriminator bytes. While most equity feed symbols use 0x92 as the discriminator byte, custom values like 0x91 are intentionally used for specific feeds such as EQUITY_US_GME_USD.

Applied to files:

  • src/lib/pyth/LibPyth.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: deploy
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: git-clean
🔇 Additional comments (5)
test/src/lib/pyth/LibPyth.constants.t.sol (1)

80-87: Constant encoding assertions look solid for PRE/POST variants.
Good coverage to ensure the IntOrAString literals match fromString2(...).

Also applies to: 96-103, 116-123, 128-135, 148-155

test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (1)

73-80: PRE/POST mapping tests: good additions.
These directly validate the new branches in LibPyth.getPriceFeedId.

Also applies to: 89-96, 109-116, 121-128, 141-148

test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1)

180-200: Forked price expectations: please verify determinism at FORK_BLOCK_BASE = 39366248, especially PRE/POST within 24h.
This is a good coverage expansion, but it will fail hard if any feed isn’t published within the 24h window at that exact block.

Also applies to: 216-248, 264-278, 301-315

src/lib/pyth/LibPyth.sol (1)

115-124: Verify PRE/POST feed IDs against Pyth official source and confirm chain deployment.

The new PRICE_FEED_ID_EQUITY_US_*_USD_PRE/POST constants require validation against the official Pyth Price Feed IDs page (via Pyth docs or Hermes API). Ensure all six symbols (AMZN, TSLA, NVDA, MSTR, COIN) are deployed on Base and Arbitrum chains—if any feed ID is incorrect or unavailable on a target chain, price reads will revert or return wrong data. Regarding the IntOrAString discriminator bytes (0x96/0x97): custom discriminator bytes are intentionally used in this repo (e.g., 0x91 for EQUITY_US_GME_USD per the codebase learnings), so confirm these values align with your encoding scheme.

Also applies to: 143-152, 159-168, 187-196, 222-231

test/lib/LibFork.sol (1)

8-9: Add documentation for fork block choice on Base.

The fork block (39366248, mined Dec 12, 2025) is very recent. Add a comment explaining why this specific block was selected—e.g., "first block where Equity.US.* feeds have fresh prices" or similar rationale—to help future maintainers understand the determinism requirement and when/why it may need updating.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (1)

167-216: The growing vm.assume “known symbol exclusion” list is brittle and reduces fuzz usefulness.
As more symbols/variants are added, this becomes easy to forget to update and can significantly constrain fuzzing. Consider centralizing “known symbols” into a single list used by both the positive and negative tests (or generate exclusions from the same table used in testPriceFeedIdKnownMappings).

test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1)

175-322: PRE/POST coverage looks good, but these exact-value asserts are tightly coupled to FORK_BLOCK_BASE.
If FORK_BLOCK_BASE moves, this will likely require broad rewrites. Consider centralizing (symbol, expectedPrice, expectedConf) in a single table (including PRE/POST) to reduce churn and improve readability. Also worth double-checking that all newly-added PRE/POST expectations are derived from the same pinned fork block state you intend CI to use.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4dd1914 and bd458a0.

⛔ Files ignored due to path filters (1)
  • src/generated/PythWords.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (3)
  • test/src/concrete/PythFork.t.sol (1 hunks)
  • test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (5 hunks)
  • test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: git-clean
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/lib/pyth/LibPyth.sol (1)

283-322: Mappings for PRE/POST variants look consistent; getPriceFeedId chain growth note (duplicate).

The new branches map each newly-added PRICE_FEED_SYMBOL_INTORASTRING_*_{PRE,POST} to the matching PRICE_FEED_ID_*_{PRE,POST} and are placed adjacent to their base ticker mappings, which reduces mismatch risk.

The function is still trending toward an error-prone mega-chain; this was already called out in prior review comments.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd458a0 and 4794da1.

📒 Files selected for processing (1)
  • src/lib/pyth/LibPyth.sol (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-03T13:50:23.519Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.pyth PR: 3
File: src/lib/pyth/LibPyth.sol:59-79
Timestamp: 2025-10-03T13:50:23.519Z
Learning: In the rain.pyth repository, the IntOrAString encoding scheme supports custom discriminator bytes. While most equity feed symbols use 0x92 as the discriminator byte, custom values like 0x91 are intentionally used for specific feeds such as EQUITY_US_GME_USD.

Applied to files:

  • src/lib/pyth/LibPyth.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: git-clean
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
🔇 Additional comments (4)
src/lib/pyth/LibPyth.sol (4)

115-124: The AMZN PRE/POST constants are correct. The IntOrAString encodings properly decode to Equity.US.AMZN/USD.PRE and Equity.US.AMZN/USD.POST with discriminators 0x96 and 0x97 respectively. The feed IDs are validated by test usage in test/src/concrete/PythFork.t.sol, and the discriminator pattern is consistent across all new PRE/POST feeds (TSLA, NVDA, MSTR, COIN), aligning with the design that custom discriminator bytes are intentional.


159-168: Symbol encodings are correct; feed ID values cannot be verified without Pyth API access.

The IntOrAString encodings for both NVDA PRE and POST are correct:

  • PRE: 0x964571756974792e55532e4e5644412f5553442e505245... decodes to discriminator 0x96 + "Equity.US.NVDA/USD.PRE"
  • POST: 0x974571756974792e55532e4e5644412f5553442e504f53540000... decodes to discriminator 0x97 + "Equity.US.NVDA/USD.POST"

Both constants are validated in test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (lines 121–127), confirming the symbol-to-ID mappings work correctly.

However, the actual feed ID hex values themselves cannot be verified against official Pyth documentation without access to the Pyth Hermes API or official feed list. Pyth publishes only the mechanism for feed IDs (https://docs.pyth.network/price-feeds/core/price-feeds/price-feed-ids) but not a static reference of all IDs. To verify the hex values, cross-reference against Pyth's Hermes API or the official price feed registry.


187-196: Symbol encodings are correctly formatted and verified through tests. Feed ID hex values match the library's internal symbol-to-ID mapping and pass all validation tests, but their absolute correctness against Pyth's official data cannot be independently confirmed due to unavailable API access and unpublished feed documentation.


143-152: No changes needed. Both feed IDs and IntOrAString encodings are correct per official Pyth documentation:

  • Feed IDs match: TSLA/USD PRE 0x42676a595d...854ebe20a and POST 0x2a797e19...bcd256cdb9b9
  • IntOrAString PRE decodes to Equity.US.TSLA/USD.PRE with discriminator 0x96
  • IntOrAString POST decodes to Equity.US.TSLA/USD.POST with discriminator 0x97

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/lib/pyth/LibPyth.sol (1)

291-338: getPriceFeedId branch growth continues; consider structural refactor.

The new PRE/POST mappings are correctly added and follow the established pattern. However, this if-else chain continues to grow (now ~50 branches). As noted in a previous review, consider splitting by domain (crypto vs equity) or using a lookup table to reduce maintenance burden and error risk.

test/src/lib/pyth/LibPyth.constants.t.sol (1)

5-5: Drop console2 import if unused.

console2 is imported but not used in this test file.

-import {Test, console2} from "forge-std/Test.sol";
+import {Test} from "forge-std/Test.sol";
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02013e0 and a8446e7.

📒 Files selected for processing (4)
  • src/lib/pyth/LibPyth.sol (6 hunks)
  • test/src/lib/pyth/LibPyth.constants.t.sol (6 hunks)
  • test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (6 hunks)
  • test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-03T13:50:23.519Z
Learnt from: Siddharth2207
Repo: rainlanguage/rain.pyth PR: 3
File: src/lib/pyth/LibPyth.sol:59-79
Timestamp: 2025-10-03T13:50:23.519Z
Learning: In the rain.pyth repository, the IntOrAString encoding scheme supports custom discriminator bytes. While most equity feed symbols use 0x92 as the discriminator byte, custom values like 0x91 are intentionally used for specific feeds such as EQUITY_US_GME_USD.

Applied to files:

  • src/lib/pyth/LibPyth.sol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-static)
  • GitHub Check: git-clean
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: rainix (ubuntu-latest, rainix-sol-test)
🔇 Additional comments (24)
src/lib/pyth/LibPyth.sol (6)

115-124: LGTM: AMZN PRE/POST constants added correctly.

The feed IDs and INTORASTRING symbols follow the established pattern. The discriminator bytes (0x96 for PRE, 0x97 for POST) are consistent with other PRE/POST variants.

Please verify that these Pyth feed IDs (0x82c59e... for PRE, 0x62731d... for POST) are correct against your Pyth feed configuration, as these cannot be independently verified from public documentation.


143-152: LGTM: TSLA PRE/POST constants added correctly.

Pattern is consistent with other equity PRE/POST feeds.

Please verify the TSLA PRE/POST feed IDs against your Pyth feed configuration.


159-168: LGTM: NVDA PRE/POST constants added correctly.

Pattern is consistent with other equity PRE/POST feeds.

Please verify the NVDA PRE/POST feed IDs against your Pyth feed configuration.


187-197: LGTM: MSTR PRE/POST constants added correctly.

Pattern is consistent with other equity PRE/POST feeds.

Please verify the MSTR PRE/POST feed IDs against your Pyth feed configuration.


221-231: LGTM: COIN PRE/POST constants added, formatting updated.

The uint256() wrapper was removed from the base COIN_USD symbol (line 221) for consistency with other equity symbols. PRE/POST variants added correctly.

Please verify the COIN PRE/POST feed IDs against your Pyth feed configuration.


238-243: LGTM: New CRCL/USD feed added.

New equity feed for Circle (CRCL) follows the established pattern with discriminator byte 0x92.

Please verify the CRCL/USD feed ID (0x92b8527a...) against your Pyth feed configuration.

test/src/lib/pyth/LibPyth.constants.t.sol (6)

80-87: LGTM: COIN PRE/POST symbol constant tests added.

Tests correctly validate the INTORASTRING encoding for COIN PRE/POST variants.


96-103: LGTM: AMZN PRE/POST symbol constant tests added.

Tests correctly validate the INTORASTRING encoding.


116-123: LGTM: TSLA PRE/POST symbol constant tests added.

Tests correctly validate the INTORASTRING encoding.


128-135: LGTM: NVDA PRE/POST symbol constant tests added.

Tests correctly validate the INTORASTRING encoding.


148-155: LGTM: MSTR PRE/POST symbol constant tests added.

Tests correctly validate the INTORASTRING encoding.


172-175: LGTM: CRCL/USD symbol constant test added.

Test correctly validates the INTORASTRING encoding for the new CRCL feed.

test/src/lib/pyth/LibPyth.getPriceFeedId.t.sol (7)

73-80: LGTM: COIN PRE/POST feed ID mapping tests added.

Tests correctly validate the getPriceFeedId mappings for COIN PRE/POST variants.


89-96: LGTM: AMZN PRE/POST feed ID mapping tests added.


109-116: LGTM: TSLA PRE/POST feed ID mapping tests added.


121-128: LGTM: NVDA PRE/POST feed ID mapping tests added.


141-148: LGTM: MSTR PRE/POST feed ID mapping tests added.


165-168: LGTM: CRCL/USD feed ID mapping test added.


189-217: LGTM: Unknown mappings exclusion list updated.

All new PRE/POST variants and CRCL/USD are correctly added to the vm.assume exclusion list, ensuring the fuzz test properly excludes known symbols.

test/src/lib/pyth/LibPyth.getPriceNoOlderThan.t.sol (5)

189-199: LGTM: AMZN PRE/POST price retrieval tests added.

Tests validate that getPriceNoOlderThan correctly returns price and confidence values for AMZN PRE/POST feeds at the fork block.


219-229: LGTM: TSLA PRE/POST price retrieval tests added.


237-247: LGTM: NVDA PRE/POST price retrieval tests added.


267-277: LGTM: MSTR PRE/POST price retrieval tests added.


304-314: LGTM: COIN PRE/POST price retrieval tests added.

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.

2 participants