Repository navigation
Conversation
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Before this PR, the interface inconsistently assumes either that the program address is exactly the one specified in the
solana_pubkey::declare_id!or that the program address is the one passed to the relevant function.This inconsistency was caused by a series of refactors with the purpose of better CU efficiency in the programs.
This PR split these concerns: all these tricks are only needed in the program, so everything that requires the hardcoded program is moved out of the interface crate and into the settlement program crate. The rest of the interface then becomes generic, and the interface/client crates can be used with any program.
This is particularly relevant in a future follow-up: implement a nicer way to deploy both prod and barn (staging) programs with the same code by just switching a build-time flag.
No changes to the program logic are intended. Interesting, we get some minor CU savings. (I tried to remove some
inline(always)via AI but it didn't work still, unfortunately.)How to review
Most of the code is the same, just moved.
This can be easily seen with
git diff --color-moved. The actual changes to review are much less than the line diff count would lead to believe, namely two new tests and some glue.Another thing to check is: does the interface still use the hardcoded program address anywhere?
To verify this isn't the case, comment out the
PROD_IDconstant and compile only the client (and through it the interface) and see that build passes:Tests
The tests are mostly the same, so check that tests weren't dropped and the split doesn't require additional coverage.