Skip to content

Conversation

@majabbour
Copy link
Contributor

We plan on resizing price accounts to fit the Time Machine. This PRs ensures that this does not cause existing C code to fail.
There are two places where the size of price_t not being the same as the account size can cause failures:

1-rent exempt check while validating accounts (oracle.c)
2-Decompressing the result of the RPC request to Solana requesting to read price contracts (pythd, request.cpp)

(We do not change the default new account size for Pyth-manager because it is helpful to have accounts from the old size in unit tests, and C pyth-manager is no longer used anyway)

@majabbour majabbour requested a review from guibescos July 22, 2022 00:23
@guibescos
Copy link
Contributor

Definitely want a second pair of eyes on this

@majabbour majabbour force-pushed the make-c-robust-to-price-account-size branch from 9410cbf to 7d43f5c Compare July 22, 2022 17:46
@majabbour majabbour requested a review from tompntn July 22, 2022 19:06
@majabbour majabbour force-pushed the make-c-robust-to-price-account-size branch from 7d43f5c to 0984ef5 Compare July 25, 2022 17:58
@majabbour majabbour changed the base branch from main to twap-tracker-production July 25, 2022 18:00
@majabbour majabbour merged commit a1efe92 into twap-tracker-production Jul 25, 2022
@majabbour majabbour deleted the make-c-robust-to-price-account-size branch July 25, 2022 18:02
@majabbour majabbour restored the make-c-robust-to-price-account-size branch July 26, 2022 14:13
@majabbour majabbour deleted the make-c-robust-to-price-account-size branch July 26, 2022 14:14
guibescos added a commit that referenced this pull request Jul 28, 2022
* Make c robust to price account size (#201)

* make pythd robust

* made the oracle accept new size

* left space for extra publishers

* Make c robust to price account size (#207)

* make pythd robust

* made the oracle accept new size

* left space for extra publishers

* Intercepting price updates (#204)

* changed c return value of update price to indicate aggregation (#190)

* changed c return value of update price to indicate aggregation

* forgot to add bindings

* removed the need for casting

* fixed update_no_fail

* removed unnecessary docker packages

* timeless coments

* a convinient way to derive traits

* changed importing style

* added register_traits method

* fixed formatting

* add a new insctruction and interecepted update price calls

* fixed formatting

* more helpful error message for incorrect c account size

* fixed merging errors

* addressed some warning

* updated comment

* merging formatting issues

* memory borrowing issues after rebasing

* updated import

* more import style changes

* removed panics

* bug introduced by merge

* moved dispatching to processor

* better formatting

* cleaner error handling

* error handling wrapper for c_entrypoint

* removed unwrap

* more comments

* removed unused imports + changed import style

Co-authored-by: majabbour <[email protected]>
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.

3 participants