-
Notifications
You must be signed in to change notification settings - Fork 38
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
CPI first pass impl #8
Conversation
&sol_ix as *const _ as *const _, | ||
&sol_account_infos as *const _ as *const _, | ||
sol_account_infos_len, | ||
signers as *const _ as *const _, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't pass the signers rust references directly to the C code, since it expects the length of each individual seed unfortunately. I started adding signer "types" on this PR: https://github.com/febo/pinocchio/pull/11/files#diff-c14b0096da794786d77f37e2667c1f5cf800e7bf7875f8e99059e14857a03cf4R107-R127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
pub fn invoke_signed<'a, const MAX_ACCOUNTS_INCL_PROGRAM: usize>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add the borrow checks: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/program.rs#L255-L269
We could have an unsafe *_unchecked
variation without the checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw do you know why the https://github.com/anza-xyz/agave/blob/master/sdk/program/src/program.rs#L255-L269 is doing this n^2 thing of looking for the corresponding AccountInfo for a given AccountMeta? Aren't both the AccountInfo and AccountMeta array supposed to be in the same order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not required to be in the same order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks for preparing this!
I had started to add the types required for CPI in a separate PR (#11) so perhaps we can combine the effort.
@billythedummy What do you think if we use the types from #11? We could merge #11 and then rebase this PR. |
Sure thing, please go ahead with any changes you're planning to make and feel free to merge or adapt all my open PRs; unfortunately I won't have a lot of time to dedicate to this until at least the end of breakpoint, apologies |
Closing this as the changes suggested on this PR were added to #11 – thank you for your contribution @billythedummy. |
Tested out with some actual programs CPI-ing system program.
Feel free to critique design