solana icon indicating copy to clipboard operation
solana copied to clipboard

rpc: parse token accounts in simulate_transaction

Open yihau opened this issue 1 year ago • 4 comments

Problem

jsonParsed will never work for token accounts because we missed decimals.

Summary of Changes

~add new parsing code for JsonParsed. it will~

~- check if accounts's owner is token program~ ~- get mint account data from either post_simulation_accounts or bank and decimals from it.~

updated:

add a new func arg, overwrite_accounts, to fn get_encoded_account and fn get_parsed_token_account.

yihau avatar Jan 02 '24 11:01 yihau

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e2c2029) 81.7% compared to head (6e60b1a) 81.8%. Report is 1 commits behind head on master.

:exclamation: Current head 6e60b1a differs from pull request most recent head 6407b27. Consider uploading reports for the commit 6407b27 to get more accurate results

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     

codecov[bot] avatar Jan 02 '24 13:01 codecov[bot]

just updated with a new attempt. I passed a new variable overwrite_accounts into those parsing functions.

yihau avatar Jan 04 '24 18:01 yihau

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!

mcintyre94 avatar Jan 09 '24 16:01 mcintyre94

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.

mergify[bot] avatar Jan 18 '24 03:01 mergify[bot]