-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support Account Data for Seeds in Account Resolution #5182
Support Account Data for Seeds in Account Resolution #5182
Conversation
Finally circled back to this bad boy. It's hilarious (and painful) how simple this change appears despite the tribulations it went through. In any case, it's worth mentioning that there are a few things I dislike about the design. RPC Fetch AbuseBecause not every address is known at the time I don't think there's anything we can do about this, but we are going to have a problem if people need to resolve a large number of accounts off-chain. I propose three solutions:
#[discriminator_hash_input("extra_account_metas:fetch_configs")]
pub struct FetchConfiigs {
indices: Vec<u8>,
}
impl SplVariableLenPack for FetchConfigs {
...
} |
In conclusion, I think the points raised above should become issues and solutions can be implemented later, but as long as nobody presses on their RPC endpoint rate limits with their list of extra metas, we should be OK for merging this. As it stands right now, the most restrictive is |
b6ed38f
to
b19cb57
Compare
46281e6
to
be2e6f0
Compare
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.
Looks really great overall! Nothing big here, mostly nits, so this should be ready to go soon
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.
Really great work! Just one little question, but otherwise this is ready to go from my side
Thanks Jon, appreciate the review & feedback. I still have to address the Rust doc comment you had, which unfortunately may change a few of the future-based types. Basically, I feel like RPC client is going to be one of the more popular off-chain provided "get account data" closures, so I'd better make sure it isn't a pain to package up for the resolution call. That will be just one more commit. Also will rebase, which will (maybe?) fix audit 💪🏼 |
Ah right, my bad, this is why I shouldn't do reviews past a certain hour |
And yeah we should be good |
Pull request has been modified.
6c56437
to
ff2c5e1
Compare
@joncinque In my last commit "enable doctest", I set up a client with RPC very similar to the test client I use in However, if they try to use a closure and just call an RPC client object directly, like below, the static lifetime requirements of futures will not allow you to pass an object and then return a future that depends on a reference to said object, even if you use |address: Pubkey| {
client
.get_account(&address) // Temporary value
.map_ok(|acct| Some(acct.data))
.map_err(|e| Box::new(e) as AccountFetchError)
} If the configuration I've written in the Rustdoc looks good to you, this is ready to roll. |
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.
Looks great! Just one last micro-nit and then this is good to go. I couldn't come up with anything better than your custom client
ff2c5e1
to
d578d10
Compare
Pull request has been modified.
This should be good to go |
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.
Really great work, thanks!
This PR adds support for account data as a seed configuration for a PDA stored
within validation data.
A dynamic program-derived address may depend on one or more seeds that are
actually taken from the inner data of some account in the list of accounts
provided to the program.
Reviewing this PR
None
for accounts that don't exist