You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pre-requisite for #1361. This is needed for non anchor accounts that won't have the account header and so can't store bump seeds directly in the account data (and so the bump needs to be stored in some other associated account).
One can use ctx.bumps.get("<my_account_name>") to get a bump seed already searched for in the accounts context.
Given that we know which accounts require a PDA check at compile-time, would it be more efficient to generate a struct like BumpsAccountStruct instead of using a BTreeMap? For example:
With a BTreeMap with string keys, there are no compile-time checks for account name refactors as well. If i change the struct field name from pda_1 to pda_2 but forget to change the code from ctx.bumps.get("pda_1") to ctx.bumps.get("pda_2"), it becomes a runtime error instead
so i think ctx.bumps would be the generated struct instead of a BTreeMap (so BumpsExample in this case). So instead of ctx.bumps.get("pda_1") it will be ctx.bumps.pda_1. This will probably require adding a new generic to Context for this "bumps" type. Haven't looked closely at the lang internals yet so i'm not sure how difficult it would be to implement this.
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
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.
Closes #1364.
Pre-requisite for #1361. This is needed for non anchor accounts that won't have the account header and so can't store bump seeds directly in the account data (and so the bump needs to be stored in some other associated account).
One can use
ctx.bumps.get("<my_account_name>")to get a bump seed already searched for in the accounts context.