-
Notifications
You must be signed in to change notification settings - Fork 245
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
Conversation
…d a single cell and enhance update handling
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 6 Skipped Deployments
|
There was a problem hiding this 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 () => {
There was a problem hiding this 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 () => { |
There was a problem hiding this comment.
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.
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?
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.