Skip to content

feat(target_chains/ton): add helper function to parse price IDs beyond a single cell and enhance update handling #2558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 17, 2025

Conversation

cctdaniel
Copy link
Contributor

@cctdaniel cctdaniel commented Apr 4, 2025

Summary

Added a helper function to parse price IDs from cell chains, improving support for large sets of price feed IDs that span multiple cells. This allows handling of more than 3 price IDs in a single request.

Rationale

The original implementation couldn't properly handle price IDs that span cell boundaries, causing cell underflow errors (exit code 9) with larger sets of price feed IDs. By refactoring the parsing logic into a shared helper function that properly handles bit loading across cell boundaries, we've made the code more robust and maintainable.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

The implementation has been tested with the existing test suite plus new tests that specifically verify handling of more than 3 price feed IDs. Test cases should successfully parse price feed updates with more than 3 price feed ids and should successfully parse unique price feed updates with more than 3 price feed ids demonstrate that the changes correctly handle larger price ID sets across cell chains.

Copy link

vercel bot commented Apr 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am
component-library ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am
insights ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am
proposals ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am
staking ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2025 11:57am

@ali-bahjati ali-bahjati requested a review from Copilot April 7, 2025 09:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • target_chains/ton/contracts/contracts/Pyth.fc: Language not supported
Comments suppressed due to low confidence (2)

target_chains/ton/contracts/tests/utils/pyth.ts:175

  • [nitpick] The constant name 'HERMES_SOL_TON_PYTH_USDT_UPDATE' is quite long and could be hard to read; consider using a shorter or more descriptive name if possible or adding inline documentation to clarify its composition.
export const HERMES_SOL_TON_PYTH_USDT_UPDATE =

target_chains/ton/contracts/tests/PythTest.spec.ts:1122

  • [nitpick] There is considerable duplicated logic in the test cases for parsing price feed updates; consider extracting common verification steps into a helper function to improve maintainability.
it("should successfully parse price feed updates with more than 3 price feed ids", async () => {

Copy link
Collaborator

@ali-bahjati ali-bahjati left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -1110,6 +1119,91 @@ describe("PythTest", () => {
);
});

it("should successfully parse price feed updates with more than 3 price feed ids", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add checks for the last feed in the list as well? just to make sure all work fine.

@cctdaniel cctdaniel merged commit 31e93f0 into main Apr 17, 2025
9 checks passed
@cctdaniel cctdaniel deleted the ton-pyth-price-feed-ids branch April 17, 2025 12:09
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