-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
rpc: parse token accounts in simulate_transaction #34619
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #34619 +/- ##
========================================
Coverage 81.7% 81.8%
========================================
Files 825 825
Lines 223261 222316 -945
========================================
- Hits 182605 181955 -650
+ Misses 40656 40361 -295 |
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'm on board with this change conceptually (in fact, I'm a little surprised no one's complained about the issue before now), but I don't love how much it duplicates code that already exists in some fashion.
Let's articulate the reasons solana_rpc::get_encoded_account
doesn't work for this use, and maybe we can rework it into a submethod or two that reuses the existing encoding logic?
just updated with a new attempt. I passed a new variable |
I opened the issue for this yesterday, forgot to check for an open PR first sorry! One reason it hasn't been complained about before is that the legacy web3js doesn't expose the accounts encoding option, so everyone there has been stuck with base64 on all accounts. I came across this issue building with the new web3js which exposes the accounts encoding. I've also mentioned the issue to @joncinque and he suggested that we might be able to backport this to 1.17, since it only affects the JSON RPC and is a bug. If that is possible then it'd be really helpful! |
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.
This looks really close now! Just some thoughts about naming and organizing the new get_account method.
54a7d9c
to
50cba61
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.
One last comment nit; I made it as a suggestion so it is easy to commit. Then lgtm!
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
Co-authored-by: Tyera <teulberg@gmail.com>
7ec7687
to
6407b27
Compare
* rpc: parse token accounts in simulate_transaction * add overwrite_accounts into get_encoded_account and get_parsed_token_account * revert get_mint_decimals scope changes * move common.rs to rpc/account_resolver.rs * rename get_account to get_account_from_overwrites_or_bank * add a comment * clippy * add comment Co-authored-by: Tyera <teulberg@gmail.com> --------- Co-authored-by: Tyera <teulberg@gmail.com> (cherry picked from commit 7470c3d)
…34619) (#34852) * rpc: parse token accounts in simulate_transaction (#34619) * rpc: parse token accounts in simulate_transaction * add overwrite_accounts into get_encoded_account and get_parsed_token_account * revert get_mint_decimals scope changes * move common.rs to rpc/account_resolver.rs * rename get_account to get_account_from_overwrites_or_bank * add a comment * clippy * add comment Co-authored-by: Tyera <teulberg@gmail.com> --------- Co-authored-by: Tyera <teulberg@gmail.com> (cherry picked from commit 7470c3d) * remove innerInstructions --------- Co-authored-by: Yihau Chen <a122092487@gmail.com> Co-authored-by: yihau <yihau.chen@icloud.com>
Problem
jsonParsed will never work for token accounts because we missed decimals.
Summary of Changes
add new parsing code forJsonParsed
. it will- check if accounts's owner is token program- get mint account data from eitherpost_simulation_accounts
orbank
and decimals from it.updated:
add a new func arg,
overwrite_accounts
, tofn get_encoded_account
andfn get_parsed_token_account
.