-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Missing non-bpf alternative for create_program_address #11458
Comments
Good point, you are talking about here? |
I actually also need to access it from the CLI code so I would appreciate if it was available outside of the |
Yeah, I'm looking at that exact thing, easier said than done |
Why does you CLI define |
The CLI does not but I still need access to the derivation |
Sorry, confused, if CLi doesn't define the |
The CLI uses predefined derivation methods from the program which uses the syscall function. |
@jackcmay, I found it weird that there's Lines 94 to 116 in 7e25130
|
@hendrikhofstadt Do those pre-defined derivation calls need to be behind the @mvines |
I was just confused to find basically same function in two locations. |
@jackcmay They don't because I want to share them between the CLI and the program. Ideally they would resolve to the syscall in bpf and the Pubkey:: function in the CLI. |
Same signature, different function :-). One is just a wrapper |
@hendrikhofstadt What do you see as the right way in the SDK? In your program you can do: #[cfg(not(feature = "program"))]
use solana_sdk::pubkey::create_program_address
#[cfg(feature = "program")]
use solana_sdk::program::create_program_address Are you suggesting putting the stub also in |
From a developer experience standpoint I think it would be more intuitive to have the function in just one place using a target config flag to pick the implementation as you proposed. Generally I would expect that to be the case for any function that has a faster syscall based implementation. That way a new developer will write more efficient code by default. |
wdyt: #11460 |
@jackcmay Actually I think that syscall should rather do The fact of having to calculate a nonce in addition to the seeds makes derived keys unusable for k->v mappings because there are now n (nonce) mappings for k->v. I do understand that this negatively affects performance. At the same time why must derived keys not lie on the curve? Shouldn't the security of the curve be enough to guarantee that there will not be any collisions? |
Program addresses are never meant to be signable by an outside entity so we split the domain so that wasn't possible.
What do you think about closing this issue as part of #11460 given the problem description? |
Problem
In 1.3.0
create_program_address
was migrated to a syscall. However there is no non-syscall fallback for tests.The text was updated successfully, but these errors were encountered: