Skip to content
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

program: adjust account load ordering to match builtin #44

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

buffalojoec
Copy link
Contributor

Problem

Working with the Firedancer tooling some more, I realized that - in many cases - the builtin version of ALT will load an account and then run one or more checks on it before moving onto loading the next one.

In the BPF version, we follow the common BPF program pattern of loading all accounts up front with subsequent calls to next_account_info. However, this can cause ProgramError::NotEnoughAccountKeys in situations where the builtin may have thrown a different error (such as InstructionError::IncorrectOwner).

Summary

Change the ordering of account loads and checks to exactly match the builtin version.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@buffalojoec buffalojoec merged commit 247039b into main Nov 13, 2024
9 checks passed
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.

2 participants