[pyth_oracle] Improve build.rs robustness and expose types. #343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a feature flag,
library
to thepyth-oracle
program. When toggled on, the library exposes its account types for use as a library instead of a standalone program. When the flag is enabled, thebuild.rs
script will also switch to execute the C compilation as well. The artefacts are output within the Rust target sandbox rather than into the relative source directory (./program/c/target
).The benefit of this:
Rather than fully switch to this, the feature flag is added so any existing reliance on the current build method continues to work. The primary reason I wanted this is because I am relying on
pyth-sdk-rs
and I found it very hard to tell exactly what is different there versus the accounts defined within the contract. With this feature flag it is possible for me to enforce extra constraints inpyth-sdk-rs
that prevent the libraries going out of sync and highlights the differences in a testable way.See the associated PR for context.